Since you are bouncing rays of the model into a cubemap, presumably oriented with the world axes, the trick is to orient your model’s normals, light to vertex vector, and eye to vertex vector in the same space. = mul( TangentMatrix, ModelViewIT.xyz ) įloat4 NormalTex = tex2D( NormalMap, IN.TexCoord0 ) * 2.0 - 1.0 įloat3 EyeVector = float3( IN.TexCoord1.w, IN.TexCoord2.w, IN.TexCoord3.w ) įloat3 Normal = float3( dot( IN.TexCoord1.xyz, NormalTex.xyz ),ĭot( IN.TexCoord3.xyz, NormalTex.xyz ) ) įloat3 CubeTex = texCUBE( CubeMap, reflect( -EyeVector, Normal ) ) Īnother way to approach this problem is from the model’s perspective. = mul( TangentMatrix, ModelViewIT.xyz ) OUT.Position = mul( ModelViewProj, IN.Position ) įloat4 WSPosition = mul( ModelView, IN.Position ) Hi, i’ve done a reflective bump mapping demo but i think there’s something wrong in the code because if i move around the reflective object it reflects always rhe same part of enviroment.
0 Comments
Leave a Reply. |