[Bf-cycles] Need help with shaders

Kel M kelvinshrek at gmail.com
Fri Sep 30 19:40:01 CEST 2011

You_are_awesome. :D I have uploaded your volume patch to graphicall
anywhere. They're going to love it! :D
*"*Great, i need to rewrite that stupid volume_bsdf_diffuse node in proper

way. But cannot resist, I got first Suzanne head that resemble marble so
that is half-working patch.

Please don't even look inside, it just pile of #ifdefs that can eat cats
or worse!

Don't SAVE your scene with that patch, it have nodes ID that surely be
rewriten in next revision and screw you precious data!

I am not kidding, dont even mind compile it and put on something
asgraphicall.org, too risky to lose data.

Apply patch, compile as usual, run.

Assign "Volume BSDF"  to Environment volume slot, double check it have F
= 0.

Create some closed mesh, assign Transparent as Surface shader, set Color
0 (object disappear).

Assign "Volume BSDF to mesh Volume shader slot. Assign Color to 1, or
close to 1. Try to change F. For now i use folmula that Density mean
attenuation at volume with M_E/10 thickness. Use 1 for fun real
moon-like shader, use 0.95 for marble-like, etc.

Insert Environment volume slot with "Volume BSDF". Not proper Brecht
"Transparent Volume" or "Isotropic Volume", use my half arsed variant
named "Volume BSDF". Other nodes just dont work. I still not understand
how to assign default volume, so you must do it every time! If you do
not assign it to Environment Volume input you get cool gray blinking
horizontal bands, it is feature, not bug ^^.

My "Volume BSDF" have 3 input, Color, F, g.

Color work almost as usual diffuse-like nodes, it attenuate light after
ray hit particle.

F and g in theory are parameters of "double peak Henyey-Greenstein"
phase function. In short, g = 0 mean diffuse, g = 1 - tiny singular ray,
F control what half sphere will prevail, 0 mean uniform sphere, -1 mean
strong backward reflection, 1 strong forward. For Water partcle it
(F=-0.9, g =0.9).

But for now i just use F as density parameter too , so forget what you
read. It will work after i rewrite node using Brecht template and switch
to single peak Henyey-Greenstein, unfortunately nodes support only 2
additional data streams.

After you play with small meshes, try use hardcore Environment volume
for god rays etc. Beware, it slow as molasses.

Try something like F = 0.01, Color =1 g = 0, or even less F. Use local
light source, background so far, at infinity, it always be absorbed by
shader with any F greater then 0.

Known Bugs:

Cannot assign default Volume slot, every time do it by hand.

Only 1 level of inclusion supported, pure glass bottle will work, glass
bottle on fog street, but air bubble inside glass do not. Need stack of
media_shader, i have problem with proper implementation.

Suzanne have 2 black circles around eyes, some epsilon problem? Looks
cool with marble-like hi density shader. Cannot find solution for weeks.

Water like particles ( clouds) require insane ammount of multiple
scattering to look good, i doubt we can workaround it. Just w8 another
CPU generation, 20+GHZ, 20000 cores, etc.

Awful code style, comments etc, it just dump of WIP just for fun, not
for inclusion in trunk.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-cycles/attachments/20110930/5fd8cdb3/attachment.htm 

More information about the Bf-cycles mailing list