Game Development Community

Shorelines....

by Melv May · in Torque Game Engine · 06/29/2002 (7:56 pm) · 59 replies

Hi,

I managed to get some time this weekend to go back to some previous work with the fluid rendering code.

I have been trying various techniques to get a better shoreline from the code. The way the existing fluid intersects the terrain is crude (looks like mercury in a cup someone on the forums once said) so I have attacked that problem.

What I've produced is an alpha map for the surface textures based upon height from the terrain. I found that the alpha function for shallow shorelines was completely different from the steep-shores and so I eventually came up with a nice 'sigmoid' function which allows me to control the slope with one simple parameter.

The other problem is that the terrain height-map is low-res and the waterblock mesh is dynamic according to the LOD. This leads to really coarse depth calls at undetermined locations. I got around this by simply convolving the alpha-map through a few interations. Note that the standard terrain lightmap looks much better after a similar interative convolution.

Here are some examples of the alpha-map in action. Note that I'm not texturing here as it distracts from the fade itself.

Shoreline#1
Shoreline#2

The second image clearly shows the alpha falling-off as the depth increases.

Another property I have managed to get working is that I encode the per-pixel terrain normal (again, convoluted) to produce a DOT3 texture with alpha (RGBA). Using this information it is possible to do all sorts of stuff like have a directional shoreline texture for shore-wash.

The first use though will be to simply fade in the standard surface textures into the shoreline to remove the hard-edge and then I will attempt to incorporate the shore-wash textures.

This method though will need multi-texturing as the alpha-map will be modulated against the surface. A single surface will need two TMU's for a single-pass. To do both surfaces four TMU's will be needed for a single-pass or two for a double-pass.

The next step for me though is to parametise the code I have got, package it up and submit it. Hopefully, this should only take a few more days.

- Melv.
Page«First 1 2 3 Next»
#41
07/15/2002 (2:47 pm)
How does this look Melv?
OpenGL driver information:
  Vendor: NVIDIA Corporation
  Renderer: GeForce2 GTS/AGP/SSE
  Version: 1.3.1
OpenGL Init: Enabled Extensions
  ARB_multitexture (Max Texture Units: 2)
  EXT_paletted_texture
  EXT_compiled_vertex_array
  NV_vertex_array_range
  EXT_texture_env_combine
  EXT_packed_pixels
  EXT_fog_coord
  ARB_texture_compression
  EXT_texture_compression_s3tc
  (ARB|EXT)_texture_env_add
  EXT_texture_filter_anisotropic (Max anisotropy: 2.000000)
  WGL_EXT_swap_control
OpenGL Init: Disabled Extensions
  3DFX_texture_compression_FXT1
  NPatch tessellation
#42
07/15/2002 (7:55 pm)
Desmond, yes, it should work for you since that log is telling you that you do have 2 multitexture texture units.

ARB_multitexture (Max Texture Units: 2)
#43
07/15/2002 (10:47 pm)
Yep,

That's definately fine Desmond.

I've done some work on it this weekend to sort out the small waterblocks plus the "terrain squaresize=4" cases.

Unfortunately I got distracted by a leaking toilet which needed some emergency plumbing ... grrrrrrr.

- Melv.
#44
07/16/2002 (5:29 am)
All that fluid rendering finally smoked the toilet?
That sucks. My water heater sprang a leak a couple months ago. A bunch of stuff got wet >:/ Hope that didn't happen to you.
#45
07/16/2002 (6:34 am)
Yeah.

It's a new house so it didn't cost me a penny as it's the builders' fault but I've still got a downstairs loo that's got a waterstained carpet.

I've got a professional carpet cleaner coming later this week to sort it (at no cost to me) so I'm not that bothered. If that doesn't sort it then I'll have a new carpet thank you very much (at no cost to me).

Mmmmmmmm, no cost to me. 8)

- Melv.

p.s. no cost to me!
#46
07/16/2002 (7:20 am)
With all that practical experience you are currently developing in your relationship with your toilet, I expect we will soon see gravity- and pressure-induced fluid flow dynamics enhancements to Torque, no ?

;-)
#47
07/16/2002 (7:26 am)
Ken,

I was thinking of adding a leak into the waterblocks such that it floods interiors when you least expect it. Perhaps when you are playing late at night?

Or maybe I should create a bleachblock class that you can attach to the waterblock so that it really makes a mess of the interiors when they leak.

8)

