Jump to content
  • Advertisement
Sign in to follow this  

semantics and shader

This topic is 2928 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have this structure to fill in the vertex shader and send to the pixel shader.

float4 position : POSITION;
float3 viewDir : TEXCOORD0;
float3 normal : TEXCOORD1;
float4 lightDirKey : TEXCOORD2;
float4 lightDirFill : TEXCOORD3;
float4 lightDirBack : TEXCOORD4;
float4 lightDirBack2: TEXCOORD5;
float3 CameraPos : TEXCOORD6;
float3 CameraNormal : TEXCOORD7;
float4 diffuse : COLOR0;
float4 specular : COLOR1;
float2 UV ;

The problem is that i finish the semantics , how i can send my UV parameter?

Share this post

Link to post
Share on other sites
If you really need all those semantics then the only way to send the UV down is to pack it into the unused components of existing variables.

For example if you made CameraPos and CameraNormal float4 then you could use the 'w' component of both to pack the uv data.

Share this post

Link to post
Share on other sites
He has a Vertex Shader which produces a lot of output. The connection VS -> PS goes through "interpolators" which are exposed as indexed sematics in D3D/HLSL.
In the end, there are only 8+8 of those so once TEXCOORD0-TEXCOORD7 are gone, interpolators will begin to be scarce.

I'd first get the rid of [font="'Courier New"]cameraPos [/font]and [font="'Courier New"]cameraNormal[/font]. The latter in particular is going to be normalized anyway, perhaps doing everything by using PS uniforms won't give much of a problem, furthermore it seems to me it could be redundant with [font="'Courier New"]viewDir[/font]... what are those variables supposed to do?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!