Holes in the terrain
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
Holes in the terrain
Hi !
Is there a default approach to making "holes" into the the heightfield based terrain to connect it to some underground dungeon, created as a normal mesh or static geometry?
I guess using portals would be a good way, but portals don't seam to be ready for use, according to this thread http://www.ogre3d.org/phpBB2/viewtopic. ... 58&start=0 .
So are there other ways to do it?
-
Marc
Is there a default approach to making "holes" into the the heightfield based terrain to connect it to some underground dungeon, created as a normal mesh or static geometry?
I guess using portals would be a good way, but portals don't seam to be ready for use, according to this thread http://www.ogre3d.org/phpBB2/viewtopic. ... 58&start=0 .
So are there other ways to do it?
-
Marc
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
-
- OGRE Retired Moderator
- Posts: 2060
- Joined: Thu Feb 26, 2004 12:11 am
- Location: Toronto, Canada
- x 3
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
to zbuffer-writing:Falagard wrote:Portals would be the best approach for this, but another possible trick is to write geometry to the depth buffer but not to the colour buffer where you want to "cut" the whole, prior to rendering the terrain. Then render the terrain and it won't render where the hole geometry was rendered.
Falagard
I thought of this zbuffer-writing way. But is it possible to doe that by defining just special materials? Or do I have to call some lower-rendering-methods myself?
E.g. if I just put an additional object in the scene with a material that writes zbuffer values somehow and ignores testing against the current zbuffer values. Then how can I be sure that this object, the underground dungeon and the terrain get drawn in the right order so that it looks right?
to portals: s. Chasters thread
-
- OGRE Retired Team Member
- Posts: 2543
- Joined: Fri Oct 24, 2003 2:53 am
- Location: San Diego, Ca
- x 2
I am working on a portal scene manager of my own, and have thought about this... I also thought of rendering an invisible quad to the depth buffer to make holes in terrains (for use of a portal)... I figured that, you would have to draw the underground first, then the invisible quad, than the terrain... You'llhave to ensure that the objects get drawn in the right order, which probably requires that they have different renderque priorities.
One drawback though, is overdraw... Since the terrain has not been drawn yet,there is no clipping performed on the underground, and then the terrain will just get drawn over parts that should not have been visible. In my case, I will use the portals edges to affect clipping, so there will not be lots of overdraw.
Though, I have not tested this yet as I have been working on other things so far.
One drawback though, is overdraw... Since the terrain has not been drawn yet,there is no clipping performed on the underground, and then the terrain will just get drawn over parts that should not have been visible. In my case, I will use the portals edges to affect clipping, so there will not be lots of overdraw.
Though, I have not tested this yet as I have been working on other things so far.
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
Alternatively you can hack the scene manager to leave holes in the terrain by modifying the index buffers. The holes would probably have to be the same size as the quads at lowest LOD for simplicity. This is probably a more complicated solution than the z-buffer approach. I think this is how they made holes in the terrain in e.g. FarCry.
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
[quote="pjcast"]I am working on a portal scene manager of my own, and have thought about this... I also thought of rendering an invisible quad to the depth buffer to make holes in terrains (for use of a portal)... I figured that, you would have to draw the underground first, then the invisible quad, than the terrain... You'llhave to ensure that the objects get drawn in the right order, which probably requires that they have different renderque priorities.
[/quota]
That only works correctly if you look from the terrain inside the underground. But if you look from the underground outside, you get wrong results. I guess you have to switch renderqueue priorities depending on where you are then.
@DWORD: Are you sure? I don't know, but I always thought they use portals in FarCry. They need them anyway to connect their different scenetypes efficiently. To your hole cutting method: Don't you get problems when the quad that you don't draw gets further away and together with the surrounding quads gets rendered in a lower LOD level? Then you would have to ignore that larger quad completely, what is obviously wrong, or you can draw it, closing the hole, what is also wrong. Or do I miss something?
[/quota]
That only works correctly if you look from the terrain inside the underground. But if you look from the underground outside, you get wrong results. I guess you have to switch renderqueue priorities depending on where you are then.
@DWORD: Are you sure? I don't know, but I always thought they use portals in FarCry. They need them anyway to connect their different scenetypes efficiently. To your hole cutting method: Don't you get problems when the quad that you don't draw gets further away and together with the surrounding quads gets rendered in a lower LOD level? Then you would have to ignore that larger quad completely, what is obviously wrong, or you can draw it, closing the hole, what is also wrong. Or do I miss something?
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
I'm quite sure this is how they make their holes in the terrain, but I don't know for sure either. Ofcourse they probably also use portals for the 'entrance' through the cut holes, and for their interiors. I just noticed that in their map editor, you could use a tool that removed/restored quads of the terrain by clicking. Then in their levels they placed some entities on those holes that covered the ugly edge and made a smooth transisition to interior.Marc wrote:@DWORD: Are you sure? I don't know, but I always thought they use portals in FarCry. They need them anyway to connect their different scenetypes efficiently.
That's why I wrote "the same size as the quads at lowest LOD".Marc wrote:To your hole cutting method: Don't you get problems when the quad that you don't draw gets further away and together with the surrounding quads gets rendered in a lower LOD level? Then you would have to ignore that larger quad completely, what is obviously wrong, or you can draw it, closing the hole, what is also wrong. Or do I miss something?

