Planetside Software Forums

General => Terragen Discussion => Topic started by: treddie on January 05, 2011, 12:39:50 AM

Title: Is hiding clouds possible?
Post by: treddie on January 05, 2011, 12:39:50 AM
Hi.

Is there a shader that can mask out clouds within a specific range from the camera?  I was playing around with some cumulous clouds, and they looked good close up, but were too busy far away.  If I made them more simple in the background, they were WAY too simple and cartoon-like in the foreground.  It would be neat to do three sets of clouds, all duplicates of each other, but with the foreground clouds having their smallest scale and feature scale set different then an intermediate range of clouds, and those different from the background clouds.  The idea being to blend them all together in a "seamless" progression from front to back.  I don't want to create three sets of different clouds because often, I like the composition of the single cloud layer I have, I just need to be able to treat that cloud layer differently with respect to distance from the camera.
Title: Re: Is hiding clouds possible?
Post by: Dune on January 05, 2011, 02:31:01 AM
Very easy; blend them by one or several distance shaders (from color shaders list). Make one or two copies of the initial cloud fractal, and change that slightly. You'd have to figure out the best distances. Don't forget that if you blend (or invert blend) your cloud fractal, you cannot really use the slider in the cloud to adjust coverage, but have to use the density slider in the fractal.
Title: Re: Is hiding clouds possible?
Post by: Henry Blewer on January 05, 2011, 08:10:14 AM
A way to figure out the distances from the camera/s in the distance shader, is to use the View Menu, 3D Preview Location. When this window is open, you can move the mouse over the preview window. The location and distance from the camera is shown. Makes things a little easier. :)
Title: Re: Is hiding clouds possible?
Post by: treddie on January 05, 2011, 08:58:44 PM
Thanks for the responses.

njeneb > I was wondering about EXACTLY that when I was trying to guestimate distances.  Nice idea.

Dune >  I tried a distance shader thinking that was what I needed to use, but I couldn't get it to work.  So I am obviously missing something.  I will have to bone up on the usage of it.

Thanks for the direction!
Title: Re: Is hiding clouds possible?
Post by: Henry Blewer on January 05, 2011, 10:00:54 PM
The distance shader uses a camera for its center. Find a POV which shows the area where you think you may like the new camera to be. Use the right mouse button and copy coordinates. Click on the camera tab and add a new camera. Paste the coordinates for the camera. All that is left to do is add the distances and rotae the camera to the proper angle.

You can return to the Render Camera view and watch the preview. This will help get the camera angle right and let you see the results of the distances.
Title: Re: Is hiding clouds possible?
Post by: treddie on January 05, 2011, 11:35:52 PM
Where exactly do you place the distance shader node?  I have tried putting it as the input to the density shader, the cumulous node, inbetween, etc.  It seems it has to be applied to just the cumulous layer somehow to tell it what to do, without affecting any other cloud layers.

It seems in my tests that using 3D Preview Location only sees hard surfaces.  When I try to get even a rough idea in the clouds, I simply get a huge number (about 200,000) which I assume represents the distance limit in the TG2 universe with respect to the camera.
Title: Re: Is hiding clouds possible?
Post by: dhavalmistry on January 05, 2011, 11:45:12 PM
Quote from: treddie on January 05, 2011, 11:35:52 PM
Where exactly do you place the distance shader node?  I have tried putting it as the input to the density shader, the cumulous node, inbetween, etc.  It seems it has to be applied to just the cumulous layer somehow to tell it what to do, without affecting any other cloud layers.

You have to put it as blending shader


Quote from: treddie on January 05, 2011, 11:35:52 PM
It seems in my tests that using 3D Preview Location only sees hard surfaces.  When I try to get even a rough idea in the clouds, I simply get a huge number (about 200,000) which I assume represents the distance limit in the TG2 universe with respect to the camera.

Yes you are right about that.....I usually spend some time figuring out the distance by trial and error.
Title: Re: Is hiding clouds possible?
Post by: treddie on January 05, 2011, 11:47:17 PM
OK!  I'm getting the distance shader to work now.  I finally figured out that it's output had to be connected to the density fractal's input.
Title: Re: Is hiding clouds possible?
Post by: treddie on January 06, 2011, 01:13:27 AM
The distance shader controls are rather confusing and there does not appear to be any in-depth reference to read to sort it out.  For instance, why is there a near and far color?  Why not just have a near and far distance to bracket the area you want to see?  I get very confusing results trying to sync-up the color and distance functions.
Title: Re: Is hiding clouds possible?
Post by: Dune on January 06, 2011, 02:55:28 AM
Because it can be used for other things as well, like a color gradient (for macadam/asphalt roads, e.g.). You should see the colors as a mask, with the distance it says where to allow things and where not. Why don't you attach a distance shader to a color input of a surface layer (temporarily as the only node between compute terrain and planet), and see what it does. It's easy to test out distances this way, with this 'testlayer'.
If you make the color black a tint of gray, you have 'a little' of whatever you're masking.
Title: Re: Is hiding clouds possible?
Post by: dhavalmistry on January 06, 2011, 12:13:40 PM
one thing I miss in distance shader is the fallof controls....
Title: Re: Is hiding clouds possible?
Post by: Tangled-Universe on January 06, 2011, 04:35:46 PM
Quote from: treddie on January 06, 2011, 01:13:27 AM
The distance shader controls are rather confusing and there does not appear to be any in-depth reference to read to sort it out.  For instance, why is there a near and far color?  Why not just have a near and far distance to bracket the area you want to see?  I get very confusing results trying to sync-up the color and distance functions.

