Planetside Software Forums

General => Terragen Discussion => Topic started by: Goms on March 18, 2009, 08:17:51 AM

Title: warp/displace blendshader for density fractal for a cloud *update 2 - done*
Post by: Goms on March 18, 2009, 08:17:51 AM
Hi everybody,

after hours of trying and experimenting, i must admit that i need help.  ;D
I want to create a geyser from some shaders and a cloud.
The basic idea is to use the 3D function of the painted shader and geyser-like displaced terrain to create the basic form.
The displacement is function-based and creates a really great form; as a displacement. Also as a cloud for the form.
But now the structure is the problem. What i would need is something, that warps my cloud density fractal "away" from a given central point.
As a displacement this works, but however i try, the warp shader, redirect shader, displacement shader etc. do not work for colors. not even if i use another shader to create a terrain before i warp/displace/redirect it. But it will look unrealistic, if i only use the noise stretch function. then the fractal is only stretched in one direction.
Here is a picture of what i got until now (its quality is sub-optimal, in higher detail the lower cloud would look more shaped): http://img18.imageshack.us/img18/4500/73452841.png
The higher cloud should be the water jet later, the lower one the water that splashes around and steam.
And this is what i want: http://people.debian.org/~tille/debian-background/1600x1200/geysir.jpg
The shape is unimportant for now, the first thing for me is the structure.
Anybody a good idea? :)

*update*

Ok, so far i got what i needed. Nikita was able to solve the core-problem. :)
Its not perfect yet, but maybe in a few days i can show a nice geyser: http://img27.imageshack.us/img27/556/gesey.png

*update 2*

Ok, i think i'm satisfied now. :)
This last image shows the final geyser without anything, but maybe i'll use it for a picture.
It's made of 7 individual cloud layers, but i can imagine to cut it down to 4 with some more work.
Every cloud layer has quality 1 with no acceleration, the samples are between 47 and 303.
Render Detail was 0.9 with 6 AA (Catmull-Rom sharp) and GI 2 1 with supersample prepass, no ray traced shadows.
It took my Intel Core 2 Quad Q9300 with 2.5GHz and 4GB Ram on Vista Home Premium 64-Bit 55 minutes to render this in 600*800, which is quite fast for these quality; in my opinion.
If there is much demand for a (short) how-to, i can write something (maybe). :)
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Mohawk20 on March 19, 2009, 04:32:12 AM
Whoa, that's looking great!

That must be a LOT of work and a LOT of nodes...!
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Goms on March 19, 2009, 04:52:43 AM
thank you, but to be honest it was not really that hard.
the most difficult part was the warping of the cloud fractal. and this needs only 7 nodes beside the cloud shader.
this picture shows 3 clouds. one is the highest, one the middle and one the lower part.
in all there are 18 shaders and function nodes, but until now its not optimized. i think i could use 3 shaders less or something in that range.
after nikita gave his input, the rest was nothing more than combining a few shaders. ;)
right now i'm working on picture with this, so maybe i gonna show a more realistic scene later.
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: rcallicotte on March 19, 2009, 08:35:30 AM
Goms, you're on your way.  Good job!
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: cyphyr on March 19, 2009, 11:34:19 AM
Looking very good, love to see your node structure :)
richard
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Goms on March 19, 2009, 04:23:53 PM
update! the structure is still not perfect, and also the terrain is of course only scratch.
Motivation is getting smaller.  ;D
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Mohawk20 on March 19, 2009, 08:12:37 PM
I would really want to see your nodes, or even a clip file. This can be used for so much different scenes, like explosions and stuff...
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Goms on March 20, 2009, 04:17:51 AM
well, the key-idea is from Nikita, so i should ask him first. ;)
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Goms on March 20, 2009, 11:10:02 AM
ok, here we go:

the basic idea was to warp a power fractal away from the center.
as the warp shader seems to warp somehow along the slope of the displacement of the shader plugged to the warper-input, i needed a function which creates an ongoing slope around the central point (maybe the easiest picture to imagine this is a screw).
nikita came up with the following idea:
a get position node leads to a x to scalar node which will be divided witch get position again.
this fraction (x/get position) can be used to create an angle with the arcsin node.
when this is used as function for a displacement shader, this can be plugged into the warper-input. :)
The rest is basically just an image map and a merge shader.

Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: nikita on March 20, 2009, 11:36:33 AM
My guess is that the warper works in the following way:
The normal of the displacement specifies the direction of the warping and the amount of displacement (basically, the height) corresponds to the distance of the warping. With that direction and distance, you get a certain position.
I don't know the details but I think it basically looks up what the shader looks like at this position and uses this as output.
This way the fractal will be squeezed where the displacement has a (high) gradient and stretched where there's a hill or valley. It's somewhat counterintuitive but it is fast, easy to code and sufficient for most cases.

In this case I calculated the angle. the idea is that the angle a point has relative to the center, gets larger and larger, causing a gradient with the desired direction.

By the way.. if you're reading this Matt, a function node to calculate the angle (in [0, 2pi]) of a point relative to the origin (0,0,0) would be nice. The arc* functions don't really do that unless you surround them with a lot of extra nodes. Maybe one for each of the three planes.
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: cyphyr on March 20, 2009, 01:08:16 PM
VERY interesting and potentially useful, thanks for the info and screeny :)
By the way will this work at any point on the planet or are we limited to the origin (0,0,0) ?
richard
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: nikita on March 20, 2009, 01:16:54 PM
You can create a constant vector for the position you want and then subtract it from the output of the get position node.
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Goms on March 20, 2009, 01:24:24 PM
@nikita: damn, 2 minutes faster than me :P

it could be very interesting if theres a possibility to create more than one 0;0;0 in order to create more than one geyser...

edit:
yes, it is. :D
http://img12.imageshack.us/img12/4452/clipboard02ndv.jpg (http://img12.imageshack.us/img12/4452/clipboard02ndv.jpg)
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Mohawk20 on March 20, 2009, 06:56:41 PM
Darn...
I feel stupid when people start talking about functions, because I can't get my head around it.
I guess it's because I'm a visual thinker, I like to see what I do, not extrapolate abstract concepts.


So thanks for the node views and stuff, maybe one day I can make a function tree of my own that actually does something!
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: rcallicotte on March 20, 2009, 07:54:54 PM
Functions are sorta abstract.  I agree.  This is nice, too.  Thanks.
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: Goms on March 21, 2009, 05:17:11 AM
i also had some problems when i started to use functions, but most time you can use the last function node as input for a displacement or power fractal shader. on this way you can see what you are doing most of the time. ;)
Title: Re: warp/displace blendshader for density fractal for a cloud *update*
Post by: mogn on March 22, 2009, 02:25:14 AM
Quote from: nikita on March 20, 2009, 11:36:33 AM
By the way.. if you're reading this Matt, a function node to calculate the angle (in [0, 2pi]) of a point relative to the origin (0,0,0) would be nice. The arc* functions don't really do that unless you surround them with a lot of extra nodes. Maybe one for each of the three planes.
Title: Re: warp/displace blendshader for density fractal for a cloud *update 2 - done*
Post by: nikita on March 22, 2009, 07:45:37 AM
Nice!  :)
Title: Re: warp/displace blendshader for density fractal for a cloud *update 2 - done*
Post by: Mr_Lamppost on March 23, 2009, 06:17:07 PM
Nice result and thanks for sharing the method.

I got a grip on using functions quite quickly but only very recently managed to do anything with the warp shader  ;) I will need to investigate further.