mirrorSubobjects
by Desmond Fletcher · in Torque Game Engine · 11/24/2001 (6:15 pm) · 88 replies
I have not been able to get the mirrorSurface entity to work properly: when I place the mirrorSurface entity exactly on the surface to be a mirror, it always is the NULL texture (pink) when fully mirrored. If the surface texture has an alpha channel, the pink shows through that texture. So, looking at the mirrorSubobject code, I found this segment where it appears that the texture has been assigned NULL then is reassigned special/whiteAlpha0 (which is not in the common folder.
if (getInstance()->isClientObject() && mWhite == NULL)
mWhite = new TextureHandle "special/whiteAlpha0", MeshTexture);
So, I created my own alpha0 texture, created the common/special folder and replaced the above with:
mWhite = new TextureHandle("special/mirrorAlpha0", MeshTexture);
Still no change; then, while looking into the TextureHandle code saw that there is an InteriorTexture also. Well, I'm not trying to reflect the environmental image off a model so I replaced MeshTexture with InteriorTexture (why is MeshTexture there to begin with?):
mWhite = new TextureHandle("special/mirrorAlpha0", InteriorTexture);
Still no luck and no difference. Maybe I'm not looking in quite the right place; maybe the placement of the mirrorSurface entity is wrong; maybe, maybe, maybe--can anyone suggest a new direction to look?
if (getInstance()->isClientObject() && mWhite == NULL)
mWhite = new TextureHandle "special/whiteAlpha0", MeshTexture);
So, I created my own alpha0 texture, created the common/special folder and replaced the above with:
mWhite = new TextureHandle("special/mirrorAlpha0", MeshTexture);
Still no change; then, while looking into the TextureHandle code saw that there is an InteriorTexture also. Well, I'm not trying to reflect the environmental image off a model so I replaced MeshTexture with InteriorTexture (why is MeshTexture there to begin with?):
mWhite = new TextureHandle("special/mirrorAlpha0", InteriorTexture);
Still no luck and no difference. Maybe I'm not looking in quite the right place; maybe the placement of the mirrorSurface entity is wrong; maybe, maybe, maybe--can anyone suggest a new direction to look?
#2
1. I created a /common/special folder and put a custom texture there "mirrorAlpha0.png" which is 8 x 8 and uses black for the alpha mask. (I also placed the png in the interiors folder for the test map; it's the texture on the brush surface).
2. Then I modified mirrorSubobject.cc in the
MirrorSubObject::setupTransforms() function
to be:
mWhite = new TextureHandle("common/special/mirrorAlpha0", MeshTexture);
instead of:
//df mWhite = new TextureHandle("special/whiteAlpha0", MeshTexture);
What I get is the reflection of the environment (sky, clouds, and terrain) but no interior objects. Also, there are some artifacts at the horizon and a green triangle that can be seen in the screenshots.
Need to look some more!
11/25/2001 (8:43 pm)
Some progress!1. I created a /common/special folder and put a custom texture there "mirrorAlpha0.png" which is 8 x 8 and uses black for the alpha mask. (I also placed the png in the interiors folder for the test map; it's the texture on the brush surface).
2. Then I modified mirrorSubobject.cc in the
MirrorSubObject::setupTransforms() function
to be:
mWhite = new TextureHandle("common/special/mirrorAlpha0", MeshTexture);
instead of:
//df mWhite = new TextureHandle("special/whiteAlpha0", MeshTexture);
What I get is the reflection of the environment (sky, clouds, and terrain) but no interior objects. Also, there are some artifacts at the horizon and a green triangle that can be seen in the screenshots.
Need to look some more!
#3
11/26/2001 (8:44 am)
Getting closer :)
#4
//df from mirrorSubobject.h
Render control. A sub-object should return false from renderDetailDependant if it exists only at the level-0 detail level, ie, doors, elevators, etc., true if should only render at the interiors detail, ie, translucencies.
The mirrorSubobject is set to true meaning it should only render at the interiors detail?
bool MirrorSubObject::renderDetailDependant() const
{
return true;
}
What is the difference between interiors detail and level 0 detail?
Can someone also explain the concept of zones with respect to detail levels and interior details?
12/01/2001 (8:43 am)
Can someone explain the implications of this://df from mirrorSubobject.h
Render control. A sub-object should return false from renderDetailDependant if it exists only at the level-0 detail level, ie, doors, elevators, etc., true if should only render at the interiors detail, ie, translucencies.
The mirrorSubobject is set to true meaning it should only render at the interiors detail?
bool MirrorSubObject::renderDetailDependant() const
{
return true;
}
What is the difference between interiors detail and level 0 detail?
Can someone also explain the concept of zones with respect to detail levels and interior details?
#5
I think the "level-0 detail" vs. "interiors detail" comment is just referring to the fact that sub-objects are normally constructed on the highest detail ("level 0 detail"), but some may be attached to a specific detail level (the "interior's detail").
Zones represent visible areas of an interior, zones are linked by portals, and I believe zone 0 is the exterior (could be wrong on that). Since the geometry of an interior can be different on different detail levels, it seems like the zones would be different as well.
12/01/2001 (10:52 am)
Interiors can have multiple detail levels and sub-objects attached to it. The sub-objects were originally used for doors, elevators, mirrors and force fields, though support for the first two was removed at some point. I'm not all that familiar with that part of the code, but it seems like sub-objects can be attached to a detail level or not. If they are (renderDetailDependant returns true), then they only render when that interior detail is rendered. Sub-objects which return false in renderDetailDependant are always rendered regardless of the current detail level. Looks like mirrors render only with the detail level in which they were constructed.I think the "level-0 detail" vs. "interiors detail" comment is just referring to the fact that sub-objects are normally constructed on the highest detail ("level 0 detail"), but some may be attached to a specific detail level (the "interior's detail").
Zones represent visible areas of an interior, zones are linked by portals, and I believe zone 0 is the exterior (could be wrong on that). Since the geometry of an interior can be different on different detail levels, it seems like the zones would be different as well.
#7
01/03/2002 (6:11 pm)
Not yet :(
#8
01/04/2002 (8:47 am)
I've heard that John Folliard, Brian Ramage, et al. (X-Tribes2 guys) have the mirror object working (as well as some other fixes). We're trying to get them to submit their changes to GarageGames...
#9
01/04/2002 (7:51 pm)
EXCELLENT :)
#10
01/16/2002 (10:03 am)
are there any new developements with mirrors?
#11
01/17/2002 (3:11 pm)
Tim? Did you follow up with Brian et.al. on their code?
#12
01/17/2002 (3:23 pm)
Sorry, this is my bad. I've discussed it with the other GG guys several times and we're all gung ho on integrating the fixes, but we seem to keep fogetting to actually talk to John and his team! We just had another GG meeting today and the topic came up again... I'll email John right now and see if we can set up a meeting.
#13
01/18/2002 (12:45 pm)
Thx Tim, I hope to use mirrors throughout our game
#14
I have been trying a bit of a hack to get a reflective surface in a dif and haven't been too happy with the results. Using some code modifications in another thread and Desmond's transparency/translucency tutorial I have created a translucent surface, and then made a copy of the map, inverted it and placed the inverted copy below the original. It kind of works, but the code changes cause the terrain to wash out at a very near distance, and within the dif object, the outside edges reflect the terrain and sky, rather than the interior map.
Edit. Perhaps 'reflect the terrain and sky' wasn't the correct phrasing. Actually, I haven't tried enabling any mirroring at all. Everything right now is based on translucency/transparency and a flipped copy of the map. But the washout that affects the terrain also affects the map, resulting in washing out the edges of the map and allowing the outside world to show through the translucent texture. Not sure if that makes any sense. But again, if we can get true mirroring working, it will be a moot point anyway.
03/15/2002 (9:03 pm)
Out of curiosity, has anything happened recently on the mirror code front?I have been trying a bit of a hack to get a reflective surface in a dif and haven't been too happy with the results. Using some code modifications in another thread and Desmond's transparency/translucency tutorial I have created a translucent surface, and then made a copy of the map, inverted it and placed the inverted copy below the original. It kind of works, but the code changes cause the terrain to wash out at a very near distance, and within the dif object, the outside edges reflect the terrain and sky, rather than the interior map.
Edit. Perhaps 'reflect the terrain and sky' wasn't the correct phrasing. Actually, I haven't tried enabling any mirroring at all. Everything right now is based on translucency/transparency and a flipped copy of the map. But the washout that affects the terrain also affects the map, resulting in washing out the edges of the map and allowing the outside world to show through the translucent texture. Not sure if that makes any sense. But again, if we can get true mirroring working, it will be a moot point anyway.
#15
P.S. Tim, Can you send me John's email?--I need to talk with him about some other areas as well.
03/15/2002 (9:19 pm)
Currently the mirrors only reflect the terrain and environment. I moved my attention to other areas since Tim said John possibly had the fix. P.S. Tim, Can you send me John's email?--I need to talk with him about some other areas as well.
#16
03/16/2002 (11:37 am)
John Folliard does have the mirrors working, but he said his version of the code is a little hacked up and he doesn't want to submit it in it's current state. His emails is in his' profile... I'm sure he'd be willing to talk about what he did to fix it.
#18
I'm looking at this code now as it will give me insights into portal reflections for my other projects.
Desmond, can you explain to me the format of the bitmap you used and how it was assigned to the DIF?
- Melv.
05/21/2002 (2:46 pm)
Hi guys,I'm looking at this code now as it will give me insights into portal reflections for my other projects.
Desmond, can you explain to me the format of the bitmap you used and how it was assigned to the DIF?
- Melv.
#19
Desmond is not around :)
So I will take the liberty with what I have,
I dont know the format but i've borrowed the whiteAlpha0.png from my Tribes 2 textures zip.
using that and placing it in :
common/special/whiteAlpha0.png
Like Desmond said.
This is used in :
void MirrorSubObject::setupTransforms()
(heh hacker declared too!)
and applies to all mirror objects.
Edit:
Opps I also edited the path in that function like Desmond show's above.
05/21/2002 (3:01 pm)
Melv:Desmond is not around :)
So I will take the liberty with what I have,
I dont know the format but i've borrowed the whiteAlpha0.png from my Tribes 2 textures zip.
using that and placing it in :
common/special/whiteAlpha0.png
Like Desmond said.
This is used in :
void MirrorSubObject::setupTransforms()
(heh hacker declared too!)
and applies to all mirror objects.
Edit:
Opps I also edited the path in that function like Desmond show's above.
#20
I created a /special directory under /example/common and put this texture in it:
holodeck.st.usm.edu/vrcomputing/vrc_t/misc/mirrorAlpha0.png
Then added the reference to it in:
05/21/2002 (4:52 pm)
well, I am around :)I created a /special directory under /example/common and put this texture in it:
holodeck.st.usm.edu/vrcomputing/vrc_t/misc/mirrorAlpha0.png
Then added the reference to it in:
void MirrorSubObject::setupTransforms()
{
mInitialized = true;
// This is really bad, but it's just about the only good place for this...
if (getInstance()->isClientObject() && mWhite == NULL)
//df mWhite = new TextureHandle("special/whiteAlpha0", MeshTexture);
// mWhite = new TextureHandle("common/special/mirrorAlpha0", InteriorTexture);
mWhite = new TextureHandle("common/special/mirrorAlpha0", MeshTexture);
...Currently, it only reflects the sky and terrain, no interior objects.
Torque Owner Tim Gift