Rendering buildings on top of terrain / hiding terrain below

Rendering buildings on top of terrain / hiding terrain below

Requests for features in the spring code.

Moderator: Moderators

Post Reply
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Rendering buildings on top of terrain / hiding terrain below

Post by Master-Athmos »

I just saw a SupCom2 video and there you saw a building "opening" and a lift would bring up a new unit from underground. So would there be a way of making such an effect possible in Spring too by somehow making certain parts / polygons of a terrain invisible?

This method would "simply" make an area below a building "transparent" so you can do whatever you want. Doing it that way probably isn't very clever though as it would cause problems with zoomed out views and certainly some other ones too. Maybe a solution concerning drawing orders might be a way to go. That would need no influence on specific terrain polygons and only has the issue of making sure that the building e.g. doesn't render through a hill or something else in your view. Might this even be within the possibilities of a shader?

Any ideas on this?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Rendering buildings on top of terrain / hiding terrain below

Post by zwzsg »

Right now, you could do that effect by using the ground height altering Lua command to dig a cave under the building.

However, I would have a use for a map tag setting making the above ground terrain not rendred just like voidwater, and it was also inspired by seeing a supcom video. But first I have to release a certain map, then I have to make a remake SupCom's preview's video's map using the same trick. Once done, I would have arguments to show off why a tag to not render any terrain at all would help me making interesting looking map. And only later could we ask to have mean to control precisely which polygon are rendered which aren't.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Rendering buildings on top of terrain / hiding terrain below

Post by smoth »

WAIT WHAT!?!?!
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Rendering buildings on top of terrain / hiding terrain below

Post by Argh »

You may be able to cull the map geometry by using OpenGL, although it may be tricky to get it to win a depth-test with the terrain geometry, yet lose to everything else.

And yeah, I've been waiting for that damn bridge since you showed off the first screenshot awhile ago.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Rendering buildings on top of terrain / hiding terrain below

Post by zwzsg »

Argh wrote:You may be able to cull the map geometry by using OpenGL.
Yeah, I kinda wondered if with Lua's OpenGL we could erase the Depth Buffer or something, which would indeed make both my and Master-Athmos' feature request superfluous.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Rendering buildings on top of terrain / hiding terrain below

Post by Argh »

You can erase the depth buffer bit, but I don't think that will solve your problem.

Basically, you need to cause the same situation that's causing me problems with the GLSL normalmap stuff, where you're rendering something translucent before another object. Try DrawGenesis(), IIRC that's before the map geometry renders. I am quite sure that you can cause the map geometry to not be seen, to put it another way, I'm just not sure how easy it would be to avoid various other borks.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Re: Rendering buildings on top of terrain / hiding terrain below

Post by Gnomre »

zwzsg wrote:Once done, I would have arguments to show off why a tag to not render any terrain at all would help me making interesting looking map

Code: Select all

Spring.SetDrawGround 
 ( boolean drawGround ) -> nil
?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Rendering buildings on top of terrain / hiding terrain below

Post by Kloot »

Probably the building just digs a pit underneath it in the heightmap. Could be done in Spring too with a slight extension to the yardmap concept.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: Rendering buildings on top of terrain / hiding terrain below

Post by Master-Athmos »

Would need reflattening on destruction though so you don't have giant pits you'd need to even out when building something different then...

An advantage of not doing it with hackish terrain deformation would be that you could do much more things than just the factory stuff: From a small tube going underground of an extractor to things like THAT. Especially the later would make a great concept for e.g. solar collectors but in an overall view you could create much more depth with buildings that go below the surrounding ground level. This also might be interesting for many kinds of features on a map...

EDIT:
Or instead of doing ditches by terraforming you could do a great looking model that just is a blocking feature...
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Rendering buildings on top of terrain / hiding terrain below

Post by hoijui »

The advantage of the teraforming is, that if you do THAT(see last post), and it is destroyed, it is more natural to have a qhole in the ground, then just have the terrain pump up to beeing flat. or would you do that on destruction then?
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: Rendering buildings on top of terrain / hiding terrain below

Post by Master-Athmos »

Well let's add something completely new to the terraforming approach:
Would ground units be able to leave the factory after all if you lower the terrain? I guess not (well maybe all-terrain ones but they still should pop down to the terrain height level when being completed)...
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: Rendering buildings on top of terrain / hiding terrain below

Post by zwzsg »

Gnome wrote:

Code: Select all

Spring.SetDrawGround 
 ( boolean drawGround ) -> nil
It already exists? Oh right. Awesome!
Post Reply

Return to “Feature Requests”