Sign in to follow this  
giugio

semantics and shader

Recommended Posts

hello.
I have this structure to fill in the vertex shader and send to the pixel shader.
[code]
struct VS_OUTPUT_POINT
{
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 ;
};
[/code]
The problem is that i finish the semantics , how i can send my UV parameter?
thanks.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this