Game Development Community

Marble reflectivity within torque 3d

by john lomax · in Artist Corner · 03/24/2010 (1:01 am) · 7 replies

Does anyone have any ideas on how to go about creating reflective values such as the ones that marble floor tiles receive within torque 3ds material editor ? I am attaching an image of what I am reffering to but basiclly i want to have the marble look as if it is reflecting light and also bending it like marble does.any sort of help would be amazing and much appreciated.i44.photobucket.com/albums/f29/slipmaggot75/20071201113043_w.jpg



#1
03/24/2010 (8:23 am)
You could use a planar reflection, dynamic cubemap or a regular cubemap to do just this, it really depends on how much you want to throw at the problem in the way of resources.
#2
03/24/2010 (10:22 am)
would you possibly be able to walk me through going about doing that ? I am familiar with cube maps but have never actually made one before :/
#3
03/25/2010 (8:31 am)
Sorry about the delay, got caught up with work and family stuff so I couldn't respond.

Its actually pretty easy for the most part to set this kind of stuff up.

The easiest one to setup is a Planar Reflection (note I am uncertain if this is still active in Torque3D but it works in TGEA).

A planar reflection is basicly like a big mirror and reflects everything real-time. With that said however its a big mirror so you will only ever want to use 1 of these at a time to keep the system performing speedy as well as prefenting the dreaded Hall of Mirrors effect (you will mostly see this in a lot of spiffy video card demos of small environments and not usually in an actual game).

Add the following line to your marble floor datablock in the material.cs for the file...

planarReflection = 1;

As for something that you would actually want to use in real-game productions, you would resort to a CubeMap (or a cubemap derivative).

A cubemap works by having 6 images that represent the world. Usually this is something that has been pre-rendered and best suits your game environment. How the cubemap reflections will work is that the brighter the pixel value is, the more it will show up on the surface of the object. You can also control the strength of this amount via per-pixel data in the alpha channel of the diffuse texture.

There are a bunch of cubemap examples that ship with TGEA and T3D so I will let you decide to test with the file that you want to work with. What you do need to find however is the datablock name of the cubemap that has been assigned and then add the following variable to the marble floor datablock in the material.cs.

cubemap = "yourCubeMapDataBlockName";

Note: There are a whole bunch of cubemap varieties you can try out which will give you different results and performance increases or decreases, so play around and use what you think will work best. They all work a bit different between TGEA and T3D (with T3D being more effecient).

I hope that helps you with how to assign a reflective look to the floor. Just remember that with games you never really get anything perfect, its just smoke & mirrors to simulate.
#4
03/25/2010 (11:34 am)
Hey Logan !

Thanks for the in depth definitions on everything that was EXTREMELY helpful. I have a couple of quick follow up questions though. Does my texture that I am using to have a reflective value need a alpha channel along with it ? Because when I do try out one of the cube maps to get some form of reflective values I currently do not get any reflectivity at all :( Thank you again for taking the time to explain this I really do appreciate it.
#5
03/25/2010 (11:50 am)
actually i just got the examples to work, they are not exactly what I am looking for though haha. If I have a environment currently how would you go about creating a cube map out of the existing pieces you have in your environment. For example, If I have stained glass windows at the top of my environment with pillars and all sorts of stuff and i want to create a cube map to have those sort of reflections influence the marble floor they are on top how would you go about getting the pics for the pieces and putting it together as a cube map ?
#6
03/25/2010 (1:33 pm)
@John

If no alpha channel exists then the engine will assume all values are white or 100% reflective.

With regards to creating cubemap images. I usually will do this in my 3D program since it gives me greater control over the camera and rotation. In your case you could look into a dynamic cubemap if you cannot bring in your scene into a 3D app.

dynamicCubemap = 1;
#7
03/25/2010 (2:01 pm)
does the dynamic cubemap only work in tgea or does it also work in t3d ?