Skip to content

Commit

Permalink
Merge pull request #1464 from zenustech/OptixBSDF
Browse files Browse the repository at this point in the history
Optix bsdf
  • Loading branch information
littlemine authored Oct 12, 2023
2 parents 393f30e + ab207be commit 91a59cb
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 304 deletions.
81 changes: 55 additions & 26 deletions zeno/src/nodes/mtl/ShaderFinalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,36 @@ struct ShaderFinalize : INode {
auto code = em.finalizeCode({
{1, "mat_base"},
{3, "mat_basecolor"},
{1, "mat_metallic"},
{1, "mat_roughness"},
{1, "mat_metallic"},
{3, "mat_metalColor"},
{1, "mat_specular"},
{1, "mat_subsurface"},
{1, "mat_thickness"},
{3, "mat_sssParam"},
{3, "mat_sssColor"},
{1, "mat_specularTint"},
{1, "mat_anisotropic"},
{1, "mat_anisoRotation"},

{1, "mat_subsurface"},
{3, "mat_sssParam"},
{3, "mat_sssColor"},
{1, "mat_scatterDistance"},
{1, "mat_scatterStep"},

{1, "mat_sheen"},
{1, "mat_sheenTint"},

{1, "mat_clearcoat"},
{1, "mat_clearcoatGloss"},
{3, "mat_clearcoatColor"},
{1, "mat_clearcoatRoughness"},
{1, "mat_clearcoatIOR"},

{1, "mat_specTrans"},
{3, "mat_transColor"},
{1, "mat_clarity"},
{3, "mat_transParam"},
{1, "mat_transDepth"},
{1, "mat_ior"},

{1, "mat_flatness"},
{1, "mat_scatterDistance"},
{1, "mat_scatterStep"},
{1, "mat_thin"},
{1, "mat_doubleSide"},
{3, "mat_normal"},
Expand All @@ -61,6 +70,7 @@ struct ShaderFinalize : INode {
{3, "mat_emission"},
{3, "mat_reflectance"},
{1, "mat_opacity"},
{1, "mat_thickness"},

{1, "vol_depth"},
{1, "vol_extinction"},
Expand All @@ -73,27 +83,36 @@ struct ShaderFinalize : INode {
}, {
get_input<IObject>("base", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("basecolor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("metallic", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("roughness", std::make_shared<NumericObject>(float(0.4f))),
get_input<IObject>("metallic", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("metalColor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("specular", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("subsurface", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("thickness", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("sssParam", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("sssColor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("specularTint", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("anisotropic", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("anisoRotation", std::make_shared<NumericObject>(float(0.0f))),

get_input<IObject>("subsurface", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("sssParam", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("sssColor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("scatterDistance", std::make_shared<NumericObject>(float(10000))),
get_input<IObject>("scatterStep", std::make_shared<NumericObject>(float(0))),

get_input<IObject>("sheen", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("sheenTint", std::make_shared<NumericObject>(float(0.5f))),

get_input<IObject>("clearcoat", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("clearcoatGloss", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("clearcoatColor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("clearcoatRoughness", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("clearcoatIOR", std::make_shared<NumericObject>(float(1.5f))),

get_input<IObject>("specTrans", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("transColor", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("clarity", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("transParam", std::make_shared<NumericObject>(vec3f(1.0f))),
get_input<IObject>("transDepth", std::make_shared<NumericObject>(float(1.0f))),
get_input<IObject>("ior", std::make_shared<NumericObject>(float(1.5f))),

get_input<IObject>("flatness", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("scatterDistance", std::make_shared<NumericObject>(float(10000))),
get_input<IObject>("scatterStep", std::make_shared<NumericObject>(float(0))),
get_input<IObject>("thin", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("doubleSide", std::make_shared<NumericObject>(float(0.0f))),
get_input<IObject>("normal", std::make_shared<NumericObject>(vec3f(0, 0, 1))),
Expand All @@ -103,7 +122,8 @@ struct ShaderFinalize : INode {
get_input<IObject>("emission", std::make_shared<NumericObject>(vec3f(0))),
get_input<IObject>("reflectance", std::make_shared<NumericObject>(vec3f(1))),
get_input<IObject>("opacity", std::make_shared<NumericObject>(float(0.0))),

get_input<IObject>("thickness", std::make_shared<NumericObject>(float(0.0f))),

get_input<IObject>("vol_depth", std::make_shared<NumericObject>((float)(99))),
get_input<IObject>("vol_extinction", std::make_shared<NumericObject>(float(1))),
get_input<IObject>("vol_sample_albedo", std::make_shared<NumericObject>(vec3f(0.5))),
Expand Down Expand Up @@ -231,30 +251,37 @@ ZENDEFNODE(ShaderFinalize, {
{
{"float", "base", "1"},
{"vec3f", "basecolor", "1,1,1"},
{"float", "metallic", "0.0"},
{"float", "roughness", "0.4"},
{"float", "metallic", "0.0"},
{"vec3f", "metalColor","1.0,1.0,1.0"},
{"float", "specular", "1.0"},
{"float", "subsurface", "0.0"},
{"float", "thickness", "0.0"},
{"float", "specularTint", "0.0"},
{"float", "anisotropic", "0.0"},
{"float", "anisoRotation", "0.0"},

{"float", "subsurface", "0.0"},
{"enum Fixed Adaptive", "sssRadius", "Fixed"},
{"vec3f", "sssParam", "1.0,1.0,1.0"},
{"vec3f", "sssColor", "1.0,1.0,1.0"},
{"float", "scatterDistance", "10000"},
{"float", "scatterStep", "0"},

{"float", "specularTint", "0.0"},
{"float", "anisotropic", "0.0"},
{"float", "anisoRotation", "0.0"},
{"float", "sheen", "0.0"},
{"float", "sheenTint", "0.0"},

{"float", "clearcoat", "0.0"},
{"float", "clearcoatGloss", "1.0"},
{"vec3f", "clearcoatColor", "1.0,1.0,1.0"},
{"float", "clearcoatRoughness", "0.0"},
{"float", "clearcoatIOR", "1.5"},

{"float", "specTrans", "0.0"},
{"vec3f", "transColor", "1.0,1.0,1.0"},
{"float", "clarity", "0.0"},
{"vec3f", "transParam", "1.0,1.0,1.0"},
{"float", "transDepth", "0.0"},
{"float", "ior", "1.5"},

{"float", "flatness", "0.0"},
{"float", "scatterDistance", "10000"},
{"float", "scatterStep", "0"},
{"float", "thin", "0.0"},
{"float", "doubleSide", "0.0"},
{"vec3f", "normal", "0,0,1"},
Expand All @@ -264,6 +291,8 @@ ZENDEFNODE(ShaderFinalize, {
{"vec3f", "emission", "0,0,0"},
{"vec3f", "reflectance", "1,1,1"},
{"float", "opacity", "0"},
{"float", "thickness", "0.0"},

{"string", "commonCode"},
{"string", "extensionsCode"},
{"string", "mtlid", "Mat1"},
Expand Down
Loading

0 comments on commit 91a59cb

Please sign in to comment.