Transparent depth for Cycles Volumetrics
Hello!
I’ve been a little disappointed that cycles can’t currently create realistic clouds like rendering engines such as Arnold can (see link: docs.arnoldrenderer.com/display/A5AFMUG/Rendering+a+Cloud ).
Cycles’ volume rendering engine is already pretty decent, but it simply doesn’t have the same capabilities as a rendering engine like Arnold in the volumetric department.
I propose that a transparent depth parameter be added to the volume scattering and principled volume nodes.
It would be INCREDIBLY simple, here’s all that needs to be done:
in Blender 3.0\3.0\scripts\addons\cycles\source\kernel\closure\volume.h:
in the volume extinction function:
/* VOLUME EXTINCTION */
ccl_device void volume_extinction_setup(ccl_private ShaderData *sd, float3 weight)
{
if (sd->flag & SD_EXTINCTION)
{
sd->closure_transparent_extinction +=
weight;
} else {
sd->flag |= SD_EXTINCTION;
sd->closure_transparent_extinction = weight;
}
}
replace it with this function:
/* VOLUME EXTINCTION */
ccl_device void volume_extinction_setup(ccl_private ShaderData *sd, float3 weight, float transparentDepth)
{
if (sd->flag & SD_EXTINCTION)
{
sd->closure_transparent_extinction +=
weight/transparentDepth;
} else {
sd->flag |= SD_EXTINCTION;
sd->closure_transparent_extinction = weight/transparentDepth;
}
}
and obviously, update the references, and also add a transparent depth parameter to the cycles volume scatter node and the principled volume node, which theoretically should be no more than a few minutes of work that would help me and probably hundreds of other artists create more realistic volumetric materials.
6 Comments
Hi ! It's awosome ! Is it possible to modify the files manually? It looks easy enough for the volume.h file but not so mutch for the node_scatter_volume.oso . (I don't know/understand how those file work together)
If you are proposing a code change, maybe devtalk.blender.org would be a better place.
Wow yeah looking at that tutorial this transparent depth gives it a totally more believable look.
To be clear, currently cycles volume density is constant throughout, while this change means that density would ramp up from zero at the boundary to full density over a user-specified distance?
no, the density itself wouldn't change, transparent depth is basically just how much material it takes for the full diffuse color of the volume to be realized
ah, gotcha.