Original Post
Well, I Currently have my terrain engine working well and I''ve think of a way to put some objects on the terrain, such as roads, trees, ect.
For this, I wanna use a bitmap in witch, for example, roads are painted in red, trees in greeen ect...
Now, as I use a Pixel shader written in HLSL for my terrain blending operations, I wanna know how can I do this.
I don''t know why this piece of code don''t work in HLSL
//Items on the map float4 fItems = tex2D (SamplerItems, Tex); //Grass texture loat4 Grass = tex2D(SamplerGrass,Tex); //Rock texture float4 Rock = tex2D(SamplerRock,Tex); //earth texture float4 Mud = tex2D(SamplerMud, Tex); //Snow texture float4 Snow = tex2D(SamplerSnow, Tex); float4 red; red.r = 1.0f; red.g = 0.0f; red.b = 0.0f; red.a = 0.0f; //I wanna return the rock color where my infos bitmap is painted in red if ( red==fItems ) return Rock; float4 BlendingWeights = tex2D(SamplerBlending, Tex); //Blending factors encoded in a texture float a = BlendingWeights.a; float b = BlendingWeights.r; float c = BlendingWeights.g; float d = BlendingWeights.b; return (a * Snow) + (d*Grass) + (c * Mud) + (b*Rock);Well it seems to be logical this way but the compiler do not accpept the line "if ( red == fItems ) return Rock; Thanx for your help!