Volumetric factor for pseudo-volumetric material (Charcoal for Cycles)

In another thread, RickyBlender asked me if it would be possible to use what I showed to make charcoal for Cycles. I googled some images but, in the end, I decided to make something simple to test my node tree. I just dropped some geometry into a hole in the ground, tuned a bit my node tree and here is what I got:


All the “charcoal bits” were rigid bodies that I joined into a single object with a single material. For some reason, I find it the craziest procedural material I’ve ever created for Cycles. :smiley: The principle of the “trick” isn’t new but I had never used it this way.

The node tree:


The magic happens in the “Distance2Fac” node group. It calculates a factor based on the distance from the Center and the Dimensions. And that’s all! :smiley: I use this factor to make the color of the burning bits change from yellow to red thanks to a color ramp. At the same time, this factor is also used in another color ramp to calculate a new factor to switch from the burning material to the non-burning material. Easy as pie! :smiley:

The “Distance2Fac” node group:


Very easy: I subtract the Center from the Vector coordinates and I divide each component by its matching dimension (X, Y, Z) in the “Rescale” node group. Then I use the fastest formula I know to calculate the distance (i.e. the length of the vector): sqrt(dot_product(vector, vector)). Multiplied by 2 and divided by sqrt(2)… We got our factor! :eyebrowlift:

I loved the result so much that the blend file is already at BlendSwap, waiting for them to arrive. :wink: I’ll post the URL as soon as I’ll get it.

EDIT: The blend file has arrived: http://www.blendswap.com/blends/view/69863

there are different type of charcoal fires
and you got one for in the ground camp fire type

now i was thinking more about charcoal in a furnace

here is what i got up to now


in this first one the charcoal piece don’t really have a nice high contrast texture!

in this next one i realy have 2 textures one for the bottom plane
and one for each piece of charcoal

here is sort of lava one


this last one might be the beginning texture for each piece of charcoal
but this can be improve a lot i thnk!

thats where i tought your other nodes set up might give a sort of high contrast muticolor gradient for each piece of charcoal

let me know what you think

for you first post
i like the high contrast yellow to redish

but too widely spread up
need this in some concentrated part of the fire plane at bottom
from grey to redish or black to redish hot

now for the charcoal piece your other node set up might be able to give some nice charcoal pieces


i know not easy to get something more or less photo realist

thanks

The fake volumetric effect indeed looks quite good, even if the charcoal isn’t yet that convincing and are currently just scaled cubes.

The same thing could be done for anything that has heat flowing out of it, I’m willing to guess you could also use math and texture nodes to introduce some randomization in the mask so as to make it really pop.

@Dragon which one are you talking about ?

for my example i did add real cuboid charcoal pieces above a plane

thanks

I’m talking about Kaluura’s example image, your image is, well, let’s just say that your ability to make shading effects could be greatly helped by learning how to use, create, and manipulate vector data.

Another brilliant and educative Kaluura node screenshot filed away. I have to say I really appreciate that you make your screenshots an easily readable size. Some other very nice materials are posted with screenshots that are just below the legibility threshold and you have to guess at the values…

vectors are a lot more difficult to master
hope i can learn a bit more with this one!

happy cycles

@RickyBlender: My charcoal is already cooling down, that’s why it’s so red. :wink:

Any way, everything can be tuned. Grab the file from BlendSwap and play with the color ramps.

As for your “meatballs”, I can do that too.


What I did here is however totally overkill. Since a simple bumpmap didn’t provide enough depth, I used a displace modifier… on each sphere. :smiley: To make the spheres different, I randomized a bit the “Center” so that they are all identical but lit differently. Still, the scene is insanely heavy for a few spheres… altho I didn’t raise the subsurf level higher than 3.

If I had to do it seriously. I’d start from your 3rd sphere (the pinkish one that I like a lot) and I’d use its bump map as factor to drive the 2 color ramps (light color and material switch). If the material is fully procedural, it’s really easy to randomize the noises so that multiple linked copies appear different. (BTW, if you want to show the node tree of the pinkish sphere, nobody would complain.) :wink:

@AceDragon: What?! You don’t like my slightly overcooked french fries? Go to MacDonald’s! :wink:

