Fixing Anisotropy for overlapping volumes in Cycles

I’m new to this, not familiar with the blender codebase, but hoping I can get some help here. This issue has been plaguing me and a ton of my peers forever now, and it really needs to get solved, so I’m finally taking it into my own hands. It’s how cycles handles the phase functions of volume scattering when there are overlapping volumes, example:

The cube with the dense volume and high anisotropy completely glitches out as the phase function of the light gets set to match the phase function of the less dense volume.

I’ve successfully compiled blender, I’ve isolated the section of code which I believe to be the issue, here it is:

(volume_shader.h in the cycles kernel integrator)

Someone already commented a reference to this issue at the bottom (I believe). This is not an uncommon issue despite what the comment says, the most common usage for volumetrics is for atmospheres, and if you place a volumetric object in your scene, be it a cloud, explosion, dust, etc. it starts behaving unpredictably.

I’m eager to tackle this myself if necessary, but this is also a cry for help because I honestly do not know my way around c++. It seems to be a simple fix, but still a bit daunting. I hope to at least get some eyes towards this. fixing this is integral to many peoples’ workflows. Right now we can’t even put volumetric clouds in the sky without issue.


Replying here with a few examples from my work that illustrate my point:

^ This is a nice fluffy cloud

If I add in an atmosphere volume, one of two things happen, either 1. The cloud adopts the anisotropy of the atmosphere, demonstrated here:

notice how the look completely changed

Or 2. the atmosphere volume adopts the anisotropy of the cloud, example:

the atmosphere creates a slight halo around the clouds, this isn’t particularly noticeable in this one, but only because I took pains to hide it, and despite that, it’s still there.

it makes doing shots like this challenging.

I took a stab at fixing this yesterday, but it seems like this is firmly out of my skillset. I’m going to keep trying, but I’m willing to put a bounty on this issue because I’d really like this stuff to just work yknow.

Edit: I originally intended for this to be something I take a stab at fixing, but since I’ve now realized that’s probably out of my depth, I’m moving this post over to rightclickselect as that seems like a more appropriate forum for this.