Environment map: how to get it?
by Alberto Ganesh Barbati · in Torque Game Engine · 05/17/2006 (1:16 pm) · 4 replies
Hi Everybody,
this is probably stupid, but it's really driving me crazy: how do you enable environment map on a shape object?
According to the GPGT book, it should as simple as setting the flag "emap" to true in the datablock and ensure that $pref::environmentMaps is not false. In fact, by looking at the code, I found another requirement: either the object is not translucent or it shall have a reflection map. In the former case the reflection is modulated by the alpha channel of the diffuse texture, in the latter case the reflection map is used. Alas, all that is not sufficient yet! If I use a nontranslucent material, no envmap is shown at all. If I make it translucent and add a reflection map then only the envmap is shown and it not blended with the diffuse texture.
I think I read somewhere that I also have to set something in the Sky object, but there no field in the Sky object that looks like it is explicitly related to the envmap. Moreover, the fact that I see (although incorrectly) the envmap when I have a reflection map makes me think the Sky is set up correctly.
What is it that I'm missing?
Thanks in advance.
this is probably stupid, but it's really driving me crazy: how do you enable environment map on a shape object?
According to the GPGT book, it should as simple as setting the flag "emap" to true in the datablock and ensure that $pref::environmentMaps is not false. In fact, by looking at the code, I found another requirement: either the object is not translucent or it shall have a reflection map. In the former case the reflection is modulated by the alpha channel of the diffuse texture, in the latter case the reflection map is used. Alas, all that is not sufficient yet! If I use a nontranslucent material, no envmap is shown at all. If I make it translucent and add a reflection map then only the envmap is shown and it not blended with the diffuse texture.
I think I read somewhere that I also have to set something in the Sky object, but there no field in the Sky object that looks like it is explicitly related to the envmap. Moreover, the fact that I see (although incorrectly) the envmap when I have a reflection map makes me think the Sky is set up correctly.
What is it that I'm missing?
Thanks in advance.
#2
05/18/2006 (12:43 am)
Thanks Bruno, but I use Blender, not Max, so unMessDts does not help. Anyway, the envmap should be seen even without a reflection map, as long as the object is not translucent, right?
#3
05/18/2006 (4:51 am)
I don't think so. The envmap is generated based on the reflection map and and the sky's 7th bitmap. It's not really an envmap cause it doesn't reflect other objects.
#4
05/18/2006 (1:12 pm)
I am pretty sure that a reflectance map is not necessary (or at least there was deliberate intent to make it so). That's what I understand from following comment lines in file tsShapeInstance.h:ENVIRONMENT_MAP_MULTI_1, ///< render with multi-texturing (+1 texture units), shape alpha = reflectance map
ENVIRONMENT_MAP_MULTI_3, ///< render with multi-texturing (+3 texture units), reflectance map separate textureIn fact, I debugged and I can confirm that if you enable envmap over a non-translucent material without a separate reflectance map, Torque tries to use the alpha channel of the diffuse texture as the reflectance map. Unfortunately, there must be something else I didn't do, because it doesn't work as expected.
Torque Owner Bruno Grieco