Rendering buildings on top of terrain / hiding terrain below
Moderator: Moderators
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Rendering buildings on top of terrain / hiding terrain below
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?
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?
Re: Rendering buildings on top of terrain / hiding terrain below
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.
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.
Re: Rendering buildings on top of terrain / hiding terrain below
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.
And yeah, I've been waiting for that damn bridge since you showed off the first screenshot awhile ago.
Re: Rendering buildings on top of terrain / hiding terrain below
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.Argh wrote:You may be able to cull the map geometry by using OpenGL.
Re: Rendering buildings on top of terrain / hiding terrain below
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.
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.
Re: Rendering buildings on top of terrain / hiding terrain below
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
Re: Rendering buildings on top of terrain / hiding terrain below
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.
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Rendering buildings on top of terrain / hiding terrain below
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...
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...
Re: Rendering buildings on top of terrain / hiding terrain below
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?
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Rendering buildings on top of terrain / hiding terrain below
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)...
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)...
Re: Rendering buildings on top of terrain / hiding terrain below
It already exists? Oh right. Awesome!Gnome wrote:Code: Select all
Spring.SetDrawGround ( boolean drawGround ) -> nil