Game Development Community

New idea for terrain holes in interiors

by Daniel Buckmaster · in Torque Game Engine · 12/21/2007 (1:20 pm) · 21 replies

There is already an existing feature that terrain will not render inside a portalised interior, correct? So if you stick a house halfway through a hil, you don't have the hillside sloping through your kitchen. The problem is, you still collide with the hill side, correct? That's why you 'set empty', so you don't collide. But then your hole is pretty regularly shaped, and may not line up nicely with the house.
The fundamental problem is colliding with the terrain. So how about just checking each shape - if they're inside an interior, disable terrain collisions. That way you can have tunnels or buildings nicely intersecting terrain without needing tpo tidy up holes, and not be walking into invisible walls all the time.
Worry is that it might be expensive to check whether each and every object is inside all the time. Maybe trigger areas - when you're in a trigger area which denotes proximity to an interior, then you start checking.

About the author

Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!

Page «Previous 1 2
#1
01/07/2008 (1:21 pm)
This has been mentioned several times. Someone just has to take the time to find the code that stops displaying the terrain (in a portalised interior) and change it to stop checking for collisions in that terrain space also. It's a great idea, just I haven't found anyone who has done it yet.
#2
01/08/2008 (6:09 pm)
>>There is already an existing feature that terrain will not render inside a portalised interior, correct?

From what I've seen this feature doesn't work in 1.5.2. The interiors I made do appear to have valid portals, so unless I am missing something the checkbox to enable that functionality does nothing.
#3
01/08/2008 (6:11 pm)
I'm not sure what that feature is intended to do.
it may be rather "terrain will not render when you're in a zone which cannot see outside".

as a test, try it with a room that's just a shoebox w/ no windows.
#4
04/09/2008 (4:48 pm)
The feature works, just stick a interior halfway into the ground. Go inside the interior and you won't be able to see the terrain inside of it.
#5
06/13/2008 (3:17 am)
Really? I was under the impression that it wasn't working, so I abandoned this line of thought. But if it is, it's a relatively more simple matter to stop things colliding with terrain inside interiors.

EDIT: It seems Orion was right. The terrain is not rendered at all when inside an interior. This could be useful, but I'm looking for a way to actually render all the terrain except what's inside the interior.
#6
06/13/2008 (10:34 am)
Bill Vee has written a resource that looks like it would solve you're problem. He used this so hangars could be stuck in the sides of mountains and not render terrain.
#7
06/14/2008 (12:15 pm)
Heh, I just found that this afternoon. It's only for TGEA, though.

I think a fix for this problem should make use of the portal system. I'm no expert, but this is just my train of thought:
The way portals and scene traversal have been explained to me is that when a portal is rendered in the camera view, it renders whatever should be behind it. So, the next section of the interior, or the outside, or whatever. This scene rendered inside the portal is its own mini scene traversal thing.
So instead of turning off the terrain full stop, why not just turn it off for the mini scene traversal when rendering whatever's inside a portal? There's probably an easy answer to this, but from my understanding of the engine, it seems logical. So outside the portal (outside the interior), you get a normal render; inside the portal (in the interior), you can't see the terrain.
Then the reverse should be true when looking out of an interior - the terrain is not rendered in the 'root' scene traversal, the section of the interior that you're inside, but it is rendered when you look through a portal that goes outside.
This could be simplified by having a special type of portal or something...
#8
06/16/2008 (11:59 am)
@Orion
When I try sticking the interior in the ground, it doesn't matter if I can't see outside. As long as I'm in the zone, the terrain that travels through it is not rendered, even if I can see outside.

What if a system was set up where the terrain verticies in the portal? Bill Vee's terrain collision code works (in my engine now), so it would work inside interiors, as long as you are in the interior too.
#9
06/17/2008 (6:58 am)
Quote:What if a system was set up where the terrain verticies in the portal?
What do you mean by that?
#10
06/18/2008 (10:01 am)
Sorry, forgot to type part of the sentence. =P

What I meant to type was:
"What if a system was set up where terrain verticies in the portal were hidden?"

I haven't worked with terrain much (just the terrain deformer resource), and I don't know if that would make the terrain deletion any more accurate.
#11
06/18/2008 (10:37 am)
I did investigate a method to try and change the sort order of the terrain so that the interior would be rendered after the terrain like the sky object.

