Enable Reflections for Material
by Tobias B. · in Torque Game Engine Advanced · 04/08/2009 (6:48 am) · 4 replies
Hi,
I'm trying to make an object reflective. To be more specific, I have a nice car which should reflect the environment just as a real car finish does. As a first step, I tried to modify the material.cs for the car by adding something like
pixelSpecular[1] = true;
specular[1] = "0.5 0.5 0.5 0.5";
specularPower[1] = 32.0;
This didn't change anything - the polygons directly illuminated by the sun are just brighter, the others darker and that's it.
Do I have to specify a shader or something? Is there any special property for the textures or a special texture required?
Thanks a lot for help,
Tobias
I'm trying to make an object reflective. To be more specific, I have a nice car which should reflect the environment just as a real car finish does. As a first step, I tried to modify the material.cs for the car by adding something like
pixelSpecular[1] = true;
specular[1] = "0.5 0.5 0.5 0.5";
specularPower[1] = 32.0;
This didn't change anything - the polygons directly illuminated by the sun are just brighter, the others darker and that's it.
Do I have to specify a shader or something? Is there any special property for the textures or a special texture required?
Thanks a lot for help,
Tobias
#2
04/08/2009 (2:56 pm)
Is the car going to move? By default a dynamic cubemap updates only once (before the first render) and remains the same afterwards. Don't know about 1.8.1, but in 1.7.1 real-time dynamic cubemaps need quite a bunch of changes and fixes in order to work. Also, performance isn't that great.
#3
As Jaimi and Manoel mention a cubemap would reflect the world around you, actually it's a little trickery in a lot of game engines where you just take some images of the scene and it uses them rather than actually reflecting the scene..so as Manoel mentions the reflection is static and won't change if you're driving the car around.
04/09/2009 (3:33 am)
@Tobias - the values you've specified are for a specular highlight which just controls how shiny the material is, i.e. metal is really shiny and plastics less so... it doesn't actually reflect the scene.As Jaimi and Manoel mention a cubemap would reflect the world around you, actually it's a little trickery in a lot of game engines where you just take some images of the scene and it uses them rather than actually reflecting the scene..so as Manoel mentions the reflection is static and won't change if you're driving the car around.
#4
So what is the point about these cubemaps? As far as I got it is a render technique to create reflections - am I right so far?
As the car moves along the road, I expect the reflections to be updated - for the price of high computational effort, which is clear. But doesn't the term "dynamic" imply that it's updated for every frame? Or do you mean that this was buggy in 1.7.1?
The doc says "Dynamic cubemaps are updated frequently for very realistic reflections" - does this work, or is this the bug?
To bring it all together - the sequence
pixelSpecular[1] = true;
specular[1] = "0.5 0.5 0.5 0.5";
specularPower[1] = 32.0;
dynamicCubemap[1] = true;
should do it? Or is something missing? In the Barricade demo I found something like
texture[0] = "~/data/interiors/planar_d";
texture[2] = "~/data/interiors/planar_n";
shader = ReflectBump;
version = 2.0;
mapTo = "PLANAR";
planarReflection = true;
specular[0] = "1 1 1 1";
specularPower[0] = 64.0;
Do I need parts of this stuff?
Thanks again,
Tobias
04/09/2009 (4:36 am)
Thanks everyone for your appreciated help.So what is the point about these cubemaps? As far as I got it is a render technique to create reflections - am I right so far?
As the car moves along the road, I expect the reflections to be updated - for the price of high computational effort, which is clear. But doesn't the term "dynamic" imply that it's updated for every frame? Or do you mean that this was buggy in 1.7.1?
The doc says "Dynamic cubemaps are updated frequently for very realistic reflections" - does this work, or is this the bug?
To bring it all together - the sequence
pixelSpecular[1] = true;
specular[1] = "0.5 0.5 0.5 0.5";
specularPower[1] = 32.0;
dynamicCubemap[1] = true;
should do it? Or is something missing? In the Barricade demo I found something like
texture[0] = "~/data/interiors/planar_d";
texture[2] = "~/data/interiors/planar_n";
shader = ReflectBump;
version = 2.0;
mapTo = "PLANAR";
planarReflection = true;
specular[0] = "1 1 1 1";
specularPower[0] = 64.0;
Do I need parts of this stuff?
Thanks again,
Tobias
Associate Jaimi McEntire
King of Flapjacks