Tue, 11/30/2021 - 22:07
Forums:
Hello,
I can't toggle anymore between Graphic3d_TOSM_PBR and Graphic3d_TOSM_FRAGMENT by simply changing value Graphic3d_RenderingMode::ShadingModel and updating the view 3d (V3d_View::Redraw() ), has something change between 7.5.0 and 7.6.0 in that regards?
In 7.6.0, if I start my application with Graphic3d_TOSM_PBR active it work, but I can't toggle off Graphic3d_TOSM_PBR. If I start my application with Graphic3d_TOSM_FRAGMENT I can't toggle Graphic3d_TOSM_PBR.
In the attached picture you can see rendering in 7.5.0 (left) and in 7.6.0 (right)
Best regards,
François.
Attachments:
Tue, 11/30/2021 - 22:47
So what are the question / steps to reproduce?
Tue, 11/30/2021 - 22:48
Sorry the question wasn't post initially, now it is.
Tue, 11/30/2021 - 23:01
Ok, I just found what I need to do now, I have to call V3d_View::Update() instead of just V3d_View::Redraw().
Now I can toggle on/off.
Tue, 11/30/2021 - 23:14
V3d_View::Update() is for handling a legacy V3d_View::ComputedMode() - it should be irrelevant to shading model changes and V3d_View::Redraw() should be enough. So observed disparity looks weird and unexpected. I guess you are setting Shading Model to V3d_View::SetShadingModel()?
Wed, 12/01/2021 - 22:38
You're right, V3d_View::Redraw() is enough if done properly!
What I was doing (and it was working in 7.5.0) was:
1. first getting Graphic3d_RenderingParams from the V3d_View
2. use V3d_View::SetShadingModel()
3. update rendering params and settings them back V3d_View::ChangeRenderingParams()=newParams;
4. V3d_View::Redraw()
I notice that Graphic3d_RenderingParams also has information about the ShadingModel so I guess the change wasn't applied.
Now I reordered the steps and everything is working:
1. use V3d_View::SetShadingModel()
2. getting Graphic3d_RenderingParams from the V3d_View (with the updated Graphic3d_RenderingParams::ShadingModel)
3. update rendering params and settings them back V3d_View::ChangeRenderingParams()=newParams;
4. V3d_View::Redraw()
Thanks,
François.
Wed, 12/01/2021 - 23:20
I see now how it might become wrong. Indeed, in OCCT 7.6.0 shading model has been moved to Graphic3d_RenderingParams::ShadingModel property, so that V3d_View::SetShadingModel() setter has been preserved for backward compatibility.
As you already modify Graphic3d_RenderingParams, it is better setting shading model there to avoid ambiguity in logic.
Thu, 12/02/2021 - 00:08
In that case I needed to call V3d_View::Update() to make it work.
Thu, 12/02/2021 - 11:39
Why is that? Instead of
1. use V3d_View::SetShadingModel()
2. getting Graphic3d_RenderingParams from the V3d_View (with the updated Graphic3d_RenderingParams::ShadingModel)
3. update rendering params and settings them back V3d_View::ChangeRenderingParams()=newParams;
4. V3d_View::Redraw()
Just do
1. getting Graphic3d_RenderingParams from the V3d_View
2. set Graphic3d_RenderingParams::ShadingModel to required state
3. update other rendering params and settings them back V3d_View::ChangeRenderingParams()=newParams;
4. V3d_View::Redraw()
That would be exactly the same thing as V3d_View::SetShadingModel() does - there is no extra logic in it, just changing a single field Graphic3d_RenderingParams::ShadingModel:
I don't know why you prefer making a copy of entire structure Graphic3d_RenderingParams in your code - you may just take a reference V3d_View::ChangeRenderingParams() from the beginning to avoid mistakes.
Thu, 12/02/2021 - 16:34
You're right, by using Graphic3d_RenderingParams a along and just using redraw it is working.
Thanks for all the clarification Kirill,
François.