I gave up on it due to the lack of a decent method to accomplish it , and decided that the shader method was ultimately easier to implement.
#12
06/21/2008 (5:24 am)
Though for shader-less TGE, that solution may just have to be viable. I'm going to look some more into scene traversal.
What were the specific problems you ran into?
#13
06/21/2008 (7:16 am)
What I tried to do was create a mechanism to test and see if the portal was between the camera and the terrain or vice versa and and change the terrain's sort order based off of the results.

I gave up on this approach because it was simple taking up to much time and I already had TGEA so I went a different route.

I did try and dig up some of my code related to this but I couldn't find it.
It was about 2 years and 3 pc's ago.

If I do mange to find anything I will make it available.
I would love to see this done with portals instead of a shader effect.
The shader solution is not best way to go. It is basically a second render pass of the scene and you take a hit on your frame rate.
#14
06/22/2008 (1:10 am)
Okay, I'm probably barking up the wrong tree or simply misinformed.
When a portal is encountered in the scene traversal, doesn't it create its own mini scene-traversal to render whatever's inside it? With some sort of SceneState (or something similar) that tells objects about the traversal when they get called to render? So if a scene traversal is happening inside a portal that's interior, which can be designated by adding something to SceneState or whatever class I'm thinking of, you either don't render terrain, or render it before the interiors. I don't know how you'd do the latter, but I'll look into it. I have a three-week holiday coming up with only my laptop, so I can't continue work with the other programming my game needs; I'll work on figuring this out instead.

Quote:I gave up on this approach because it was simple taking up to much time and I already had TGEA so I went a different route.
Not becaue it's impossible? That's good to know.

Thanks in advance if you do find any old stuff, but don't worry too much about it :)
#15
06/23/2008 (8:11 am)
@Bill Vee
Did you make any changes to TGEA's shaders? If you didn't, I think that I might be able to adapt the Torque Modernization Kit's shaders to do the job. If you did, could you tell me (in simple words, I don't do graphics =P) what you did to make the terrain invisible?
#16
06/23/2008 (9:15 am)
@Nathan Kent - I used a render to texture arrangement so I am not sure if it would work with the Modernization Kit.

The source is available in the Terrain occluding Portal resource.
#17
06/23/2008 (9:34 am)
... Ouch.... This is going to be hard.

Thanks!

Edit-> Reading through the Modernization Kit's docs, I learned that the TMK includes Render to Texture support. This might not be so hard!
#18
06/26/2008 (7:46 pm)
I don't know if this helps but a couple of months ago I noticed a rendering anomaly that might be useful to achieving the effect you want.

If you place a mirror inside a completely portalized interior , when you view the reflection in the mirror from outside the outside of the interior the terrain doesn't render.

Here are a couple of screen shots of the effect using a clean TGE 1.5.2 build using the barebones mission and adding the cottage and a mirror interior and placing the mirror inside the cottage, then view the mirror from outside the cottage.

www.dayofwar.net/images/mirror1.pngwww.dayofwar.net/images/mirror2.pngwww.dayofwar.net/images/mirror3.pngwww.dayofwar.net/images/mirror4.pngwww.dayofwar.net/images/mirror5.png
#19
07/11/2008 (6:48 pm)
Huh, that looks like exactly the effect I want to achieve. What happens if you move the camera so that you can see outside the hut in the reflection?
I played around a little with transform portals (ie, mirrors), but I can't seem to fathom how they work. More research needed, I guess.
#20
07/12/2008 (11:57 am)
Hers a couple of shots with the mirror in the interior showing the refection of inside and outside the interior.
www.dayofwar.net/images/mirror_6.pngwww.dayofwar.net/images/mirror_7.pngwww.dayofwar.net/images/mirror_8.png
This is an image of a mirror outside the interior.
www.dayofwar.net/images/mirror_9.png

It just seems to me if you take a mirrorsubobject and don't reflect the scene but just show a normal non-reflected scene like the portals do and remove the objects collision you would have a "portal" that if it was inside a portalized interior and place just in front of a portal would produce the effect of looking at an interior from the outside and not having the terrain render inside the interior.
Page «Previous 1 2