Function Question

Started by nvseal, February 28, 2007, 11:27:28 AM

Previous topic - Next topic

nvseal

My question regards functions and distance. The shot I'm working on now has some small, function sand dunes that look pretty good up close; however, the farther away they get they look more and more computer generated (see the left of the image). Does anyone know how to fix this effect and give more randomness to the dunes? I will admit I haven't taken any time yet to look at this myself so the answer might be right under my nose but any help would be great. Thanks. 

ProjectX

I dont know how you set your functions up, but try blending by a powerfractal for density.

nvseal

The function feeds directly into a the function node of a displacement shader with my fractal terrain feeding into the input. I'm attaching the file if you need a better look. I'm not sure how I could blend the funtion with a power fractal using my currect set up; perhaps someone could show me a better technique?

David Burnett

#3
I've not tried this, I was going to try it out for the next part of my function based terrain tutorial, but you might like to try
using the Get Camera Position and Get Position Node to work out the distance from the camera and driving the scale of the Perlin noise
using some factor of the length. That will make the dunes farther away from the camera more disturbed.

So of the top of my head...

Get Position           
Get Camera Position

Feed both into a subtract vector.

Feed that subtract vector into both inputs of a multiply vector
Feed that multiply vector into a X to Scalar and a Z to scalar.
Add the output of the two scalars.
Square root Scalar the result (this might not be necessary, avoid it if possible as Square Root is a slow operation).
That gets you the length.

Multiply that by a Constant Scalar set to some small value , say 0.01 (always multiply rather than divide then you can, it's faster).
Feed that into the scale input of the Perlin noise, or maybe multiplying the the result Perlin noise instead (told you I haven't tried it  ::) )
You may want to play with the Constant, or try doing things like using the log of the length if you get to much noise.
You may also what to add 1.0 before feeding it into the perlin noise, as you going to get very regular dunes close to the camera.

Dave

P.S. Planetside guys, a distance node to do the hard work might be quite a useful one.