Original Post
Hi there, I'm scratching my head for two days now as I've got some problems using a normalizing cube map in my app. This is whatI do: -simple diffuse per pixel lighting in tangent space LxN -normal is fixed in tangent space to (0,0,1) for testing -L is renormalized by a cube map (resolution 128) -basis vectors a set up correctly I thing, I used meshmender, normals and uv coordinates are correct I wrote the shader in FXComposer where it worked as it should. The Problems start when I try to use it in my own app. There is some strange banding that moves when the model ratates (not in the same direction as the rotation).
I noticed that this disappears when I do not renormalize L in the pixel shader with my cube map. The renormalizing cube map shouldn't be incorrectly created as I used the same in FX Composer without this ugly banding with the same shader. This is the pixel shader:
I noticed that this disappears when I do not renormalize L in the pixel shader with my cube map. The renormalizing cube map shouldn't be incorrectly created as I used the same in FX Composer without this ugly banding with the same shader. This is the pixel shader:
ps_1_3
def c0, 0,0,1,0
tex t0
tex t2
dp3_sat r0, c0, t2_bx2
This is the vertex shader:
struct vertexInput {
float4 position : POSITION;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
struct VSOUT_sm11_pass0 {
float4 hPosition : POSITION;
float3 light : TEXCOORD2;
};
VSOUT_sm11_pass0 SM11_VS_pass0( vertexInput IN,
uniform float3 L)
{
VSOUT_sm11_pass0 OUT;
OUT.hPosition = mul( float4(IN.position) , worldViewProj);
float3x3 mObjToTangentSpace;
mObjToTangentSpace[0]=-IN.binormal;
mObjToTangentSpace[1]=-IN.tangent;
mObjToTangentSpace[2]=IN.normal;
L=(mul( mObjToTangentSpace, L));
OUT.light=L;
return OUT;
}
When I didn't use the cube map I did 0.5*L+0.5 in the vertex shader and used "texcoord t2" instead of "tex t2" in the pixel shader. Any suggestions what could be the reason for the banding are welcome. Thanks, Markus