Any way… If I weren’t so busy burning my fingers with charcoal, I’d explore the randomization part. There are so many possibilities that I almost don’t know where to start. :smiley:

@DruBan: You’re welcome. I really don’t like blurry screenshots of node trees either. What’s the point if you can’t read everything? So, I don’t inflict such horrors to others either.

what about using the other nodes set up the one with all the balls
to make some charcoal pieces from several objects may be like you did on other model

i’ll check file

sorry attachment is not good !

thanks

@RickyBlender: Attachment fixed.

I joined all the spheres in one object… and we’re back to the camp fire.


This time, with overcooked meatballs instead of the french fries. :smiley:

beginning to look very nice this is lookng super hot !

Mcdo does not have that !LOL

can you show the nodes set up for the meatbals and the last pic

i d like to modify some of the charcoals on top to give some % with yellow grey or redish color
and set my own shapes too!
may be use some meatbals around

much better then what i’v seen before

dont’ know where you get your inspiration
but it is good
any tips on that ?

thanks

@RickyBlender: You’re lucky, I didn’t save what I did for the last image but I could restore the last session… So I can do better than posting snapshots.

Second image: Forum Charcoal2.blend (607 KB)

Third image: Forum Charcoal3.blend (1.15 MB)

Have fun! :smiley:

As for where I get my inspiration from, I’d like to know too! I’d plug myself to the source with an I.V. …or wires …or anything! :wink:

your very good with the nodes math
i’m trying to understand on set up which you did i think
and having some difficulties
is it possible to discuss it so i can have a better understanding of the math involve to make it work!

mind you it is not a complicatad one so should be quick i guess

thanks

@RickyBlender: Sure… Show me and I’ll explain… if I can. Sometimes, I just plug, unplug and replug nodes until it works. :wink:

here is file

light_distance.blend (822 KB)

let start with part on the left with camera view distance
i can see square value then 3 groups of subdivide and multiply

i tried to change one of these subdivide and muliply with one node muliply and it does not give same color!
see other object i did in file

may be you can shed some light on this dark matter LOL

by the way do you have any knowledge in scripting cycles noces with group?

thanks for any feedback

@RickyBlender: I don’t want to sound unpleasant but the node tree in your file is the proof of the Shakespeare’s monkeys theory. :wink: Somebody hired an army of monkeys to punch numbers in the node tree until a result happened. Or something like that…

I kinda understand what’s going on in the tree but I don’t understand the numbers. They don’t make sense. Any way…

The goal of the tree is to convert the distance in between the camera and the point of the mesh Cycles is working on into a color. For each R, G and B component, the View Distance is divided by a huge value which give a very dark color… multiplied by a high value to make it super bright… and then mixed with a very dark color to make it more normal. It works but… please! :smiley:

Using the distance squared changes the curve of response. Instead of linear variation, it gives a curve.

What you did makes sense. To convert (x/A) * B into x * (B/A) should work… but it doesn’t in this tree! Nonsensical! So… I set the tree on fire and I planted a new one. :wink:


On the left of the viewport, you see the result of the original node tree and, on the right, what I did. (The colors aren’t exactly the same but it’s just a matter of fixing the color ramp.)

The principle is simple. There’s a little over 50 Blender Units from the camera to behind the red word. Let’s say 60 BU. So, when you divide the View Distance by this value (called Limit in my tree), it gives you a factor from 0 to 1, from the camera to the Limit. We use this factor to drive a color ramp. That’s all. I left the RGB curve but it has no effect. Using the distance squared already produces a curve in the output.

somenone pass me this nightmare !LOL
that’s why i ask you to give me you toughts on it cause it did not make much sense !

i tought why not use the other more smiple function for lightdistance in geometry node !

i could not see why such big numbers where use
but i think now after your comments
you gave it some illogical meaning which is beginning to make sense !LOL

and agree X^2 makes a curvy thing

which could have been done with the power math node

i’ll test your new set up

happy cycles
thanks a lot

now some details here

for the camera data
the view distance
this is for the camera itself not the viewport distance to object i assume here!
what is the difference between this and the geometry distance or lightpath dist node ?

also for big number like that what would the clamp do
limit output to 1 ?

ramp node
is there some sort of a math model for this ramp node ?

that might make a lot more logical sense to it !

thanks