Game Development Community

Each Shadergen Level Scrolls a Different Direction - broken?

by Dave Calabrese · in Torque Game Engine Advanced · 02/18/2008 (4:54 pm) · 3 replies

I am attempting to create a planet shader, where the cloud layer would scroll a different direction from the base layer. However, it scrolls the same direction as the base layer despite what I do. But if I separate it out into its own material, it then scrolls the direction I want it to. Is this a bug or am I doing something wrong? Here's my code:

new Material(planetdiffuse_shaderGen)
{
   mapTo = "planetdiffuse";
   baseTex[0] = "planetdiffuse_shaderGen.png";
   bumpTex[0] = "planetnormals_Shadergen.png";
   diffuse[0] = "1.0 1.0 1.0 1.0";
   specular[0] = "0.0470588 0.243137 0.482353 1.0";
   specularPower[0] = 10.0;
   pixelSpecular[0] = true;
   exposure[0] = 0;
   glow[0] = false;
   emissive[0] = false;
   castShadow[0] = false;
   breakable[0] = false;
   doubleSided[0] = false;
   translucent[0] = false;
   translucentBlendOp[0] = None;
   translucentZWrite[0] = false;
   dynamicCubemap[0] = false;
   planarReflection[0] = false;
   scrollDir[0] = "-0.2 0.0";
   scrollSpeed[0] = 0.03;
   animFlags[0] = $scroll;
   
   baseTex[1] = "planetClouds_shaderGen.png";
   diffuse[1] = "1.0 1.0 1.0 1.0";
   specular[1] = "1.0 1.0 1.0 1.0";
   specularPower[1] = 0.0;
   pixelSpecular[1] = false;
   exposure[1] = 0;
   glow[1] = false;
   emissive[1] = false;
   castShadow[1] = false;
   breakable[1] = false;
   doubleSided[1] = false;
   translucent[1] = true;
   translucentBlendOp[1] = LerpAlpha;
   translucentZWrite[1] = true;
   dynamicCubemap[1] = false;
   planarReflection[1] = false;
   scrollDir[1] = "0.2 0.0";
   scrollSpeed[1] = 0.4;
   animFlags[1] = $scroll;
};

Thanks in advance!
-Dave C.
21-6 Productions

#1
02/22/2008 (9:12 am)
It should be a bug, i think.
I also think better use the Custommaterial, but it's another decision, nothing your problem about.


void MatInstance::setTextureTransforms()
{

   U32 i=0; // may be here is the problem

   ...
   
   F32 waveOffset = getWaveOffset( i ); // gets only the first offset
   ...
}
#2
02/22/2008 (9:21 am)
I posted something like this in the bugs section a while back.
I am not certain my solution was the best but it did fix the problem I was having and I got the desired effect.
#3
02/28/2008 (11:17 am)
I used Mr. Vee's fix and have not had any issues arise.