Jump to content

cloud Shader


MENOZ

Recommended Posts

Hello.

It's been a while I've been trying and experimenting on and off in creating a cloud shader.

I have seen what Matt Ebb did using the Mie phase plot and implemented it, but i wasn't completely satisfied. with the result.

http://mattebb.com/weblog/rendering-clouds-with-the-mie-phase-function/

 

Lately I've seen this sneak peek of the upcoming terragen 4

https://www.youtube.com/watch?v=87TkK1_avO0

and  the work done on the good dinosaur

https://www.youtube.com/watch?v=bD4E4ECWZHI

 

and I decided to try again with the clouds.

 

First thing I tried to solve is to create those dark edges that we can see in these images.

 

https://anothercraftblog.files.wordpress.com/2009/11/cumulus-clouds-bw.jpg

http://mstecker.com/images/clouds/cloudsjrf_0817pro2a.jpg

 

I don't know why is this, but this is my guess.

After some research what I know is:

clouds (on earth) can be made of particles of water, ice, or mixed (plus other elements but I these are the two main elements).

The scattering phase is, with my words, the amount of light that is "reflected" in different angles. I don't know exactly what the phase is. Is it intended as the pase of the photon, or as shift in direction relative to an object, like a spherical particle of water ? my ideas are a bit confused over this.

Anyway, this scattering phase changes depending on de density of the particles and on the shape of the particles of our cloud.

So I was thinking that maybe those dark edges depends on those 2 factors. Maybe on the edges the cloud is less dense and/or the shape of the particles is different, and in some angles we see them dark.

I found this image that partially confirm my theory

phasefunctionc.jpg

the blue line represent water droplet shape, the rest are just different shapes of the ice cristals. And we see that the intensity is much lower on a big part of the angles for the water droplets, so it should be darker.

 

So I tried to do a simple shader, mixing 2 graphs based on the density. so that the denser part of my cloud, would be made of ice, and the lighter part wich is for a good part external  is made of water. My explanation to this would be that the external part of the cloud is more exposed tho the radiation from the sun and the ice particles turns to water.

 

Well, it seems to work. playing with the graph (I made a ramp roughly matching the graph so It was easier to test) gives lots of freedom on the look, on the contrast.. 

 

What when we see it from the back? we should have the so called "silver lining", so again playing witht he ramp I can have more light passing through the lighter parts of the cloud. and it seems to work fine, but there's another thing missing.. the shadow parts.

 

In the illuminance loop in houdini I have a Shadow vop, that I can usually use as a multiplier for the light's color, but If just I do this here it's not doing what i'm looking for.. it gets too dark in some areas and looks again like a standard volume, but with dark edges. I feel at this point what I am missing is the internal scatter, to restore light in those areas.

 

I tried to use the volume scatter in pbr (and I had to make this illuminance loop work with the pbr engine lnking some parameters to the phase function that comes with houdini, so I'm quite sure that is not doing what it should.)

 

I might be completely off road, I'm looking for help, ideas... what do you think?

 

I will try to post some results and a hip file, once i've cleaned it.  :unsure:

 

 

 

Link to comment
Share on other sites

here are some renders.

there is no shadow here, and the light position is almost always around 40° and 90° so that we see the dark edges contrasting in different amounts with the denser brighter parts.

 

of course the quality of the volume model impacts a lot the final look, I didn't spent too much time on it, I know is lowres and I didn't play with additional displacement yet. 

 

Also the shader now works just considering the density, but you could use whatever field or mask you want to have a richer look and define the details.

 

The light should attenuate while it goes through the cloud. How can I do that? Should I use a light shader? should I import a light variable dpz from the light shader to control how much the light ray goes through the volume?

should I just tweak the opacity and  focus on scattering the light into the cloud using maybe point a pointcloud approach?

 

post-1766-0-10583500-1452629564_thumb.jp

post-1766-0-53574700-1452629565_thumb.jp

post-1766-0-10457300-1452629566_thumb.jp

post-1766-0-61068400-1452629566_thumb.jp

  • Like 2
Link to comment
Share on other sites

http://www.sidefx.com/docs/houdini15.0/vex/contexts/shadow

 

Define a shadow shader by defining a program that’s called from surface or fog shaders to calculate the occlusion on a surface from a light source.

 

I would like to calculate the shadow / a value, using a shadow shader, hoping that gives me more flexibility, and call the value in my surface shader. How can I do?

I have a import light variable, but I am not sure if it accept the shadow shader.

 

----------------------------------------------------------------------------------------------------------------------

EDIT:

 

I think i figured out how to use it. I have to assign it to the light in the surface shader, just using the "shadow" in the illuminance loop.

I couldn't figure out how to make a proper standard shadow anyway.

But what I really want is the dPdz from light. and not from camera.

I want to know how deep I am inside the volume coming from the light.

 

I am thinking to extract the depth from the shadow itself, I'll keep experimenting with this. But if I could have the dPdz from light directly would be great.

 

anyone knows how to do this?

Edited by MENOZ
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...