Shoreline Effects ...
by Melv May · in Torque Game Engine · 04/03/2002 (1:12 pm) · 29 replies
Alright,
I'm gonna put my hand in the air and see if anyone else knows this.
Shoreline textures are mentioned in the 'Features' section for Torque www.garagegames.com/index.php?sec=mg&mod=v12&page=features but I can't find them anywhere in the engine so I decided to give it a go myself.
I've been partially successful with this and I have a working version I've been playing with. The problem I am getting is that the fluid code is not exactly hi-res when it's checking for terrain intersections. The blocks sizes are quite large, even when the scale of the waterBlock is reduced.
I was wondering from Mark/Tim or anyone, how shoreline textures were implemented.
So everyone knows how the waterBlock currently works ...
Each waterBlock has an instance of the Fluid class which is used to compose the fluid surface. This is achieved by using a QuadTree to decompose the surface area until it has nodes that only partially intersect the terrain. These nodes are then turned into blocks which are decomposed further into triangles according to an LOD algorithm that chooses the best way at the current viewing distance. These triangles finally make their way to a setupVerts function which adds them to a list to make up the final surface.
What I decided to try was to intercept the setupVerts function and check the vertices as they come in. I have a reference to the terrainblock so that I can quickly do a calculation based on the vertexZ to the terrainZ at that point to give me a depth value. I can then choose to do anything I desire with value.
I decided to make an extra pass on the water with a shoreline texture. I render this using a colour/alpha map that I compose in setupVerts using a simple linear algorithm to choose an alpha value based upon the depth. Next to the shoreline you get the texture but as the depth increases it disappears.
I suppose the problem I have is that the decomposition of the surfaced is not very hi-resolution and I was wondering if there would be a better way to do it without changing the LOD.
Here's an example of my latest shoreline work (coloured coded so that you can see the areas, blue is deep water and cyan is shallows)
www.objectheaven.dial.pipex.com/garagegames/shoreline.jpg
Anyone?
I'm gonna put my hand in the air and see if anyone else knows this.
Shoreline textures are mentioned in the 'Features' section for Torque www.garagegames.com/index.php?sec=mg&mod=v12&page=features but I can't find them anywhere in the engine so I decided to give it a go myself.
I've been partially successful with this and I have a working version I've been playing with. The problem I am getting is that the fluid code is not exactly hi-res when it's checking for terrain intersections. The blocks sizes are quite large, even when the scale of the waterBlock is reduced.
I was wondering from Mark/Tim or anyone, how shoreline textures were implemented.
So everyone knows how the waterBlock currently works ...
Each waterBlock has an instance of the Fluid class which is used to compose the fluid surface. This is achieved by using a QuadTree to decompose the surface area until it has nodes that only partially intersect the terrain. These nodes are then turned into blocks which are decomposed further into triangles according to an LOD algorithm that chooses the best way at the current viewing distance. These triangles finally make their way to a setupVerts function which adds them to a list to make up the final surface.
What I decided to try was to intercept the setupVerts function and check the vertices as they come in. I have a reference to the terrainblock so that I can quickly do a calculation based on the vertexZ to the terrainZ at that point to give me a depth value. I can then choose to do anything I desire with value.
I decided to make an extra pass on the water with a shoreline texture. I render this using a colour/alpha map that I compose in setupVerts using a simple linear algorithm to choose an alpha value based upon the depth. Next to the shoreline you get the texture but as the depth increases it disappears.
I suppose the problem I have is that the decomposition of the surfaced is not very hi-resolution and I was wondering if there would be a better way to do it without changing the LOD.
Here's an example of my latest shoreline work (coloured coded so that you can see the areas, blue is deep water and cyan is shallows)
www.objectheaven.dial.pipex.com/garagegames/shoreline.jpg
Anyone?
About the author
#2
04/03/2002 (4:40 pm)
BTW -that's very neat, and certainly useful, what you've done there so far !
#4
04/03/2002 (11:55 pm)
um maybe. I do that now. There's an issue there I can't remember. Ask me in the morning :-)
#5
Looks good.
Thanks for all of your work on this.
Is GG rolling your updates into the TGE?
David
04/04/2002 (10:44 am)
Hi Melv,Looks good.
Thanks for all of your work on this.
Is GG rolling your updates into the TGE?
David
#6
Is there any procedure for this, apart from writing decent code?
I would certainly be interested in contributing directly to the codebase rather than adding features adhoc as I am doing at the moment.
04/04/2002 (10:49 am)
Nope!Is there any procedure for this, apart from writing decent code?
I would certainly be interested in contributing directly to the codebase rather than adding features adhoc as I am doing at the moment.
#7
How about the edge of the water itself? Any ideas there? I've always thought that it gave a surreal look to the whole thing, in contrast with how beautiful the rest of the water looks. It looks kinda like a drop of mercury sitting in a cup or something. =) It should probably have some sort of frothing to it.
04/04/2002 (10:58 am)
None I'm aware of, Melv. By the way, these enhancements you're making are great!How about the edge of the water itself? Any ideas there? I've always thought that it gave a surreal look to the whole thing, in contrast with how beautiful the rest of the water looks. It looks kinda like a drop of mercury sitting in a cup or something. =) It should probably have some sort of frothing to it.
#8
The way the WaterBlocks work means that they simply get clipped by the terrain surface. This, coupled with the pixel alias, looks poor.
Not sure what else we can do here. Particles look good but you would need a severe LOD algo on it otherwise performance would drop considerably.
Another thing is to calculate the terrain face intersections and render 'wash' directly onto the face above the waterline. Again, could be costly and probably not really worth it to gameplay.
I would be interested though how shorelines were done in Tribes2. I can only find a single texture in T2 that was named 'shortline_modulated.png' which is a fairly dull turbulent grey texture.
04/04/2002 (11:23 am)
Yeah,The way the WaterBlocks work means that they simply get clipped by the terrain surface. This, coupled with the pixel alias, looks poor.
Not sure what else we can do here. Particles look good but you would need a severe LOD algo on it otherwise performance would drop considerably.
Another thing is to calculate the terrain face intersections and render 'wash' directly onto the face above the waterline. Again, could be costly and probably not really worth it to gameplay.
I would be interested though how shorelines were done in Tribes2. I can only find a single texture in T2 that was named 'shortline_modulated.png' which is a fairly dull turbulent grey texture.
#9
I cant quite remember the exact details sadly, but it generated a noise alpha map which blended between opaque and translucent. As the water reached the edge of the land, the translucency increased but because of the noise it wasnt completely linear.
The trouble here, is that the landscape texture isnt really possible to blend completely, and the resolution of the water triangulation depends on where the quadtree intersects the land.
Ideally, what you'd want to do, is generate a best fit water texture that corresponded to the outline of the water and land. Use that as the translucency value of the water, introduce a noise map at the extremities so the outline of the land is broken a bit.
Here's a thought.
Render to texture the water as it intersects with the land (only the "depth" value of the water into an 8 bit alpha image). Use this to modulate the water texture so that it appears less translucent in the center. Apply a reflection map on top. Use the reflection map as a caustic map to modulate the terrain texture underneath (almost as the terrain lighting underwater?).
Dunno how it would look of course. But kinda sounds fairly reasonable.
Nice work anyway Melv.
Phil.
04/04/2002 (11:47 am)
Best shoreline effect Ive seen was in a tech demo for Xbox.I cant quite remember the exact details sadly, but it generated a noise alpha map which blended between opaque and translucent. As the water reached the edge of the land, the translucency increased but because of the noise it wasnt completely linear.
The trouble here, is that the landscape texture isnt really possible to blend completely, and the resolution of the water triangulation depends on where the quadtree intersects the land.
Ideally, what you'd want to do, is generate a best fit water texture that corresponded to the outline of the water and land. Use that as the translucency value of the water, introduce a noise map at the extremities so the outline of the land is broken a bit.
Here's a thought.
Render to texture the water as it intersects with the land (only the "depth" value of the water into an 8 bit alpha image). Use this to modulate the water texture so that it appears less translucent in the center. Apply a reflection map on top. Use the reflection map as a caustic map to modulate the terrain texture underneath (almost as the terrain lighting underwater?).
Dunno how it would look of course. But kinda sounds fairly reasonable.
Nice work anyway Melv.
Phil.
#10
On a pertinent note, has anyone established a kind of realistic minimum spec for graphics performance that the engine needs?
I would suggest the kind of power a geForce2MX or above would provide although with the advent of geForce4 technologies, geForce3 card prices will be tumbling.
I've got a geForce4/3 & a 2 on my laptop. I try to ensure good performance on all although a variety of chipsets would be better.
04/04/2002 (11:56 am)
Interesting.On a pertinent note, has anyone established a kind of realistic minimum spec for graphics performance that the engine needs?
I would suggest the kind of power a geForce2MX or above would provide although with the advent of geForce4 technologies, geForce3 card prices will be tumbling.
I've got a geForce4/3 & a 2 on my laptop. I try to ensure good performance on all although a variety of chipsets would be better.
#11
What it needs is a "thickness" to it, near the edges it should be more transparent and in the middle more opaque.
Kinda like a water fog, I was going to try a fog layer under water and water opactiy of like .05 or so, so the water looks almost invisible near the edges.
T2 water has glow in the dark edges, not cool for realism, reflection maps dont really help either.
04/05/2002 (7:12 pm)
no shorelines in T2.What it needs is a "thickness" to it, near the edges it should be more transparent and in the middle more opaque.
Kinda like a water fog, I was going to try a fog layer under water and water opactiy of like .05 or so, so the water looks almost invisible near the edges.
T2 water has glow in the dark edges, not cool for realism, reflection maps dont really help either.
#12
04/05/2002 (10:03 pm)
oh, you can place textures at set heights in the terrain editor easily ,so if you set the water level to a certain height and make the sand appear at that height and lwer etc you get the effect you want without having to hand paint the whole lot.
#13
04/06/2002 (10:46 am)
I know this sin't releated as such, but what about a boat leaving a trail, is it possible to do some kinda of texture or maybe a particle effect, as a boat goes through water it leaves disturbed water behind, i know fs2002 uses a texture, of this a some particles on top as if water is being sprayed upwards, is this possible!
#14
At the moment the surface simply uses a fixed modulation function to fake waves, there is no height map as such. If you wanted to texture the surface then you would need control over mapping your specified texture at a certain point over the surface.
Realisitically, you would probably simply use particles that trail your surface vehicle.
That isn't to say how it might be in the future.
04/06/2002 (11:01 am)
I suppose the method used would very much depend on how the waterblocks end up.At the moment the surface simply uses a fixed modulation function to fake waves, there is no height map as such. If you wanted to texture the surface then you would need control over mapping your specified texture at a certain point over the surface.
Realisitically, you would probably simply use particles that trail your surface vehicle.
That isn't to say how it might be in the future.
#15
Phil.
04/06/2002 (11:08 am)
Best to just blend a "trail" effect in another pass in the wake of the vehicle.Phil.
#16
Not impossible but it wasn't designed with this in mind.
04/06/2002 (11:49 am)
The problem being with that is that the height data is not easy to come by in it's current format.Not impossible but it wasn't designed with this in mind.
#17
I dont even use the waves, I think that water in such a small body doesn't have waves, even big lakes and such are usually still.
I just want the edges of the water less "obvious" without having the water clear all the way to the bottom.
04/06/2002 (8:17 pm)
i'm pretty sure a particle effect could be created with that v shape, i have done stuff that like a few times by mistake and it should work well.I dont even use the waves, I think that water in such a small body doesn't have waves, even big lakes and such are usually still.
I just want the edges of the water less "obvious" without having the water clear all the way to the bottom.
#18
Particles would be my first choice though. Again, horses for courses.
04/07/2002 (1:19 am)
Still water with a turbulent textured surface can obviously be textured onto or you could add a 'wake' extension to the waterblocks, pretty much like the decal-manager, to manage wakes.Particles would be my first choice though. Again, horses for courses.
#19
www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=2489
04/07/2002 (3:30 am)
some toughts on waves (check Tim Gift's reply):www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=2489
#20
I've been thinking about implimenting fluid/gas-currents (as in winds and tides). It would tie into the fluid rendering code Melv is working on a lot, and I wanted to see if anyone else was working on something similar.
I was sort of thinking along the lines of water textures moving with wind and bump maps moving with the current. Or maybe a simple algroithm to combine the two in an interesting manner. And trees and plants with movable foliage to flutter in the breeze. The new graphics cards do some really cool things with hair and cloth via morphing, and it'd be nice to take advantage. In a few years, all the graphics cards will be expected to do such things, and therefore so will the games.
Anyway, I probably won't be able to work on it until summer, if no one else is working on it.
-Will
04/09/2002 (3:26 am)
Hi all,I've been thinking about implimenting fluid/gas-currents (as in winds and tides). It would tie into the fluid rendering code Melv is working on a lot, and I wanted to see if anyone else was working on something similar.
I was sort of thinking along the lines of water textures moving with wind and bump maps moving with the current. Or maybe a simple algroithm to combine the two in an interesting manner. And trees and plants with movable foliage to flutter in the breeze. The new graphics cards do some really cool things with hair and cloth via morphing, and it'd be nice to take advantage. In a few years, all the graphics cards will be expected to do such things, and therefore so will the games.
Anyway, I probably won't be able to work on it until summer, if no one else is working on it.
-Will
Torque Owner Ken Finney
Tubetti World