Planetside Software Forums

General => Terragen Discussion => Topic started by: cyphyr on September 02, 2007, 01:06:25 PM

Title: Transparent water work arround
Post by: cyphyr on September 02, 2007, 01:06:25 PM
<edit>Just noticed Moodflow had already sused this technique</edit>

Well I thought I would take a break from my canyon project and have a go at some thing thats been a problem for a while now. I don't know if this has been posted before, my apologies if it has.

Transparent Water ~ The solution (well maybe lol)

Make two renders, one with the water and one without.

Open both in Photoshop and copy the water render over the bare render.
Mask out the water and delete the "shore line" in your upper layer.
Apply a layer mask to the selection in your upper layer and fill with a gradient black to white gradient.
Thats pretty much it, the water is now more transparent where the mask is darker and more opaque where it is lighter.

The two wavey examples below also used a greyscale copy of the water layer to further mask the alpha so that water more perpendicular to the viewer was also more transparent.

As a further step you can use the same selection to apply a slight ripple/distortion to the surface below the water.

I'm sure that this technique could be adapted to more complex environments, possibly with the use of a z depth layer as well

Richard
Title: Re: Transparent water work arround
Post by: moodflow on September 02, 2007, 03:00:02 PM
Very nice work!

Yes, this is the exact same technique I used, but I added a few extra steps to try to simulate SSS, depth blur, and transparency color.  Thats the only difference.
Title: Re: Transparent water work arround
Post by: RealUser on September 02, 2007, 05:51:04 PM
And if you add some caustics, it would look really great.
Title: Re: Transparent water work arround
Post by: sjefen on September 02, 2007, 06:35:47 PM
Looks great.
Title: Re: Transparent water work arround
Post by: dhavalmistry on September 02, 2007, 08:25:25 PM
is there a workaround for transparent water effect without taking the render to photoshop???
Title: Re: Transparent water work arround
Post by: Volker Harun on September 03, 2007, 07:49:21 AM
Yes.
Title: Re: Transparent water work arround
Post by: rcallicotte on September 03, 2007, 08:42:18 AM
Volker...and it is shown...where?
Title: Re: Transparent water work arround
Post by: Volker Harun on September 03, 2007, 08:48:22 AM
@Calico: It is rendering. And it is tweaky.
Title: Re: Transparent water work arround
Post by: dhavalmistry on September 03, 2007, 11:05:30 AM
care explaining the concept Volker?????....please
Title: Re: Transparent water work arround
Post by: Volker Harun on September 03, 2007, 11:27:44 AM
I attached a scene file, as the function isn't a standalone thing.

It gets some colour information from the fractal terrain and calculates the height-difference of it and the water-plane.

This information is used to create a 'depth'-sensitive blending shader for the water-shader.

It is very tricky to get the right balance for the colours of the fractal terrain. It is almost impossible to get correct values when using more than one terrain.
The calculated mask is only correct when rendering from bird's eye perspective (90° downwards) - it will be more incorrect, the lower the camera's angle is.
There is no distance-shader included (necessary?) nor refraction.

One first render gives the information for the surface under the water's disc object - and is used as an image-shader through camera. I rendered it at 0.3 quality for the refracted look.

So, it works, but it is not really versatile or perfect.

Volker

Title: Re: Transparent water work arround
Post by: Volker Harun on September 03, 2007, 11:33:49 AM
Forgot to include the rendered scene ...
it needs some work ... just the first day's results.

In fact, it looks a bit like strong surf, doesn't it?
Title: Re: Transparent water work arround
Post by: Volker Harun on September 03, 2007, 03:03:40 PM
Wanted to upload another, a better PoV.

And last, not least to credit Andy Welder who made in my opinion the first steps in shading water and inspired me a lot!

Volker
Title: Re: Transparent water work arround
Post by: moodflow on September 03, 2007, 03:18:21 PM
Amazingly creative use of nodes to generate this effect.  5 stars from me!    :)

I wonder if there is a way to add a color effect, the deeper the water is?  This would simulate transparency (water) color.
Title: Re: Transparent water work arround
Post by: Volker Harun on September 03, 2007, 03:25:54 PM
Yes, this should be possible - I could do this tomorrow.
Title: Re: Transparent water work arround
Post by: moodflow on September 03, 2007, 03:45:21 PM
Working on it right now.  Just trying to dial in the transparency, though its looking great already.

