Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:09:36+00:00 2026-06-06T12:09:36+00:00

How can I output something from the vertex shader to the pixel shader multiple

  • 0

How can I output something from the vertex shader to the pixel shader multiple times. Eg I need to output the vertex color as a float 4 to the pixel shader 4 times after performing some different math operations on the vertex color in the vert shader?

can I do this? I tried creating an empty float4 color2, reading the In.vertcolor from In.color and outputing that… I dont get any errors but my texture is white. Its just reading any empty float 4…

here is my code for this section. Thanks!

//////////////////////////////////////////////////////////////
// Structs section 
// input from application
struct a2v {
float4 position  : POSITION;
float4 normal    : NORMAL;
float2 texCoord : TEXCOORD0;
float2 secondUV : TEXCOORD1;
float4 color: COLOR;
float4 color2;

};

// output to fragment program
struct v2f {
    float4 position        : POSITION;
    float2 texCoord : TEXCOORD0;

    float2 secondUV : TEXCOORD1;
    float3 worldNormal     : TEXCOORD2;
    float4 color: COLOR;
    float4 color2;

};



//////////////////////////////////////////////////////////////
// Vertex Shader 

v2f vShader(a2v In)
{
v2f Out;
Out.texCoord = In.texCoord;
Out.secondUV = In.secondUV;

float4 Mask1 = floor ((fmod((In.color  * 100f ), 10f))) *.111f;
float4 Mask2 = floor ((fmod((In.color2  * 100f ), 10f))) *.111f;
Out.color = Mask1;
Out.color2 = Mask2;


Out.position = mul(WorldViewProjection, In.position);
Out.worldNormal = mul(WorldInverseTranspose, In.normal).xyz;

return Out;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:09:37+00:00Added an answer on June 6, 2026 at 12:09 pm

    There is a COLOR1 binding attribute which you can assign to the ‘color2’ field in a2v and v2f structures.

    Be sure to allocate the secondary color (COLOR1) as an attribute stream in you application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to output some data from Perl to JSON. I can do
I'm testing something and the output windows is being flooded with exceptions. How can
How can I get output from Java anonymous classes? In .Net I would use
I'm getting JSON-encoded output from another organization's API. In many cases, the output can
I am grabbing a JSON response from AJAX request, the output is something like
I've been using the following to output navigation from a specific directory but need
I need to output something like this: <div class=scrollable><div class=items> <div><img src=1 alt=/><img src=2
Suppose i have a template foo which can output something given a parameter. Now
I am writing a thing to output something similar to JSON, from a perl
I can output a locale sensitive time format using strftime('%X') , but this always

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.