Is df::anisotropic_vdf() the Henyey-Greenstein phase function?

Hi,

I have not found any information on the implementation of df::anisotropic_vdf, but I assume it is the HG!? If yes, I should also be able to combine two of the functions to implement a TTHG, correct?
Is there any other option to provide a different scattering phase function?

Thanks, Christian

Yes correct. Alternatively you can use the new fog_vdf which is a more Mie-like scattering.
Combining phase functions should work as well (at least in Iray).

Here are some documentation that might help.

Unfortunately, MDL does not seem to support combining vdfs. I get an error that the multiplication between float and vdf is not defined.

What MDL supports is mixing operators which take arrays of BSDF, EDF or VDF and combine that.

Please have a look through the MDL specifications here https://raytracing-docs.nvidia.com/ and search for these things:

struct vdf_component {
  float weight = 0.0;
  vdf component = vdf();
};

and

vdf normalized_mix(
  vdf_component[<N>] components
);

You want something like this: https://github.com/NVIDIA/OptiX_Apps/blob/master/data/mdl/mixer_normalized.mdl
but instead of BSDFs at the material_surface scattering expression, with VDFs at the material_volume scattering expression.

I don’t have an example mixing VDFs ready and in the end it’s only mixing the anisotropic_vdf() directional_bias values because the absorption and scattering coefficients are part of the material_volume struct itself.
Here’s one without the mixer: https://github.com/NVIDIA/OptiX_Apps/blob/master/data/mdl/vdf_anisotropic.mdl

Now while MDL defines these things, the question remains if the underlying renderer is implementing all that functionality. Most renderers do not handle heterogeneous volume absorption or scattering coefficients either.

Thanks a lot, this is probably what I need. It’s not about heterogeneous volumes, but simply altering the angular distribution by adding two HG-phase functions with different weights.

@droettger already explained the facts quiet well above. Indeed, you will need a specific variant of the mixer, namely the colored one. The following example material works at least with Iray.

export material colored_scattering_volume(
    uniform color absorption = color(0.3, 0.3, 0.3),
    uniform color scattering = color(0.5, 0.5, 0.5),
    uniform float density = 1.0,
    uniform float g_red = -0.8,
    uniform float g_green = 0.0,
    uniform float g_blue = 0.8
) = material (
    surface: material_surface (
        scattering: df::specular_bsdf(mode: df::scatter_reflect_transmit)
    ),
    ior: color(1.0),
    volume: material_volume(
        scattering_coefficient: scattering * density,
        absorption_coefficient: absorption * density,
        scattering: df::color_normalized_mix(
            components: df::color_vdf_component[](
                df::color_vdf_component(
                    component: df::anisotropic_vdf(directional_bias: g_red),
                    weight: color(1.0, 0.0, 0.0)
                ),
                df::color_vdf_component(
                    component: df::anisotropic_vdf(directional_bias: g_green),
                    weight: color(0.0, 1.0, 0.0)
                ),
                df::color_vdf_component(
                    component: df::anisotropic_vdf(directional_bias: g_blue),
                    weight: color(0.0, 0.0, 1.0)
                )
            )
        )
    )
);