Volumetrics / Ray Marching

Re: Volumetrics / Ray Marching

Postby Skinnytorus » Thursday, 15.May 2014, 15:04

Not exactly. I wanna modulate fog density by a 3d noise texture.
Take a look at that: http://blendersushi.blogspot.ru/2012/01 ... nsity.html
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 17:08

ok i see
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby Skinnytorus » Thursday, 15.May 2014, 17:15

My logic is this: if the spherical fog shader has a falloff, then it's a gradient. Gradient is a lerp function, right? Why can't we use some other function (noise) to modulate the falloff? You see?
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 19:19

it should be possible to do somthing for spherefog.
let me try.

ps : you can show the code in material operator, by getting Pixelshader, relative code to fog here is marked by the "// tint " comment.
Enable customCode to test your changes, it is how I debug shaders ;)
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 19:36

try this :

float radius = temp00.x * 10;

for the first line. (temp00 is the 1st slot texture) and put a perlin texture
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby Skinnytorus » Thursday, 15.May 2014, 19:59

The material becomes all red after I insert the line. Can you share your example file?
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 20:26

here
You do not have the required permissions to view the files attached to this post.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby Skinnytorus » Thursday, 15.May 2014, 20:44

That's much better, but how do we deal with a situation with different materials?
You do not have the required permissions to view the files attached to this post.
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 20:57

repeat operation on each material you want to expose the effect. and use a 2nd texture slot (a second diffuse) only to bind the texture to the shader, and to use this second texture for the fog modulation. first diffuse will be the real diffuse texture.
You do not have the required permissions to view the files attached to this post.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 21:02

if you like the effect, I can modify spherefog operator to get an optional texture on input...
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby Skinnytorus » Thursday, 15.May 2014, 21:05

I got your point. Thanks. If you rotate camera, the fog texture is scrolling. Kinda cool effect, but normally, it should stay in place. And another problem - it's a 2d effect. Can it be 3d?
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 21:14

no it is only 2d. it affect only surfaces from camera direction.
WIth a sphere we can't show the trick and we think that is a 3d volume, but with another shape we see that texture is scrolling.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby Skinnytorus » Thursday, 15.May 2014, 21:26

I see. A sprite with camera projection ;). Why not? It may sometime be of some use. Go on with the modification. Thanks.
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46

Re: Volumetrics / Ray Marching

Postby ikam » Thursday, 15.May 2014, 21:36

we also can replace fog color by a texture :p
You do not have the required permissions to view the files attached to this post.
ikam
Operator
Operator
 
Posts: 911
Joined: Friday, 14.October 2011, 13:00
Location: France

Re: Volumetrics / Ray Marching

Postby Skinnytorus » Thursday, 15.May 2014, 21:38

A cool effect. Maybe you should make fog texture animatable?
Skinnytorus
Operator
Operator
 
Posts: 1300
Joined: Monday, 06.February 2012, 17:46


Return to New Feature Suggestions



Who is online

Users browsing this forum: No registered users and 3 guests

cron