Commit 65f44f3 1 parent 05ff0ad commit 65f44f3 Copy full SHA for 65f44f3
File tree 2 files changed +21
-1
lines changed
pxr/imaging/plugin/hdEmbree
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,11 @@ class HdEmbreeMesh final : public HdMesh {
99
99
// / embree state.
100
100
virtual void Finalize (HdRenderParam *renderParam) override ;
101
101
102
+ bool EmbreeMeshIsDoubleSided () const
103
+ {
104
+ return _doubleSided;
105
+ }
106
+
102
107
protected:
103
108
// Initialize the given representation of this Rprim.
104
109
// This is called prior to syncing the prim, the first time the repr
Original file line number Diff line number Diff line change @@ -1660,8 +1660,23 @@ HdEmbreeRenderer::_ComputeLighting(
1660
1660
float vis = _Visibility (position, ls.wI , ls.dist * 0 .99f );
1661
1661
1662
1662
// Add exitant luminance
1663
+ float cosOffNormal = GfDot (ls.wI , normal );
1664
+ if (cosOffNormal < 0 .0f ) {
1665
+ bool doubleSided = false ;
1666
+ HdEmbreeMesh *mesh =
1667
+ dynamic_cast <HdEmbreeMesh*>(prototypeContext->rprim );
1668
+ if (mesh) {
1669
+ doubleSided = mesh->EmbreeMeshIsDoubleSided ();
1670
+ }
1671
+
1672
+ if (doubleSided) {
1673
+ cosOffNormal *= -1 .0f ;
1674
+ } else {
1675
+ cosOffNormal = 0 .0f ;
1676
+ }
1677
+ }
1663
1678
finalColor += ls.Li
1664
- * _DotZeroClip (ls. wI , normal )
1679
+ * cosOffNormal
1665
1680
* brdf
1666
1681
* vis
1667
1682
* ls.invPdfW ;
You can’t perform that action at this time.
0 commit comments