All found on these forums just by using the search function ;)

http://www.nwdanet.com/terragen-tutorials/8-distance-shader-magic.html (http://www.nwdanet.com/terragen-tutorials/8-distance-shader-magic.html)
http://www.nwdanet.com/terragen-tutorials/9-dof-effect.html (http://www.nwdanet.com/terragen-tutorials/9-dof-effect.html)

And there's lots more, but with these 2 there's little chance you'll need more explanation.
Title: Re: Is hiding clouds possible?
Post by: dhavalmistry on January 06, 2011, 05:48:59 PM
thanks TU.....I wasnt aware of this!
Title: Re: Is hiding clouds possible?
Post by: treddie on January 07, 2011, 12:50:19 AM
Neither was I.  I searched but didn't find anything like this.  So I guess I need better glasses!  :)

I have to wait till tomorrow to play with the shader, and your suggestion about gradient, Dune.  I will post my experiences with it.
Title: Re: Is hiding clouds possible?
Post by: treddie on January 08, 2011, 02:11:13 AM
OK, I SOOORRT of see it now.  I tried your test, Dune, and I can see how easy it is to apply to a terrain.  As far as I could tell, Near Distance is the distance from the camera that the Near Color appears solid and uniform all the way back to the camera.  Conversely, Far Distance is the starting distance at range, beyond which the Far Color appears solid and uniform out to the farthest distance possible in the TG2 universe.  Between these two distances is the transition zone where the two colors transition from one to the other.  It APPEARS that if I turn off "Apply Far Color", for instance, the distance shader is still applying the algorithm to the far area, but since the color is turned off, the far area is transparent (masked out).  Therefore, the gradient shades from a solid near color below the near distance, then fades to 100% transparency at the far distance.  From there out to infinity, 100% transparency persists.

But...when I try to apply this to a cloud layer, I get strange results.  Please see the attached tgd file.  I applied yellow as a far color, green as a near color, yet my clouds don't render at all except for a red (!?) area down at the bottom right.  I have tried placing the distance shader node at different points in the network to no avail.
Title: Re: Is hiding clouds possible?
Post by: Dune on January 08, 2011, 02:52:35 AM
I'll have a look, but the colors don't work I'd say. They'll translate in shades of gray in the mask. Black is no cloud in that area, white is cloud, shades in between are the transition. Test this; enter two numbers; 10000 far and 9900 near (white as near color, black is far color), and you'll have an abrupt end of your cloud layer at around 10000m from camera.
Title: Re: Is hiding clouds possible?
Post by: Dune on January 08, 2011, 06:30:39 AM
I don't know if your cloud and detail settings were on purpose, but I wouldn't apply them as they were. So I modified your file somewhat to show what I mean. Good luck with it...
Title: Re: Is hiding clouds possible?
Post by: treddie on January 08, 2011, 04:21:48 PM
OK...NOW I think I have it!  I see now that the distance shader has to be placed as the input to the density fractal.  And pure white is the mask, not pure black.  I had it reversed.  I do that all the time with mask colors regardless of the program...get them swapped in my head.

Here is a further modification based on your file, Dune.  What I did was use 2 distance shaders, one to mask the foreground area, and one to mask the background area, resulting in just a "notch" area showing through between them.  But I had to turn off the black color for the distance shader in question.  THIS is what I was ultimately after...control of clouds within any desired range.

The only confusing part now is why let the far and near colors be anything but black or white?  The only conclusion I can come to is that it gives you complete control over what frequencies you are masking, but I am not convinced of that.
Title: Re: Is hiding clouds possible?
Post by: Matt on January 15, 2011, 06:18:01 PM
Because masking is only one of many possible uses of the Distance Shader. But the defaults are black and white for masking.
Title: Re: Is hiding clouds possible?
Post by: treddie on January 15, 2011, 10:05:52 PM
DoH!  Dune mentioned that further back, too.  When you mentioned it, it triggered my memory.  Thanks!