syntax / structure of custom mdl shaders ?
I am trying to create a custom shader.
mdl search path etc. is set in DS shader mixer.
But importing the mdl file into shader mixer creates an error in the log file.
Obviously logic and / or syntax in the shader are wrong with respect to DS.
Is there a documentation about how to write custom shaders for DS?
I am trying to understand the rules by reading existing shaders but that takes way to much time by way to much trial and error runs.
My shader trial:
mdl 1.5;
import df::*;
import math::*;
import base::*;
import state::*;
import anno::*;
import daz_3d::property_annotations::*;
material anisotropic_volume(
color absorption = color(1.0),
color scattering = color(1.0),
float directional_bias = 0.0,
uniform color ior = color(1.0))
= material (
ior: ior,
surface: material_surface(
scattering: df::specular_bsdf(
tint: color(1.0),
mode: df::scatter_transmit)),
volume: material_volume(
scattering: df::anisotropic_vdf(directional_bias: directional_bias),
absorption_coefficient: absorption,
scattering_coefficient: scattering));
Error log (edited for better readability):
[WARNING] MDLC comp warn : C:\...\volume.mdl(10,1): C244 unreferenced local material 'material anisotropic_volume' has been removed
[WARNING] MDLC comp warn : C:\...\volume.mdl(10,1): C244 unreferenced local material 'material anisotropic_volume' has been removed
[WARNING] MDLC comp warn : C:\...\volume.mdl(10,1): C244 unreferenced local material 'material anisotropic_volume' has been removed
[INFO] MDLC comp info : Loading module "::daz_3d::volume" from "C:\...\shaders\iray\daz_3d\volume.mdl".
Comments
That looks like a warning that you have declared anisotropic_volume, explicitly or implicitly through one of the inclusions, and it is not actuallyused so the compiler drops it to save resources.
See https://raytracing-docs.nvidia.com/mdl/index.html for the actual, answer, though.
Thanks. The shader code is actually from the mdl handbook, so I assuem it is correct.
The issue is that DS throws an error and does not import the mdl file at all. I assume DS wants additional code in the mdl that is not explained in the mdl handbook. Is there any DS specific documentation available?
... after further reading it seems I need to add an export statement to make the shader public within DS. So not DS specific as I initially thought but general mdl logic.