Ok, point taken on the acid trap. I will now officially refer to it as the toxic trap, and anyone who refers to it as the acid trap in future will be given a serial code which turns their character into a drunk when they buy the game.
Green toxic trap now looks like this:
Interesting things to note about GDK shaders combined with Dark Lights is:
1. The first texture you reference with "texture Texture1 <string Name=""; >;" is actually the texture at texture stage 1. The second texture you reference is the texture at stage 0! UV coords are around the right way. So basically ...
Texture definition 1 = Stage 1 with UV coords in TEXCOORD0
Texture definition 2 = Stage 0 with UV coords in TEXCOORD1
That did my head in for a while.
There also seems to be some shader optimisation which further makes things properly confusing. If you have 4 texture stages, but do not use the third texture (stage 2) in the final colour output in your shader, then the fourth texture (stage 3) falls back into position 2!! Nightmare ...
Here's an example of a pixel shader code path:
float3 baseColor = tex2D(samp2,IN.UV - Distort*0.05);
float3 lightmapColor = tex2D(samp1,IN.LightMapUV);
float3 refractColor = tex2Dproj(samp3,IN.RefrProj);
float3 waveColor = tex2D(samp4,IN.UV);
return float4(baseColor,1);
I'm sampling from 4 textures, but only using baseColor for the final output. This will not work as expected? Why, because by only using baseColor, some sort of internal optimisation is working out I'm only using 1 sampler in the final result. So it ignores textures 2,3,4 and just leave me with texture1, which in this instance is the lightmap!
I can infact change baseColor for any other of those colour samples and it will always draw the light map because it will optimise the shader down to the first sampler only (The lightmap one!).
If I then change the output to:
return float4(baseColor*lightMapColor,1);
This will work, because the internal optimisation strips out unused textures 3 and 4, leaving me with 1 and 2 which are my base and lightmap. However, if I multiply baseColor with waveColor, it will look exactly the same. waveColor, from sampler 4 will be optimised out leaving me with just baseColor and lightmapColor.
Talk about proper head scratching territory.
Edit: @Pincho - If all goes to plan, playing the game the
TOXIC pits will slowly fill up with heads and legs at various stages of
TOXIC death.