direction shader with heading and elevation

Started by Goms, February 07, 2010, 10:39:27 AM

Previous topic - Next topic

Goms

Hi there,

as i thought about snow in spring (as in this picture) i tried to build an direction shader from functions.
My idea was... well, hard to describe. Basically i use the get normal shader with the red/blue/green to scalar functions to get scalar values between -1 and 1 for x, y and z direction.
Then i multiply these with a value between -1 and 1 for the heading (a constant scalar from 0-360 converted to radians scalar and then sin/cos). If i add these, i get the direction perfectly. You might see more in the file or on the screenshot.
Now i want to use the elevation (green to scalar, i think) too, but i have no clue how to get it working...
Ideas, anyone?  ;D

Thanks for any help,

Goms

Quote from: FrankB
you're never going to finish this image ;-)

Hetzen

Does the Green to Scaler from the Get Normal work in terms of 'real' XYZ coordinates, or does it take the curvature of the planet into consideration? I would guess the former, but having not played with Get Normal before, you've opened up a new avenue to explore for me here. Interesting little network there Goms.

I'd asume that the Green to Scaler would have to take into consideration the radius of the planet as an offset to your calculation. But I don't really know.

Goms

the get normal takes the final normal of the surface and outputs a color image with the three colors.
so the green part is kind of "how much does this parts of the surface head to up/down".
Here's an example that shows how it works in the terrain with the heading only. The sun is at 270° and the direction shader is at 90°.



The Green should now blend everything according to the elevation. for example to get the red only there, where the sun does not hit the terrain. ;)
But maybe just using the slope to control this makes more sense at all. =D
Quote from: FrankB
you're never going to finish this image ;-)

cyphyr

Fascinating work here, mostly beyond me.
I'm dl'ing the file for further experimentation. My particular interest is iof it can be modified to word as a "fake shadow shader".
As has been discussed elsewhere a masked plane object still casts a shadow of a complete plane. I'm wondering id this method may be able to at least partially circumvent this.
Richard
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

Goms

I think yes.
But you will need an elevation function.
I suggest that it might work like an Universal joint, but that means you somehow need to combine the functions with xyz.
You should be able to do the same as for x,z for y,x and y,z.
But at the moment i don't have the time for exploring this as i have to write a test in latin next week.
Try to get the direction working with sin and cos for y,x and y,z. The idea is very simple:
if you have 360° in radians the sin or cos will give values between 1 and -1.
for x,z this means, (for direction=90) x is 0 and z is 1. For 45° both are equal.
Explore this and make the same including y for z and x and you might find a way to combine these 3 results to get a direction and heading result.
It should be easy as you always get values between -1 and 1.
The plane problem might be solvable with this and some other functions.
like "if x,z is between fu;bar scalar=bla*0" and this multiplied with a vector determined by the heading and elevation function.
But a fake shadow would be possible for sure.

ok, this sounds a little bit confused; i had some beers, sry. If i find the time tomorrow evening (in 24 hours) i'll try to explain.  ;D
Quote from: FrankB
you're never going to finish this image ;-)

Kadri

I had not some beer and i am confused ! But not your fault you can be sure  ;D

I know here are some clever guys that would maybe thought " ahaaa i get it" !

Kadri.