Game Development Community

PlanarReflection crashes TGEA?

by Dave Calabrese · in Torque Game Engine Advanced · 12/05/2007 (11:22 am) · 11 replies

I'm attempting to use the 'planarReflection' property in Shadergen, and whenever the engine attempts to load an interior with this setting, the engine crashes on the spot. Here's my material datablock:

new Material(ice)
{
   mapTo = "ICEB";
   baseTex[0] = "ICEB.png";
   bumpTex[0] = "ICEB_norm.png";
   diffuse[0] = "0.294118 0.431373 0.560784 1.0";
   specular[0] = "0.301961 0.533333 0.878431 1.0";
   specularPower[0] = 40.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] = true;
};

Any thoughts on why this is occuring?

#1
12/05/2007 (12:10 pm)
Nothing sticks out, I'd have to trace it under debug mode to really figure out the problem myself.
#2
12/05/2007 (12:49 pm)
Dave,

I don't know if there is a better way, but this at least got it to work for me:

new CustomMaterial( ReflectFloor_Concrete )
 {
   mapTo = "floor_concrete_grungycorners";
    texture[0] = "floor_concrete_grungycorners";
   texture[1] = "$backbuff";
  texture[2] = "$lightmap";
   texture[2] = "floor_concrete_grungycorners_reflectbump2";
   shader = Reflect;
   version = 2.0;
   planarReflection = true;
 };
#3
12/05/2007 (2:26 pm)
Unfortunatley, we are only able to use Shadergen for our current project, so anything that it is not capable of we are unable to use (so not CustomMaterials). We've found a decent number of things in Shadergen to not be working correctly... it looks like PlanarReflections is just something to add to that list. =/
#4
12/05/2007 (2:38 pm)
Oh, I see.

Out of curiousity, did you try that material sans "[0]"?
I've run into problems with adding it, sometimes. For example, pixelSpecular[0] = true; gives me a totally different effect than pixelSpecular = true;.
I was wondering if having planarReflection[0] = true; could cause any problems?
#5
12/05/2007 (5:05 pm)
Tried it without the [0], and it still crashes I'm afraid.
#6
12/05/2007 (5:42 pm)
You might try something like planarReflection0 = true; in case the field(s) for that were set up in that fashion rather than with the square brackets.
#7
12/06/2007 (12:06 am)
In scripting planarReflection0 is the same as planarReflection[0]
Its just a different way to access an array.

Might really be that planarReflection, which, at least in form of the mirror entity support in DIF, was added with 1.0.3, is the real problem here and does not interact "nicely" with other effects or does not work at all with normal materials like other well documented material tags (detailTexture which does just nothing and the like)
#8
12/06/2007 (12:11 am)
@Marc, it really depends on the way that the field is set up in the datablock class, I believe. I know that it's possible to set it up so that var0 works but var[0] doesn't (ran into this issue myself just a little bit ago, but that was in a custom class so may be irrelevant).
#9
12/06/2007 (6:42 am)
By any chance is there a list of things that don't work, or don't work as perceived they should, via Materials (Shadergen)?
#10
12/06/2007 (8:48 am)
I really quickly tried this and it looks like there is an issue if all of the surfaces on an interior are reflective. If this happens, then it tries to allocate a 0 length vertex buffer for the non reflective surfaces and dies. Is this what you are trying to do? This could also just be an issue with the codebase I tested it in as well.
#11
12/06/2007 (9:20 am)
Dave, use Ray-traycing with custom material.

use reflect(reflection vector,ray direction vector)

I found that planar(horizontal/vertical..mirrors) reflections does not work well on exteriors using procedural material.