Skip to content
Permalink
Browse files

Expose shadow terminator correction factor

  • Loading branch information
Mango-3 authored and dictoon committed Nov 18, 2019
1 parent 3d903b4 commit 778ac37ad580ccf8eeec2d29211a73398b78658b
@@ -128,6 +128,8 @@ def buildBody(self, nodeName):
self.addControl('asSubsurfaceSet', label='SSS Set')
self.addSeparator()
self.addControl('asIsPhotonTarget', label='SPPM Photon Target')
self.addSeparator()
self.addControl('asShadowTerminatorCorrection', label='Shadow Terminator Fix')
self.endLayout()

self.beginLayout('Export', collapse=1)
@@ -136,15 +138,6 @@ def buildBody(self, nodeName):
self.addControl('asSmoothTangents', label='Smooth Tangents')
self.endLayout()

"""
# Ray bias isn't working as expected yet, disable it for now.
self.beginLayout('Advanced', collapse=1)
self.addControl('asRayBiasMethod', label='Ray Bias Method')
self.addSeparator()
self.addControl('asRayBiasDistance', label='Ray Bias Distance')
self.endLayout()
"""

self.endLayout()

elif self.thisNode.type() == 'shadingEngine':
@@ -162,6 +162,10 @@ void ShapeExporter::createObjectInstance(const MString& objectName)
bool isPhotonTarget = false;
if (AttributeUtils::get(node(), "asIsPhotonTarget", isPhotonTarget))
params.insert("photon_target", isPhotonTarget);

float shadowTerminatorCorrection = 0.0f;
if (AttributeUtils::get(node(), "asShadowTerminatorCorrection", shadowTerminatorCorrection))
params.insert("shadow_terminator_correction", shadowTerminatorCorrection);
}

m_objectInstance.reset(
@@ -176,6 +176,21 @@ namespace
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

attr = createNumericAttribute<float>(
numAttrFn,
"asShadowTerminatorCorrection",
"asShadowTerminatorCorrection",
MFnNumericData::kFloat,
0.0f,
status);
numAttrFn.setSoftMin(0.0f);
numAttrFn.setSoftMax(0.5f);
numAttrFn.setMin(0.0f);
numAttrFn.setMax(0.5f);
numAttrFn.setKeyable(true);
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

MFnTypedAttribute typedAttrFn;
attr = typedAttrFn.create("asSubsurfaceSet", "asSubsurfaceSet", MFnData::kString);
AttributeUtils::makeInput(typedAttrFn);
@@ -211,32 +226,6 @@ namespace
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

MFnEnumAttribute enumAttrFn;
attr = enumAttrFn.create(
"asRayBiasMethod",
"asRayBiasMethod",
0);
enumAttrFn.addField("None", 0);
enumAttrFn.addField("Normal", 1);
enumAttrFn.addField("Incoming Direction", 2);
enumAttrFn.addField("Outgoing Direction", 3);
enumAttrFn.setKeyable(false);
AttributeUtils::makeInput(enumAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

attr = createNumericAttribute<double>(
numAttrFn,
"asRayBiasDistance",
"asRayBiasDistance",
MFnNumericData::kDouble,
0.0,
status);
numAttrFn.setSoftMin(0.0);
numAttrFn.setSoftMax(1.0);
numAttrFn.setKeyable(true);
AttributeUtils::makeInput(numAttrFn);
modifier.addExtensionAttribute(nodeClass, attr);

addVisibilityExtensionAttributes(nodeClass, modifier);
modifier.doIt();
}

0 comments on commit 778ac37

Please sign in to comment.
You can’t perform that action at this time.