Page 1 of 1

tunnels

PostPosted: 05 Jun 2013, 12:46
by rubberduck
new idea: real tunnels by using road-segments (not caves by using stones)

i don't know, how easy it is to implement

Re: tunnels

PostPosted: 05 Jun 2013, 14:39
by CryHam
Yeah, that's the problem, it's Impossible to do.
So far I know Ogre's terrain can't have holes.
Hmm. Even if we could do holes with discard pixel in terrain's shader, I don't know if it's possible to do holes in bullet heightmap.
It's not, but could use triangle mesh instead of heightmap.
Still it's freaking difficult (not easy) because of making the entrances fit the triangles of collision, road and dealing with an idea how to send this also to shaders.

Re: tunnels

PostPosted: 05 Jun 2013, 14:46
by rubberduck
what is "discard pixel in terrain's shader"
it is like a "material", where you can drive through??? and full invisible, no interaction with objects and particles...

Re: tunnels

PostPosted: 05 Jun 2013, 15:15
by CryHam
discard in fragmet/pixel shader doesn't draw the pixel on screen. i forgot what is it called in gl.

Re: tunnels

PostPosted: 05 Jun 2013, 15:33
by Julius
Well, one could carve in the terrain and add a mesh cover on top. Many shallow tunnels are done that way anyways, and especially those half open tunnels one can often find in mountainious areas (to protect againt falling rocks and the like), would make a really nice addition to Stunt-Rally.
One would just need to make a set of sufficiently modular "tunnel cover" models for it (given that you can paint the "carvings" into the the terrain hightmap).

Re: tunnels

PostPosted: 05 Jun 2013, 15:38
by rubberduck
the idea is good, but when you want that a second road crosses the moutain, you must use a small "bridge" over it(road in the air)

Re: tunnels

PostPosted: 09 Jun 2013, 23:43
by Tapio
Julius {l Wrote}:Well, one could carve in the terrain and add a mesh cover on top.

Nice idea.
Julius {l Wrote}:One would just need to make a set of sufficiently modular "tunnel cover" models for it (given that you can paint the "carvings" into the the terrain hightmap).

SR already procedurally generates the road from a spline. Should not be an unreasonable task to generate the cover also. I see two phases:

  • Create tunnel interior walls (easy, just generate some upside down U-shape over the spline just like e.g. bridge walls)
  • Patch the terrain. This is harder, but could take advantage of the original terrain: the tunnel would be placed inside an uncarved mountain in the editor, and then the required carving is calculated from the spline and the original terrain points over the road spline are used for generating a static cover mesh.

There might be some stitching issues, but I'd imagine they would be worse with pre-made meshes and can be covered up with e.g. vegetation, rocks.

Re: tunnels

PostPosted: 10 Jun 2013, 18:23
by rubberduck
i don't know if it is possible to "deform" the segments with the road like in blender with array- and curve modifier

length(=stretched or not) of the tunnel-segments could be done with the length of the road-segments in editor

also bridges like http://www.blendswap.com/blends/view/23226 or http://www.blendswap.com/blends/view/19211 could be done like this

Re: tunnels

PostPosted: 10 Jun 2013, 19:58
by CryHam
Well everything is possible. I guess it maybe wouldn't be that bad if we just made a big, broad entrance mesh (to deal with bullet terrain triangles).
Anyway, either way, this requires dealing with the most complicated code in game (made by me) which creates road mesh (Road_Rebuild.cpp), I don't think it can be written simpler, it is just complicated, and I don't burst in happiness about extending it even further :twisted:.
But I am for doing it in there, like all road creating was meant to be, it has many parameters for each spline point, has LOD, merge length, etc.
I made an issue for it code.google.com/p/vdrift-ogre/issues/detail?id=248, but like with all issues below Medium priority, I'm not going to touch it anytime soon.