Bug in patch rendering?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Star Strider
2020-11-16
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 个评论
Star Strider
2020-11-17
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
2020-11-16
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 个评论
Bruno Luong
2020-11-17
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!