10-26-2021, 10:16 AM
Hi,
I've ran into an issue while rendering non-convex transparent object. Some triangles were wrongly shaded as shown in the attached image. The model is also attached (it's an fbx wrapped in zip, since fbx was not allowed to be uploaded). and it's an approximation of a glass. To achieve this in the PBR model viewer demo, it is enough to manually set the color to some semitransparent and set HasTransparency in the method UpdateMaterials.
I think the issue is in the order the triangles are drawn (some tringles in front are drawn first and then the ones in the back). It can be solved by splitting this concave shape into two convex shapes with different materials. Does DXEngine provide some triangle sorting (per-mesh) based on the distance from camera (there is at least for different meshes).
I've thought about drawing the objects in the transparent queue to depth buffer first and then write only the pixels that pass depth test equal (basically only the first triangles visible). But I had no idea how to set this up. The closest I've got is to get the current Depth/Stencil buffer - MainDXViewportView.DXScene.DXDevice.ImmediateContextStatesManager.DepthStencilState.
Thank you.
Best regards,
Janovsky Roman
I've ran into an issue while rendering non-convex transparent object. Some triangles were wrongly shaded as shown in the attached image. The model is also attached (it's an fbx wrapped in zip, since fbx was not allowed to be uploaded). and it's an approximation of a glass. To achieve this in the PBR model viewer demo, it is enough to manually set the color to some semitransparent and set HasTransparency in the method UpdateMaterials.
I think the issue is in the order the triangles are drawn (some tringles in front are drawn first and then the ones in the back). It can be solved by splitting this concave shape into two convex shapes with different materials. Does DXEngine provide some triangle sorting (per-mesh) based on the distance from camera (there is at least for different meshes).
I've thought about drawing the objects in the transparent queue to depth buffer first and then write only the pixels that pass depth test equal (basically only the first triangles visible). But I had no idea how to set this up. The closest I've got is to get the current Depth/Stencil buffer - MainDXViewportView.DXScene.DXDevice.ImmediateContextStatesManager.DepthStencilState.
Thank you.
Best regards,
Janovsky Roman