AB4D Forum
Problem with PBR rendering and shadows - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.DXEngine (https://forum.ab4d.com/forumdisplay.php?fid=11)
+--- Thread: Problem with PBR rendering and shadows (/showthread.php?tid=4173)



Problem with PBR rendering and shadows - mange - 02-17-2020

I have problems getting shadows to work together with physically based rendering.
When a physically based material is set on an object in a scene that uses variance shadow rendering the whole object in rendered as if it were in shadow, even if it is not. See attached pictures which illustrates the problem.
[attachment=146]
[attachment=147]

The problem can be reproduced by setting a PBR material in method "CreateCustomScene()" in the file "ShadowRenderingSample.xaml.cs" that is part of the "Ab3d.DXEngine.Wpf.Samples" project:
Code:
           var physicallyBasedMaterial = new PhysicallyBasedMaterial();
           physicallyBasedMaterial.BaseColor = Color4.White;
           physicallyBasedMaterial.Roughness = 0.0f;
           physicallyBasedMaterial.Metalness = 0.0f;
           var wpfMaterial = new DiffuseMaterial(Brushes.White);
           wpfMaterial.SetUsedDXMaterial(physicallyBasedMaterial);

           var grayCylinder = new CylinderVisual3D();
           grayCylinder.BottomCenterPosition = new Point3D(200, 0, 100);
           grayCylinder.Radius = 20;
           grayCylinder.Height = 100;
           grayCylinder.Material = wpfMaterial;// new DiffuseMaterial(Brushes.LightGray);


Am I missing something here to get shadows and PBR materials to work together (they do work fine on their own), or is this a bug?

I also did a quick test with planar shadows, where I used a PBR material on the shadow plane, but I did not get that to work either. However, in that case the shadow plane seemed to not be rendered at all, instead of beeing rendered in complete shadow.


RE: Problem with PBR rendering and shadows - abenedik - 02-18-2020

Thank you for reporting this problem. I was able to reproduce it.

Some initial tests show that the problem is probably related to invalid PBR pixel shader that is used for rendering PBR with shadows. I will do some additional tests tomorrow and will then try to provide you with a fix for the problem.


RE: Problem with PBR rendering and shadows - abenedik - 02-18-2020

The reason for this problem was that an invalid pixel shader was compiled into the commercial version. This will be fixed with the next version of the DXEngine.

I have sent the author of this forum thread instructions on how to use a workaround. If you also would need to show shadows with PBR materials please contact support or send me a PM to also get the same instructions.