Specular color sum

Started by
3 comments, last by bakery2k1 21 years, 4 months ago
I am attempting to evaluate: (diffuse color + specular color) * texture 0 color per pixel. Is there any way I can do this using the standard TextureStageStates? I am currently using a simple pixel shader:


ps.1.1
tex t0

add r1, v0, v1	//r1=diffuse+specular
mul r0, r1, t0

  
However, enabling specular lighting calculations with d3dDevice->SetRenderState(D3DRS_SPECULARENABLE, true); will add the specular color to the result AFTER the texture stages. Thus I will get (diffuse color + specular color) * texture 0 color + specular Is there any way I can disable the "color sum", yet still have the vertex pipeline calculate the specular color so I can use it in the texture stages? [edited by - bakery2k1 on December 2, 2002 7:31:00 PM]
Advertisement
Use a vertexshader and add it to oD0 instead of oD1.
You add the light. So you are modulating with greate than 255 Color.

I use this Shader
// t0.rgb BaseTexture
// v0 diffuse
// v1 specular

ps.1.1
tex t0
mad_sat r0, t0, v0, v1
You add the light. So you are modulating with greate than 255 Color.

I use this Shader
// t0.rgb BaseTexture
// v0 diffuse
// v1 specular

ps.1.1
tex t0
mad_sat r0, t0, v0, v1
That doesn''t fix his problem.

This topic is closed to new replies.

Advertisement