EDIT:  I somehow mesed up the view and the effect is no longer working.  So I am looking into why.   Very fun!  Thanks Volker.
Title: Re: Transparent water work arround
Post by: rcallicotte on September 03, 2007, 03:47:32 PM
Volker, thanks!  Again you surprise me with your understanding.  It's like you wrote this program.  Are you sure aren't really one of the programmers and are "chumming it" with the users to look humble?  LOL.

Cool use of this program...like moodflow said.
Title: Re: Transparent water work arround
Post by: Volker Harun on September 03, 2007, 03:50:37 PM
I am just lucky that some minority of my mistakes turn out to be useful. That is all ,-)
Title: Re: Transparent water work arround
Post by: Volker Harun on September 04, 2007, 05:58:39 AM
@Moodflow:
I added a colouring surface shader to the water-shader's input.

The colour function got a nice smooth fractal, the fractal breakup was connected with the Multiply Scalar on the bottom of my function (inverted shader).

Coverage 0.75; Fractal Breakup 0.75 look nice for darkening deep sea.

Volker
Title: Re: Transparent water work arround
Post by: ratsnake on September 05, 2007, 11:31:15 AM
Fantastic walkthroughs! Very glad to see the solution!
Title: Re: Transparent water work arround
Post by: bigben on September 05, 2007, 09:06:15 PM
Very nice.  I'd also suggest adding a shader based on a vector from the surface to the camera so that  you have more reflection as the angle becomes parallel with the water surface.
Title: Re: Transparent water work arround
Post by: Volker Harun on September 06, 2007, 01:10:58 AM
@Bigben ... this works automatic due to the specularity of the default shader.
Title: Re: Transparent water work arround
Post by: zionner on September 17, 2007, 06:30:46 AM
Nice work around Volker, How would you use this if you had Objects in the render?
Title: Re: Transparent water work arround
Post by: Volker Harun on September 17, 2007, 06:40:51 AM
If you have an object above or floating in the water, it will probably intersect with the above function.

I would have to give it a try ... I think, that you would need two renders for imagemaps (under water-render, transparency-mask (which is calculated on the fly in the above function)) and the final render with water.

This is getting quite complex but ,-)
Title: Re: Transparent water work arround
Post by: zionner on September 17, 2007, 06:45:26 AM
Right, I see what your getting at, but if I need the extra imagemap..Where do you think it would go?....would Creating another Default Shader, and connect that to the Colour function of the new Default..Then Merge?
Title: Re: Transparent water work arround
Post by: Volker Harun on September 17, 2007, 07:00:36 AM
If you disconnect the default shader from the 'Waterbase'-node, you can see the simple mask (you might need to activate the colour in 'WaterBase' and change it to white).
Turn off the reflections of the water shader (but keep it for the waves' displacement).

This rendered image is the fractal breakup (imagemap with camera projection) instead of the function for the final render.

Does this help?
Title: Re: Transparent water work arround
Post by: zionner on September 17, 2007, 07:03:31 AM
Yeah I get it now, Thanks
Title: Re: Transparent water work arround
Post by: Seth on September 22, 2007, 06:43:21 AM
just to say that if you connect your "water shader" to the input node of a "merge shader" and a surface layer to the "shader A" of this merge, then you connect the "image map shader" to the colour fonction, you can play with transparancy by going to : "Merge Shader"/"Mix control" tab/Mix to A... to the left = less transparent, to the right more transparent...
perhaps yo already knew that...  :-\
Title: Re: Transparent water work arround
Post by: Volker Harun on September 22, 2007, 12:27:52 PM
Good point and a helpful addition. I haven't thought about this possibility.
Thanks for sharing!
Title: Re: Transparent water work arround
Post by: sonshine777 on September 22, 2007, 05:53:16 PM
I have been using the merge method for some time. The nice thing about it is you don't have to disable the reflection part of the water shader.

I am still working on perfecting it as is everyone else. Here is the post where I explained how I do it. Hope this will help others along in their quest for transparent water. (Until we get it for real) :)

http://forums.planetside.co.uk/index.php?topic=1391.0

Title: Re: Transparent water work arround
Post by: Volker Harun on September 23, 2007, 06:17:07 AM
Good work ... I definitly missed that one. I just updated the 'Volker's Attic'-Thread for giving you the credits.
Title: Re: Transparent water work arround
Post by: sonshine777 on September 23, 2007, 12:02:05 PM
I have been playing around with a third render and additional merge shader to add caustics will post more when I get it worked out.