Game Development Community

Reflective materials in T2D?

by Christopher Gulliver · in Torque Game Builder · 03/29/2006 (7:44 am) · 9 replies

Is it possible to make a materials/datablocks or even .dts reflective in T2D? I have a game peice that I would like to make reflective, or semi-translucent (think glass), and I wasn't sure if this was possible in T2D.

Thank you in advance.

#1
03/29/2006 (8:13 am)
Translucent is easy enough to do by using .png and utilizing their alpha layer. Basically you'd make the image of the "window", probably with several layers, and then adjust their transparency down until you get the desired amount of see-through.

You could then just display that sprite in the front of your scene, and objects behind it should be visible.

This is the same type of effect that the fish demo uses, as well as a lot of the particle effects. Simply variable alpha values (heck, I'm pretty sure you can even take pretty much any sprite and adjust its overall alpha value as well in script).

As for the reflection part, I've no idea...
#2
03/29/2006 (8:19 am)
You will have to create and manage two layers for reflection as it is not a "normal" feature in most 2D egnines. One layer would be the "actual" layer and the second being the "reflective layer". Reverse the axis on the layer's display and update any movement accordingly.

I haven't done this. I was just trying to think it out loud.
#3
03/29/2006 (8:37 am)
Thank you for the quick responses. I was thinking more along the lines of environment mapping to a piece. For example; if I had a flat surface in the distance, and I moved a sprite in front of it, if the flat surface could reflect that sprite on it, to give a polished effect. Is something like this possible within the engine?
#4
03/29/2006 (5:43 pm)
I don't think that would be possible without using shaders, which the engine does not currently support.
#5
03/29/2006 (6:40 pm)
Thank you Joe, I was afraid of that.
#6
03/29/2006 (8:22 pm)
It's easy to do a reflection, just create a copy of the object, invert it, and draw with 80% transparency.

granted, this wont solve all problems, but I think it'll be a good 90% solution.
#7
03/30/2006 (3:17 am)
For reflections you don't need shaders btw. You only need a cubemap with the correct setup. As TGB has only 1 camera angle, this won't create problems with "perspective errors" on the reflection. With render to texture or even backbuffer copy to the cubemap sides, you are able to get the reflection then.
#8
03/30/2006 (3:59 am)
@Marc: I havent played with 3d shapes, but does what you are saying apply to TGB? (T2D)
#9
03/30/2006 (4:23 am)
I fear not, you would need to implement it or merge with TGE. Especially reflection with "true reflection" would only work with other 3D shapes but not with sprites (if they aren't looking at the reflective object).

I'm atm thinking about sprite reflection as well as I got the strange idea of having Iso with reflection ... ;-)