Skip to content

Commit

Permalink
gi/hdGatling: add doubleSidedAsThinWalled render setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pablode committed May 26, 2024
1 parent 4f1d684 commit 47cbb97
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/gi/include/Gi.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ namespace gtl
GiAovId aovId;
bool depthOfField;
bool domeLightCameraVisible;
bool doubleSidedAsThinWalled;
bool filterImportanceSampling;
uint32_t materialCount;
const GiMaterial** materials;
Expand Down
5 changes: 4 additions & 1 deletion src/gi/shaders/rp_main.chit
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ void main()
uint mediumIdx = shadeRayPayloadGetMediumIdx(rayPayload);
bool doubleSided = bool(payload.bitfield & BLAS_PAYLOAD_BITFLAG_IS_DOUBLE_SIDED);

bool thinWalled = doubleSided;
bool thinWalled = false;
#ifdef DOUBLE_SIDED_AS_THIN_WALLED
thinWalled = doubleSided;
#endif
#ifdef IS_THIN_WALLED
if (mdl_thin_walled(shading_state))
{
Expand Down
1 change: 1 addition & 0 deletions src/gi/src/Gi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ namespace gtl
.baseFileName = "rp_main.chit",
.commonParams = commonParams,
.directionalBias = material->directionalBias,
.doubleSidedAsThinWalled = params.doubleSidedAsThinWalled,
.enableSceneTransforms = material->requiresSceneTransforms,
.hasCutoutTransparency = material->hasCutoutTransparency,
.hasVolumeAbsorptionCoeff = material->hasVolumeAbsorptionCoeff,
Expand Down
4 changes: 4 additions & 0 deletions src/gi/src/GlslShaderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ namespace gtl
{
stitcher.appendDefine("SCENE_TRANSFORMS");
}
if (params.doubleSidedAsThinWalled)
{
stitcher.appendDefine("DOUBLE_SIDED_AS_THIN_WALLED");
}

fs::path filePath = m_shaderPath / params.baseFileName;
if (!stitcher.appendSourceFile(filePath))
Expand Down
1 change: 1 addition & 0 deletions src/gi/src/GlslShaderGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ namespace gtl
std::string_view baseFileName;
CommonShaderParams commonParams;
float directionalBias;
bool doubleSidedAsThinWalled;
bool enableSceneTransforms;
bool hasCutoutTransparency;
bool hasVolumeAbsorptionCoeff;
Expand Down
1 change: 1 addition & 0 deletions src/hdGatling/renderDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ HdGatlingRenderDelegate::HdGatlingRenderDelegate(const HdRenderSettingsMap& sett
_settingDescriptors.push_back(HdRenderSettingDescriptor{ "Clipping planes", HdGatlingSettingsTokens->clippingPlanes, VtValue{false} });
_settingDescriptors.push_back(HdRenderSettingDescriptor{ "Medium stack size", HdGatlingSettingsTokens->mediumStackSize, VtValue{0} });
_settingDescriptors.push_back(HdRenderSettingDescriptor{ "Max volume walk length", HdGatlingSettingsTokens->maxVolumeWalkLength, VtValue{7} });
_settingDescriptors.push_back(HdRenderSettingDescriptor{ "Double-sided as thin-walled", HdGatlingSettingsTokens->doubleSidedAsThinWalled, VtValue{false} });

_debugSettingDescriptors.push_back(HdRenderSettingDescriptor{ "Progressive accumulation", HdGatlingSettingsTokens->progressiveAccumulation, VtValue{true} });

Expand Down
1 change: 1 addition & 0 deletions src/hdGatling/renderPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ void HdGatlingRenderPass::_Execute(const HdRenderPassStateSharedPtr& renderPassS
.aovId = aovId,
.depthOfField = _settings.find(HdGatlingSettingsTokens->depthOfField)->second.Get<bool>(),
.domeLightCameraVisible = (domeLightCameraVisibilityValueIt == _settings.end()) || domeLightCameraVisibilityValueIt->second.GetWithDefault<bool>(true),
.doubleSidedAsThinWalled = _settings.find(HdGatlingSettingsTokens->doubleSidedAsThinWalled)->second.Get<bool>(),
.filterImportanceSampling = _settings.find(HdGatlingSettingsTokens->filterImportanceSampling)->second.Get<bool>(),
.materialCount = (uint32_t) materials.size(),
.materials = materials.data(),
Expand Down
1 change: 1 addition & 0 deletions src/hdGatling/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PXR_NAMESPACE_OPEN_SCOPE
((lightIntensityMultiplier, "light-intensity-multiplier")) \
((mediumStackSize, "medium-stack-size")) \
((maxVolumeWalkLength, "max-volume-walk-length")) \
((doubleSidedAsThinWalled, "double-sided-as-thin-walled")) \
((clippingPlanes, "clipping-planes"))

// mtlx node identifier is given by UsdMtlx.
Expand Down

0 comments on commit 47cbb97

Please sign in to comment.