Bug in patch rendering?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/415578/image.jpeg)
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/415583/image.jpeg)
When we set a much higher ratio, the rendering fails.
>> test_hidden_edges(2000)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/415588/image.jpeg)
You may turn the view with the mouse (orbit) to see the other side of the box. It is even worse.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/415593/image.jpeg)
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
0 Kommentare
Antworten (2)
Star Strider
am 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 Kommentare
Star Strider
am 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.
Bruno Luong
am 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 Kommentare
Bruno Luong
am 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.
Siehe auch
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!