   Why I got error "cannot map expression to pixel shader instruction set"?
  When I wrote like this:float3 combinedNormal;combinedNormal = tex2D(NormalSampler, texCoord);combinedNormal = normalize(2 * combinedNormal - 1);I got error says "cannot map expression to pixel shader instruction set" on the last line. Would you like to tell me what's wrong here?Many Thanks!   
Quote:Original post by PixelShaderWhen I wrote like this:float3 combinedNormal;combinedNormal = tex2D(NormalSampler, texCoord);combinedNormal = normalize(2 * combinedNormal - 1);I got error says "cannot map expression to pixel shader instruction set" on the last line. Would you like to tell me what's wrong here?Many Thanks!I would guess it doesn't understand what 2 * combinedNormal - 1. Subtraction of a scalar from a vector isn't really defined. I don't know what you want, but if it's componentwise subtraction you should:float3 correctedNormal = float3(2.0*combinedNormal.x - 1.0, 2.0*combinedNormal.y - 1.0, 2.0*combinedNormal.z - 1.0);if Cg or HLSL (what you are using) allows explicit construction like that.   ;Which Pixel Shader version are you using ?   ;Quote:I would guess it doesn't understand what 2 * combinedNormal - 1. Subtraction of a scalar from a vector isn't really defined. Nah, HLSL recognizes that statement. It loosely translates into this:float3 Temp;Temp.x = 2*combinedNormal.x-1;Temp.y = 2*comibnedNormal.y-1;Temp.z = 2*combinedNormal.z-1;combinedNormal = normalize(Temp);;Quote:Original post by Cypher19Quote:I would guess it doesn't understand what 2 * combinedNormal - 1. Subtraction of a scalar from a vector isn't really defined. Nah, HLSL recognizes that statement. It loosely translates into this:float3 Temp;Temp.x = 2*combinedNormal.x-1;Temp.y = 2*comibnedNormal.y-1;Temp.z = 2*combinedNormal.z-1;combinedNormal = normalize(Temp);Oh I see! All a big mistake then, thanks for pointing that out, Cypher! :)   ;  I am using ps_1_4.ps_1_4 dosen't support normalize(...)?   ;  No it doesn't. VS 1.1 and PS 2.0 are the minimum.   ;  :-(   ;You can create a cubemap for emulating the vector normalization. It eats one texture sampler though.Try to look for "normalization cubemap" from the web.   ;  A good paper regarding vector normalization is Normalization Heuristics from nVidia. If you decide to do normalization in ps1_4 using normalization cube map I recommend to take a look at that paper.   