semantics and shader

Started by
2 comments, last by Krohm 12 years, 6 months ago
hello.
I have this structure to fill in the vertex shader and send to the pixel shader.

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 ;
};

The problem is that i finish the semantics , how i can send my UV parameter?
thanks.
Advertisement
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.
I'm unfamiliar with the limit you seem to be reaching...?
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?

Previously "Krohm"

This topic is closed to new replies.

Advertisement