Quote from: FrankB on February 01, 2010, 06:59:02 AM
I think I may have an explanation for that.
I suspect that the lake object doesn't "know" about its surface, unless some sort of color information is being fed into it.
With DandelO's setup, the painted shader is the blend input to the default shader, which in turn will only exist where the paint exists.
Now the default shader feed into the input of a surface layer. The surface layer doesn't have a surface to exist on, other than what's coming through from the default shader.
Because the water shader is applied as a child to the surface layer, it also exists ony where the default shader exists, which means that the water shader is only able to provide the lake object with coordinates about the lake's surface, where the painted shader exists.
Hence, TG2 will only render the water shader on the painted area.
Frank
Frank's essentially got it, yes.
The painted shader is simply driving everything that follows. The
default shader doesn't have a blending input, I use the opacity channel of this to make the colour
only visible where the white of the paint describes. The opaque parts are rendered, the transparent parts are just not.
The following 'surface layer', you'll notice,
still has apply colour
un-checked. It is only for parent-shader purposes, it is the water shader's parent, only. You can use the 'surface layer' as extra blending aswell(usefull if you're texturing a sphere or curved surface, not really so useful on a flat plane/lake).
The water shader is simply a child to the surface layer that is now only shaded where your paint shader tells it to. Te rest of the water object's surface is simply omitted from rendering.
In my example file, I have cut the render time in half.
If, for example, you need a very, very long, thin river in a scene you could either make a long thin plane as the water object(you will still however need to render water beneath the terrain this way) OR, you could now simply make a giant lake/plane covering everything where water needs to be, a default lake object is HUGE, this no longer matters because it simply won't render water unless you tell it where you want it, e.g. with your river displacement paint.
I made this method over a year ago, probably closer to 2 years ago. I'm very surprised that it hasn't been implemented yet. It was in my vol.2 Library pack, which has had literally hundreds of downloads.
*EDIT: I first uploaded a version of this in October 2008. Over a year, then. It used a B/W image map because the painted shader hadn't been invented at that point. I updated it when the painted shader was introduced.