Jump to content
  • Advertisement


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


pixel shader 1.3 limitation problem

This topic is 5530 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

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

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!