Archived

This topic is now archived and is closed to further replies.

Baltz

pixel shader 1.3 limitation problem

Recommended Posts

Baltz    122
hi when i output from a vertex shader a Light Direction and a vertex normal as TEXCOORD the pixel shader receives those vectors clamped in the 0-1 range how do get those vectors on a pixel shader without being clamped? i am trying to convert the code below which uses a ps.1.4 to ps.1.3, shader below was written by Wolfgang F. Engel struct VS_OUTPUT { float4 Pos : POSITION; // type variable : semantics float3 Light : TEXCOORD0; float3 Norm : TEXCOORD1; }; VS_OUTPUT VS(float4 Pos : POSITION, float3 Normal : NORMAL) { VS_OUTPUT Out = (VS_OUTPUT)0; Out.Pos = mul(Pos, matWorldViewProj); // transform Position Out.Light = normalize(vecLightDir); // output light vector Out.Norm = normalize(mul(Normal, matWorld)); // transform Normal return Out; } float4 PS(float3 Light: TEXCOORD0, float3 Norm : TEXCOORD1) : COLOR { // constant = variable without semantic float4 diffuse = { 1.0f, 0.0f, 0.0f, 1.0f}; float4 ambient = {0.1, 0.0, 0.0, 1.0}; return ambient + diffuse * saturate(dot(Light, Norm)); // clamps to 0..1 }

Share this post


Link to post
Share on other sites