Change cullmode
The Physically Based Rendering effect does not seem to cull backfacing triangles and I would like to enable that.
In the examples ContextStatesManager.SetRasterizerState() is used in custom effects to set the cull mode. 
Is there a way to change the cull mode for an already existing effect?
You are right - culling is disabled when rendering PBR effect. This is not correct.

I will try to fix that tomorrow and prepare a pre-release version for you.

It is also possible to fix that with the current version - you need to use OverrideRasterizerState on the RenderObjectsRenderingStep.

If you are rendering only PBR objects, then you can easily fix that with the following:

DXScene.DefaultRenderObjectsRenderingStep.OverrideRasterizerState = DXScene.DXScene.DXDevice.CommonStates.CullCounterClockwise; // Or use CullClockwise

If you are also rendering objects that require other types of culling, then you would need to create a new RenderObjectsRenderingStep - one with overridden culling and one without. Then you would need to either use FilterRenderingQueuesFunction or FilterObjectsFunction on the RenderObjectsRenderingStep to define which objects are rendered with each RenderObjectsRenderingStep. This is slightly more complicated but DXEngine is flexible enough so it is also possible to achieve that. If you will try to do that and will have any problems, please contact me for more details.
Andrej Benedik

Forum Jump:

Users browsing this thread:
1 Guest(s)