Game Development Community

Refractshape

by Teromous · in Torque Game Engine Advanced · 09/16/2008 (2:29 pm) · 1 replies

I'm using the refractshape shader from the barricade demo. I can get it to work in my game, using the refractshape.dts but when I change the shader to use my own .dts it won't work. Here's the original code:

new CustomMaterial( BlobSurface2Fallback )
{
   texture[0] = "$backbuff";
   texture[1] = "~/data/shapes/refractShape/cyanBlueGrad";
   shader = BlobRefractVert1_1;
   version = 1.1;
   refract = true;
};

new CustomMaterial( BlobSurface2 )
{
   mapTo = blobtex2;
   texture[0] = "$backbuff";
   texture[1] = "~/data/shapes/refractShape/cyanBlueGrad";
   texture[2] = "~/data/shapes/refractShape/refractTest2";
   shader = BlobRefractPix;
   version = 2.0;
   refract = true;

   specular[0] = "0.85 0.85 0.85 0.85";
   specularPower[0] = 16.0;

   fallback = BlobSurface2Fallback;
};

Here's the code that I'm using:

new CustomMaterial( CrystalFallback )
{
   texture[0] = "$backbuff";
   texture[1] = "~/data/shapes/Crystals/cyanBlueGrad";
   shader = BlobRefractVert1_1;
   version = 1.1;
   refract = true;
};

new Material(Crystal)
{
   mapTo = Crystal;
   texture[0] = "$backbuff";
   texture[1] = "~/data/shapes/Crystals/cyanBlueGrad";
   texture[2] = "~/data/shapes/Crystals/refractTest2";
   shader = BlobRefractPix;
   version = 2.0;
   refract = true;

   specular[0] = "0.85 0.85 0.85 0.85";
   specularPower[0] = 16.0;

   fallback = CrystalFallback;

};

I noticed that nothing showed up when the mission would start, so I tried changing

mapTo = Crystal;
To:
mapTo = "Crystal.png";

...and the texture I assigned to the .dts would show up, but there was still no refraction and the blue gradient and wavy textures were not present.

#1
09/16/2008 (7:11 pm)
new Material(Crystal)

changed to:

new CustomMaterial(Crystal)

...solved all of my problems. Geez...can't believe that I missed this.