Heightfields and cloud masking question

Started by nvseal, March 09, 2007, 11:07:15 PM

Previous topic - Next topic

nvseal

Is it possible to use a heightfield as a mask for cloud distribution? and if so, how?  :)

fmtoffolo

u should be able to do it by plug in you heightfield to your density shader "blending shader"...

restricting the clouds only to where high peaks are can help create effects like lenticular clouds or things...i think...your idea really got me thinking...lol
My Terragenn site
www.cgworlds.com.ar

nvseal

Well, that's what I tried and it didn't work.  :-\ I would think that there would be a way to do it I just can't figure it out. Maybe I'm doing something wrong.

Oshyan

The heightfield shader outputs *displacement* data, not color data, and the Density Shader (and Blend Shader) inputs operate on color data. You can turn on "Apply colour and shade" and then check "Shade by height", unchecking "Shade by light". This will make it also output color data where white is highest and black lowest. This color will be overwritten by your shaders later in the network, so you won't get undesirable effects on your terrain, but if you plug the output of the Heightfield Shader into the Density Shader input of the cloud layer, or the Blend Shader input of the existing Density Shader (then turn on Blend By Shader in its settings), then your heightfield should begin to control your cloud distribution.

There are a few things to know when doing this. First, the area of the generated heightfield will contain shades of gray, white to black, by height, however the area outside the heightfield is considered black. Thus clouds will show up in a square inside the are of the heightfield but nowhere else. Second, you will probably want to use the Blend Shader input with the existing Density Shader so as to give yourself more control and natural-looking cloud shapes, rather than *directly* driving the cloud distribution with the heightfield. You may need to increase "Coverage Adjust" in the Density Shader to get many clouds to show up. Third, if you *do* use it directly as the Density Shader, you'll probably need to increase the brightness of the color output beyond 1 in order to get anything to show up in the clouds. Try a value of 5, for example. But as I said I recommend plugging it through the existing Density Shader.

This method may not actually get you what you want, but it seems to me as if it accomplishes the request in your original post at least.

- Oshyan

nvseal

Thanks Oshyan. I've been able to get the heightfield to work by feeding the output into the input of the cloud density shader; but now I have come across two more problems. 1) When coverage adjust is increased to values greater than 0 the clouds extend beyond the heightfield and populate the entire planet 2) The clouds can be rendered from above, but from ground level the clouds aren't visible. ??? Does anyone know the reason for this?

Oshyan

"Coverage Adjust" in the actual Cloud Shader is not what you want to change. Instead change the Coverage Adjust in the Density tab of the Density Fractal 01. That should avoid the "clouds outside of terrain" issue and still allow you to modulate the coverage. As for being renderable from below, they appear to render properly from whatever angle on this end. Try the coverage adjust and post a .tgd example file if you continue to have problems.

- Oshyan

nvseal

I still can't see the clouds from below. I think I'm looking right at he problem and just don't see it. Here's the file, could you post the file that works for you.

bigben

#7
[EDIT]
Tried a render and this is flawed as well. Trying a different approach.
[/EDIT]

I work a little differently to some others, as I've found that some things don't always work exactly the way you expect them. I construct my masks piece by piece using surface layers as I've found these to perform more reliably than some other shaders when it comes to colour and masks.  I've attached a TGD of my workaround to your problem. It includes 3 surface layers that allow you to preview just where things are.

The colour adjust shader is used to control the height restrictions for you cloud mask. Areas that are darker than white (your max altitude) effectively reduce the cloud coverage setting at that point so you will end up with less cloud coverage than you expect. Areas that are not yellow in the preview will have clouds.

I also plugged in the cloud density shader into a preview layer so that you can see where you clouds are. This can be useful if you have cloud shapes just outside of your masked area. You can always use a transform shader to move the clouds into your mask.

The blue preview layer shows the combined result. Note that there are two subtract colour functions. If you only use one you will get a significant number of clouds outside of your masked area. Even with two, you will still get some extra small clouds. The amount of extra clouds will depend on your cloud settings.

nvseal

Thanks Bigben. I looked at the file and the clouds still will not render at ground level until I raise the color/coverage values to the point where the clouds are no longer restricted to the heightfield. Will the clouds render from ground level for you or could this just be a problem on my end?

bigben

I experienced the same problem. I went back to my earlier masking tests and have attached a simplified version of what you are trying to do. In theory (the preview surface works as expected) it should work, but it doesn't. If you subsitute the image map for the distribution shader a cloud appears.

I tried several different combinations but none seemed to work. Different results (when the preview surface appeared fine) included:

  • clouds rendered on terrain once
  • clouds rendered Ok from above, but not from below
  • clouds largely ignored mask
  • clouds simply didn't appear

This may be related to some of the other inconsistencies I found with creating masks.
http://forums.planetside.co.uk/index.php?topic=864.0

Oshyan

Hmm, I was setting up my network in the current alpha release where it seems to work fine. It appears however that the original Tech Preview release has some problems that have since been resolved in regards to this functionality. The upcoming patch will fix it, so I'd suggest waiting a bit for its release.

- Oshyan