Bug in patch rendering?

7 views (last 30 days)
Luc Masset
Luc Masset on 16 Nov 2020
Commented: Star Strider on 17 Nov 2020
Hello,
I came across a problem when rendering small patch objects drawn against huge ones within the same axes. In my app I use a patch object to draw the terrain (imported from a DEM file) as a mesh. The terrain is usually 50 kms wide with square/triangle elements of 25 meters. I also use a patch to display buildings as rectangular blocks that lie on the terrain. The buildings actual size are in meters or tens of meters at max.
When the user zooms on a particular buillding, the are some rendering bugs, especially hidden edges that are actually displayed (edges that lie under the terrain, edges from the opposite sides of the buildings).
This bug seems to come from the fact that we have a very large patch and very small ones on the same axes. I have written a small function to illustrate the problem (see attachment).
The function draws on the same axes a surf (the peaks function) and a simple box on top of it with a ratio given as argument of the function. If the ratio is small, the rendering is ok.
>> test_hidden_edges(100)
When we set a much higher ratio, the rendering fails.
>> test_hidden_edges(2000)
You may turn the view with the mouse (orbit) to see the other side of the box. It is even worse.
Under Matlab R2009b, these rendering problems were not present. Now I use Matlab R2017b. I guess the rendering engine (HG2), started with Matlab R2014, causes these issues.
Is there a solution to this?
Thank you in advance.
Luc

Answers (2)

Star Strider
Star Strider on 16 Nov 2020
If you do not need the edge lines to be displayed, 'EdgeColor','none' will eliminate all of them in the specific patch call that includes it.
  2 Comments
Luc Masset
Luc Masset on 17 Nov 2020
I need the edges. It renders the graphics much more clearer than without edges. Especially when buildings are complex such as STL models, for which you can see the doors, the windows etc
Star Strider
Star Strider on 17 Nov 2020
It may be that you want more precision than th patch function provides. It would be best for you to Contact Support and tell them abouit this. Include the URL to this thread in your message so that you do not have to repeat everything.

Sign in to comment.


Bruno Luong
Bruno Luong on 16 Nov 2020
I wouldn't call it a bug, it is just a poorer precision of rendering, wharever causes it (possibly quantification of calculation at some stage of the rendering).
It seems unrelated to opengl hardware/woftware. Using rendering painters method is horrible.
  2 Comments
Luc Masset
Luc Masset on 17 Nov 2020
That's true. Painters renderer is even worse in this case from a rendering quality point of view, but also it is so slow! And I need to be able to zoom/rotate/pan the view as fast as possible.
I must disagree with you. Not displaying the hidden parts of a model correctly is a bug to me. And it is very annoying. I thought than OpenGL was a mature rendering engine so that such a bug was not possible.
Does Mathworks team is aware of these graphic errors? And are these errors reproductible on other versions of Matlab? On my side, I have tested on 3 different computers with different graphic adapters and the error is exactly the same. I have also tried many settings such as opengl software, lighting none/flat/gouraud, etc etc With no luck.
Bruno Luong
Bruno Luong on 17 Nov 2020
I run 2020b and yes it's there.
I guess if you want to make sure they are aware you must fire a bug report.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!