Water Colour Based on Terrain Height.

Started by ProjectX, March 13, 2007, 05:08:25 PM

Previous topic - Next topic

ProjectX

I have an ocean, and an island. What I want to be able to do is make it so that there are lighter green / turquoise areas of water where the water level is closer to the terrain.

At first I had a simple node layout, where I plugged the compute terrain into a distribution node, set up the colour and altitude properties and plugged the distribution shader into the water shader of my ocean. First render came out odd.

I can't really describe it, so I have an image to show you. It appears as if the water shader has been applied to the terrain itself.

Is there any way of having the altitude of the terrain affect my node layout without having the terrain affected by my node layout?

Thanks in advance for any help you can give!

mrwho

interesting, you can apply the water shader to your terrain, but I haven't played with it much

bigben

Plugging in the compute terrain will do that.

Take it out and your altitude restriction won't work either because the water surface is included in the altitude calculation. (If you have an object population over water with sit on terrain, the objects will sit on the water)

I've used an image map successfully, but otherwise you may have to wait for water transparency.

Oshyan

The only current possibilities for accomplishing this are as follows:

1. Use an image map

2. Turn on "Use Y for altitude" in a Distribution Shader or Surface Layer plugged into your water object and then work as close to 0,0,0 coordinate origin as you can

3. You can probably create a fairly ideal solution through the function network (likely involving "Get altitude") but I don't know precisely how. One of the function node wizards around here may be able to help you.

- Oshyan

fmtoffolo

I saw your problem and make something quick in 5 minutes.. i got this(picture down)
But i'll give it some more work,,,although i rather wait for transparency and such, cause this only works for high shots..
My Terragenn site
www.cgworlds.com.ar

Will

I think the planet shader pulls somthing simular off in some cercumstances, neat effect.

regards,

Will
The world is round... so you have to use spherical projection.

Oshyan

Come to think of it, you could probably do this just by using a copy of your terrain-generating procedural (assuming you're not using a heightfield) as a color modulator on your water. As long as it has the same settings it should produce the same output. Then just turn off displacement and use the high/low colors and color adjust parameters to get the effect of transparency.

- Oshyan

Will

now thats an idea, I'm rendering atm at the moment anyone want to tell me if this works?

Regards,

Will
The world is round... so you have to use spherical projection.

fmtoffolo

Yeah, it works.Its what i did above but the first time i used a heightfield, but then i started to render with a fractal to make it coincide...i think that if you use a heightfield you need to use a mask, but im not sure..
...of course it needs some tweaking..
bye
My Terragenn site
www.cgworlds.com.ar

jo

Hi,

A blast from the past :-). This is very similar to my Euphotica effect from WaterWorks for v0.9. I wrote that for the same reason too, to fake a transparent look when v0.9 didn't support transparency. Euphotica did much the same sort of thing, although it used a "physically correct" calculation for the attenuation of light in the water, which is what causes the change in water colour according to depth. I wonder if it would be possible to recreate it using the function nodes, might be interesting to try.

Regards,

Jo

Sengin

Quote from: jo on March 14, 2007, 12:55:34 AMI wonder if it would be possible to recreate it using the function nodes, might be interesting to try.

Does this mean that you are going to try?  Or you are leaving it open and want us to try?  If the latter, can you give us the equation for the calculation of the attenuation of light in the water?

ProjectX

Thanks for the help guys, I'll give it a try and tweak the results a bit.

Dark Fire

Quote from: jo on March 14, 2007, 12:55:34 AM
...although it used a "physically correct" calculation for the attenuation of light in the water...
How do you people acquire this sort of knowledge? Is there a book or website that contains all of these physics equations and values?

Cyber-Angel

Dark Fire,

Every thing one could want to know about the attenuation of light is more then likely on the Internet: in the mean time have a look at this Paper which is in PDF format which maybe of interest:

http://nestor.org.gr/2nd/files/247_252_bradner.pdf

This may also be of interest its an article on Light attenuation and exponential laws by Ian Garbett which has that math your looking for:

http://plus.maths.org/issue13/features/garbett/index.html

I hope these help there's lots out there on the subject.

Regards to you.

Cyber-Angel 

jo

Hi,

Quote from: Sengin on March 14, 2007, 01:40:03 AM
Does this mean that you are going to try?  Or you are leaving it open and want us to try?  If the latter, can you give us the equation for the calculation of the attenuation of light in the water?

It means I will try if I can find any time to do it :-). I don't have the equation handy, but I found the information about it on the Internet originally.

Regards,

Jo