- Melv.
#48
07/16/2002 (7:36 am)
Melv,
Any luck yet with the shallow parts of the terrain where it's very clear?
Also, I'm very new to Torque and was curious if there's a way to make the water only fade so much from the edge but so the texture is still more visible. Thanks in advance.

-Tony
-johnnyfuzz@aol.com
#49
07/19/2002 (5:21 am)
So have you got that flood interiors and bleachblock stuff working yet? ;)
#50
07/19/2002 (5:45 am)
I'm finally back on it tonight! I've been busy with other stuff and I've had some downtime on my PC due to me upgrading the hard-disks. Got 240Gb Raid now ... yum!

I've got a full weekend to do development so I should be able to finish this thing up.

Promise guys. 8)

- Melv.

eXoDus - Sorry I've not had chance to reply to your emails, I will get 'round to it this weekend. ;)
#51
07/19/2002 (5:53 am)
John,

Just saw your question, sorry I've not responded!

You should be able to control the 'fade' effect from the shore as it stands although I know it's not that intuitive at the moment.

You can change it with the "DepthGradient" field. You can set a minimum level of transparency with "MinAlpha" so that you don't get totally transparent shorelines. The most important is the "MinDepth" & "MaxDepth" which align the "MinAlpha" & "MaxAlpha" settings respectively. If you increase the "MinDepth" gradually, you should see the fade effect moving away from the shore.

This was only a sampler anyway and is by no means a fully working resource, I thought it would give you nice people a taste of what I'm trying to achieve.

I've got some major improvements on the way soon so bear with me. ;)

- Melv.
#52
07/19/2002 (6:17 am)
I think everyone knows it will be well worth the wait :)
240GB RAID - damn. I actually have 240GB too but just EIDE/133 bus.

Are any of your additions being included with the new release 1.1.2 or 1.2? Just curious. If not, I'll add it anyway. Can't go back to Bud lite after having Guinness :)
#53
07/19/2002 (6:35 am)
I wouldn't of thought it would be in those releases but I would like to think that it will be in a position where it can be integrated into a later head.

Maybe it can, this weekend should determine that.

- Melv.
#54
06/18/2003 (12:56 pm)
I built the HEAD revision and am fairly sure I am not seeing this new code. Here is what I see...
http://willy.resounding.com/fai/demoapp.jpg

video is a GeForce 4 card.
what might be going wrong?

tone
#55
06/18/2003 (1:26 pm)
I know that a shore won't be rendered for certain depths. Play with these values and see what happens, also try make your own shallow pool and see what it does.

UseDepthMask - ticked (true)
ShoreDepth=some float value 0.1 up to whatever, but do increments of 0.1 and apply to check if a shore shows up :)
#56
06/18/2003 (1:31 pm)
Anthony, based on your screenshot you don't have "useDepthMask" on in your waterblock.
#57
06/19/2003 (12:19 am)
Anthony,

By the looks of your screenshot, it seems that it's not a stock [HEAD] we're looking at as I can see a few changes to the HUD / terrain etc.

If you build / run the stock [HEAD] it has worked in every case I've come across so far, especially on a nVidia geForce4 card, whatever the model.

As mentioned above though, you may want to check that the water settings are at stock values and especially check that the UseDepthMask is one because this shot has no apparent depth texturing.

- Melv.
#58
06/19/2003 (1:37 am)
Melv sorry to add off topic stuff to this thread but I have a simple q about another resource.

Right now in Realm Wars we use your grass stuff, btu there are glitches with the culling. Sometimes as you look around the grass will dissapear, then you move back or forward or to the side a bit and it re-appears. It does not have to do with distance.

I am guessing that the grass is based around a single point? or area, and if that area is offscreen all the grass associated with it is also offscreen? (Even if some of the grass actually should be onscreen)

Is our grass stuff just out of date, or maybe we are using it wrong?
#59
06/19/2003 (8:49 am)
James,

It depends whether you are talking about the Doyoon Kims fxGrass or the my fxFoliageReplicator.

I'm not sure of the versioning of the fxGrass stuff but there was a culling problem with the fxFoliageReplicator that was solved. I have absolutely no idea what version you are using but, hopefully, integrating the last update from resources will sort your problem out.

If not then drop me an email to melv.may@btinternet.com and I will endeavour to get the time to look at it. Don't forget that I'm waist deep in the development of our game at the moment so it won't be overnight.

Presumably, you're encountering the problem on a download I can get hold of? I've actually got CVS write access to RealmWars and so I could check it out for you and fix it.

- Melv.
Page«First 1 2 3 Next»