   [HLSL] Blending RGBA channels?
  Hi,I'm porting my shaders to HLSL. Now, I'm completely confused how to convert one single line of my pixelshader:dp3 r1, t1, t2;// Detail channels x Blendmap This will turn my image into:The blendmap texture has three channels (RGB) and will DP3 this with the detail texture, which also contains three layers (you can see two types of detail layers in above texture)How do I convert this to HLSL?I've tried a lot of things:float4 blend1;blend1.x =  blendtex * detailtex.x;blend1.y =  blendtex * detailtex.y;blend1.z =  blendtex * detailtex.z;blend1.w =  blendtex * detailtex.w;float4 result;result = lerp(blendtex, detailtex, detailtex);blend1.x = dot(blendtex, detailtex);blend1.y = dot(blendtex, detailtex);blend1.z = dot(blendtex, detailtex);blend1.w = dot(blendtex, detailtex);everytime I get to see all the pretty red, green and blue colors from the blendmap (mixed with the detail map). But I want a greyscale image.What am I doing wrong? :)   
  Something like:float r1 = dot( t1.rgb, t2.rgb ); Should be functionally the same as your ASM (replace r1/t1/t2 as appropriate). The dot() operation varies depending on what the input's size is - by specifying .rgb you should be forcing a dp3 rather than a dp4. Best to check the assembly output to be sure though.I would imagine that your non-greyscale output is probably from something you're doing elsewhere rather than that single instruction.hthJack   ;  Jack,You're still priceless in this world, even when you went from VB to C++ (or C#?) :) :).It works perfect. I would never have thought of this, especially because of the "float" instead of "float4".Many, many thanks :)   ;Quote:Original post by ajolingYou're still priceless in this world, even when you went from VB to C++ (or C#?) :) :).Thanks [grin]It was straight to C++ for me - apart from a brief look I've not had time to get into C# properly.Jack   