Skip to content

Commit

Permalink
Use polygon offset instead of fixed shadow bias gives better result
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 31, 2022
1 parent 15d48a1 commit 6cb2f64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/3d/qgsshadowrenderingframegraph.cpp
Expand Up @@ -146,6 +146,11 @@ Qt3DRender::QFrameGraphNode *QgsShadowRenderingFrameGraph::constructShadowRender
shadowCullFace->setMode( Qt3DRender::QCullFace::CullingMode::Front );
mShadowRenderStateSet->addRenderState( shadowCullFace );

Qt3DRender::QPolygonOffset *polygonOffset = new Qt3DRender::QPolygonOffset;
polygonOffset->setDepthSteps( 4.0 );
polygonOffset->setScaleFactor( 1.1 );
mShadowRenderStateSet->addRenderState( polygonOffset );

return mLightCameraSelectorShadowPass;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ui/3d/shadowrenderingsettingswidget.ui
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<width>482</width>
<height>139</height>
</rect>
</property>
Expand Down Expand Up @@ -60,7 +60,7 @@
<double>0.000010000000000</double>
</property>
<property name="value">
<double>0.000010000000000</double>
<double>0.000000000000000</double>
</property>
</widget>
</item>
Expand Down

0 comments on commit 6cb2f64

Please sign in to comment.