Page 1 of 1

flat water

PostPosted: Tue Mar 01, 2011 2:21 pm
by creat326
Hi

I would like to flat the area where water is located. I export it all as a mesh and in my game I don't need to go underwater. I like the generated texture, but the 3d of that area could be flat and avoid triangle counts.

Is there a way to specify that height to be flat? or better yet, the area of water to be flat?

Thanks

Re: flat water

PostPosted: Tue Mar 01, 2011 9:26 pm
by Aaron
Hi Creat326,

You could convert the water map to a heightmap, then merge the output with the heightfield using a 'max' combine function. That should do the trick.

You can do this either with ZeoGraph, or scripting, or even using the relevant menu options in L3DT (though the latter will require you to export the water map as a heightmap, then re-import to affect the merging).

I can probably bash a script together to automate this for you if you like. Might take a day or two; a bit busy ATM.

Cheers,
Aaron.

Re: flat water

PostPosted: Tue Mar 01, 2011 9:57 pm
by creat326
that would be great if you could do the script since i'm not sure i understood it :)

Re: flat water

PostPosted: Wed Mar 02, 2011 10:11 am
by Aaron
Hi Creat326,

Here's your script:

http://www.bundysoft.com/wiki/lib/exe/f ... _and_hf.zs

This script requires L3DT v2.9 build 11 or later. However, in this and earlier builds there is a misfeature in the atConvertWaterToHeight plugin that can, at times, pop up an annoying query about overwriting temporary maps. I've fixed this in v2.9 build 12, but I haven't released that just yet. Nonetheless, v2.9 build 11 should still work just fine with this script.

Anyway, please let me know if you find any problems with the script.

Cheers,
Aaron.

Re: flat water

PostPosted: Wed Mar 02, 2011 11:55 am
by creat326
thanks!

i'll check it tomorrow.
btw, I realized that splatmaps don't have the water texture, only "land" texture. Is this a bug?

Re: flat water

PostPosted: Wed Mar 02, 2011 12:25 pm
by Aaron
Hi Creat326,

No, that's definitely intentional. The texture maps and alpha maps are intended for the heightfield surface. Hence, they always describe the land type, regardless of the type of water that may or may not be above it.

Perhaps it's best to think of this in terms of an FPS game where you're swimming underwater. The colour of the texture applied to the heightfield mesh under the surface of the water is going to be the ocean floor (i.e. sandy), not the ocean surface (i.e. water waves).

This is demonstrated in the image below, where I've run off the side of a map so that you can see the heightfield texture beneath the water plane. Note how the texture of the terrain underwater (i.e. the texture map) is still representing the colour of the land (sandy, rocky), not the waves above, which are handled by a separate water mesh and texture.

[please scroll down to view the underwater section*]
UnderwaterTexture.jpg
UnderwaterTexture.jpg (108.2 KiB) Viewed 22034 times


It may confuse matters slightly that L3DT, by default, also bakes the effect of absorption of light by water onto the light map and thence the texture map, giving the blue/green underwater look. This is provided for renderers that don't do their own underwater light shading, but it can be disabled in the light mapping wizard.

Anyway, back to your problem; what you need is a way to bake the water map texture onto the heightfield texture. This is again possible with a custom script, but it'll take me a little while to cook that up, as there's quite a lot of other activity on the forum today. I'll let you know when I've got a script ready.

Best regards,
Aaron.

* grrr...I cant seem to control the display size of attached images.

Re: flat water

PostPosted: Wed Mar 02, 2011 11:49 pm
by Telarus
* I ran into the same problem when posting my G16.bmp questions. I think you may need a plugin for this version of your forums to allow access to that.

Re: flat water

PostPosted: Thu Mar 03, 2011 11:43 am
by creat326
i think it would be a nice checkbox to have on baking the splatmaps: include water?
Since you are working on a script, it might be useful to add it already as a feature :)

Re: flat water

PostPosted: Wed Mar 16, 2011 9:51 pm
by Aaron
Hi Creat326,

For the reasons mentioned above, I won't be adding this as a feature. The script is on the to-do list.

Cheers,
Aaron.

Re: flat water

PostPosted: Fri Sep 02, 2011 8:09 pm
by creat326
Hi Aaron,

I think the script that was included here doesn't work anymore. I don't find it by default on the new version either:
http://www.bundysoft.com/wiki/lib/exe/f ... _and_hf.zs

When I execute it, i get a new tab with black area for the water but the mountains seem flat too... i'm sure it's just the new version that it's not fully compatible with the older scripts.
Is it hard to upgrade? this reduces my poly count drastically for the game.

Re: flat water

PostPosted: Sat Sep 03, 2011 7:59 am
by Aaron
Hi Creat326,

I just downloaded the script from the website and tested it, and it's working as intended. All heightmap pixels that were below the water level were set to the height of the water surface. The heights of the hills were unchanged. If you'd like to check this, hover the mouse cursor over the highest point in the heightfield and note down the altitude reported in the status bar, then hover the mouse over the same point in the 'HF_plus_WM' layer, and compare the altitude. They should be the same.

You can also check the output in Sapphire, by running the script and clicking the 'Yes' button to overwrite the heightfield. Then, open Sapphire, and behold the flat water surface:

WM_plus_HF.jpg
WM_plus_HF.jpg (88.96 KiB) Viewed 21856 times


Once you're done viewing the result in Sapphire, be sure to press the 'Undo' button in L3DT to restore the heightfield to its previous state.

Are you observing a different output from this script? If so, can you post screenshots?

Cheerio,
Aaron.

Re: flat water

PostPosted: Fri Sep 09, 2011 4:37 pm
by Prime_8
if i could could get the mesh of the flat area , it would work extra cool with a water shader that puts 'surf' near the edges of the mesh .

that would be cool . hmm suppose i could use my app to kill all verts above the sea level , in the resulting exported game mesh , that would result in same ?
hmm .

cool idea.. guys.