Edit: But yeah, depending on the number of mipmap levels, the quads can get quite large, so this may not be optimal. Maybe some middle course would do the trick; when things are far enough to use lowest LOD, it probably doesn't make significant visible difference whether you render the terrain at the hole or not. I don't have FarCry installed right now, so I can't check how they do it unfortunately.
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
-
- OGRE Retired Team Member
- Posts: 2543
- Joined: Fri Oct 24, 2003 2:53 am
- Location: San Diego, Ca
- x 2
Nope... If you look from under the terrain, the terrain is not drawn because of backfacing triangles... and in my case, with portals, it is the reverse of what happened before... The destination sector would be drawn first, than the current sector, in this case would be terrain, then whatever type of sector I'm inMarc wrote: That only works correctly if you look from the terrain inside the underground. But if you look from the underground outside, you get wrong results. I guess you have to switch renderqueue priorities depending on where you are then.

Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
Yep, it's not very noticeable when far away. A simple way to overcome artifacts (visible errors?) would be to have a lower LOD version of the entrance too where the hole was capped, maybe with some texture looking like the interior, or not rendering the entrance at all. Then it wouldn't be necessary to render the interior.
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
But this only holds if you have some special subset of all possible terrains. It could be possible that you look from inside your underground-dungeon, through the entrance onto some mountain. This mountain has to be drawn and does not get rejected because of backface culling.pjcast wrote:Nope... If you look from under the terrain, the terrain is not drawn because of backfacing triangles... and in my case, with portals, it is the reverse of what happened before... The destination sector would be drawn first, than the current sector, in this case would be terrain, then whatever type of sector I'm in
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
But that way, they can't have large entrances right? Only some of the size of the smallest Quad. Did they really limit themselves that way? Can you remove 2 or more neighbouring quads in the editor to make larger entrances? What happens then if you switch the lod level? Does the bigger entrance disappear too even though the cheating gets clearly visible?DWORD wrote:Yep, it's not very noticeable when far away. A simple way to overcome artifacts (visible errors?) would be to have a lower LOD version of the entrance too where the hole was capped, maybe with some texture looking like the interior, or not rendering the entrance at all. Then it wouldn't be necessary to render the interior.
-
- OGRE Retired Team Member
- Posts: 2543
- Joined: Fri Oct 24, 2003 2:53 am
- Location: San Diego, Ca
- x 2
I'm sorry, but I'm not following you logic...Marc wrote:But this only holds if you have some special subset of all possible terrains. It could be possible that you look from inside your underground-dungeon, through the entrance onto some mountain. This mountain has to be drawn and does not get rejected because of backface culling.pjcast wrote:Nope... If you look from under the terrain, the terrain is not drawn because of backfacing triangles... and in my case, with portals, it is the reverse of what happened before... The destination sector would be drawn first, than the current sector, in this case would be terrain, then whatever type of sector I'm in
If I understand what you are saying... you have a mountain underground?... that has a portal that is looking out into the terrain... it would be terrain (destination), invisble portal, than current sector (mountain and underground).
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
Marc is sitting in his underground dungeon looking at a mountain outside.
((That mountain is of course part of the terrain))

((That mountain is of course part of the terrain))
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
-
- OGRE Retired Team Member
- Posts: 2543
- Joined: Fri Oct 24, 2003 2:53 am
- Location: San Diego, Ca
- x 2
If that is the case... it still works... it's not a matter of rendering something, than portal, than terrain... It is a matter of rendering the destination, the portal, then the current sector.. Regardless of whether or not terrain is even involved.jacmoe wrote:Marc is sitting in his underground dungeon looking at a mountain outside.![]()
((That mountain is of course part of the terrain))
So, in this example: outside terrain - including mountains... than the portal, than the current underground sector... I don't see how there is a problem.
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
Ah ok, that's what I meant with "I guess you have to switch renderqueue priorities depending on where you are then.".pjcast wrote:If that is the case... it still works... it's not a matter of rendering something, than portal, than terrain... It is a matter of rendering the destination, the portal, then the current sector.. Regardless of whether or not terrain is even involved.jacmoe wrote:Marc is sitting in his underground dungeon looking at a mountain outside.![]()
((That mountain is of course part of the terrain))
So, in this example: outside terrain - including mountains... than the portal, than the current underground sector... I don't see how there is a problem.
-
- Gremlin
- Posts: 182
- Joined: Tue Jan 25, 2005 7:56 am
- Location: Germany
... that can be downloaded here http://www.ogre3d.org/modules.php?op=mo ... 57ae08a338sinbad wrote:I think you'd be best just to poke some solid geometry through it and slap a portal on the front (or a little way down the hollow section). You'd need a SceneManager that can handle portals of course...
Do you know more details about Chasters code? I posted to his thread but noone reacts. Do you have some, at least semi working code of it? Do you still think adding a general portal concept that primarily allows for mirrors and such effects is the best way or just writing some custom portal scene manager (and then some custom scene managers that can handle several rendering algorithms itself and also connects them by itself through selfdefined portals)?