Variable translucency/absorbtion using volume fields?

   1632   2   1
User Avatar
Member
33 posts
Joined: Aug. 2014
Offline
I'm trying to work out a way (in Mantra) to render absorbtion as a volumetric effect, rather than a uniform value throughout a refractive object. Think red wine, inks, non-milky tea, etc. (high absorbtion, near-zero scattering fluids) being poured into water.

The closest I've come is by rendering a separate fog object, with a standard “cloud” shader attached, disconnecting the Surface Color and BSDF outputs so that it only shades opacity. I *think* that should be equivalent of how absorbtion normally works - light blocked by density over distance?

It seems to work great, if and only if I want to render black ink. The problem is, if I attempt to tint the Surface Opacity output of the volume shader in any way, any refraction rays inside the refractive object will only ever sample the overall luminance of opacity through the volume, not the individual channels, and still render the result monochrome.

I've tried turning on the Enable Absorbtion flag in Mantra, incase that was stopping it sampling RGB opacity, but that does nothing.


I could presumably just run the whole render three times with different volume densities, and composite the result, but it'd be much nicer to just get it working in-render somehow.

Any thoughts?
Edited by VortexVFX - Aug. 4, 2020 17:52:29
Dan Wood
Vortex VFX Ltd
User Avatar
Member
7796 posts
Joined: Sept. 2011
Online
VortexVFX
The closest I've come is by rendering a separate fog object, with a standard “cloud” shader attached, disconnecting the Surface Color and BSDF outputs so that it only shades opacity. I *think* that should be equivalent of how absorbtion normally works - light blocked by density over distance?

This should work, bummer that it's broken I guess.

I checked it in karma, and although it's not monochrome, the participating media samples very poorly for what should be a trivial affair.

I think only Arnold handles this correctly at this time.
User Avatar
Member
33 posts
Joined: Aug. 2014
Offline
Yes, far from ideal. Seems an odd oversight considering there's specifically support for refraction dispersion.

Well, I tried out the brute-force compositing approach - rendering a separate render with different density multipliers for each RGB channel… and it works really well. Just takes some time rendering a wedge of different test densities, and swapping them in and out of each channel in comp to home in on the right absorbtion colour.

I tried it at first just rendering a full-density and a clean no-volumetrics, and blending between the two in comp for each channel, but of course, that clips horribly when fully-opaque areas are blended in, and bears no resemblance to physically correct density values.
Dan Wood
Vortex VFX Ltd
  • Quick Links