This is my first running version of per-pixel diffuse lighting with texture blending.
The texture ops are:
As you can see I'm just currently doing additive texture blending, but it looks great. The per-pixel lighting is sooooo much better than per-vertex.Code:float4 PS(float3 Light : TEXCOORD0,float3 Norm : TEXCOORD1, float2 TerrainUV : TEXCOORD2,float2 DetailUV : TEXCOORD3) : COLOR { //ambient float4 A={0.1,0.1,0.1,0.1}; //vDic=intensity * color vector TerrainColor=tex2D(Terrain,TerrainUV); vector DetailColor=tex2D(Detail,DetailUV); vector MixColor=(TerrainColor+DetailColor); return A*MixColor+vDic * saturate(dot(Light,Norm)); }
Now that I've got it working and understand a lot more about pixel and vertex shaders, look out for some razzle dazzle effects.



LinkBack URL
About LinkBacks



Also I read that the ambient light should be 10%-40% of diffuse light. Are you doing that? I'd like to see some of this. Thanks Looks good