-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solid edges drawn with glitches #379
Comments
Cannot reproduce. Which renderer is this? |
How I could detect which? |
|
Renderer: Gallium 0.4 on ATI RS600 BTW, I has no such glitches with solid edges (style Sems like in latest SolveSpace faces partially overlap solid edges. Think, need render solid edges as top layer (on top of all faces). |
ATI RS600 is not a supported video card because it does not provide OpenGL 3.0. Glitches are expected. I will reopen this if it can be reproduced on an OpenGL 3 capable card. |
But I has NO such glitches with SolveSpace |
Fixing a bug that hits everyone is more important than fixing a glitch that hits exactly one person with a 13 year old video card that doesn't support OpenGL 3. As I've told you before, SolveSpace should not actually run on it at all. The fact that it does start is a bug (in GTK or Mesa). |
I can confirm this bug also happens for me:
I believe Symban9 is correct in that it is caused by z-fighting between the lines and the invisible faces that are drawn to hide the back-edges. The usual solution to this problem is to use |
Thanks! I will look into it. There is our own implementation of Z-offset that shouldn't cause this, let me write a patch. |
Hm, this should already be done here: https://github.com/solvespace/solvespace/blob/master/src/groupmesh.cpp#L574-L576. But this ends up manipulating |
Please, always check my bug reports deeply. All bugs should be fixed, if possible. |
That implementation is equivalent to using The solution I've come up with, is to apply P.S. the lines are also drawn with glitches when I change the outside to be solid. |
@bcmpinc Do you think you can implement this? |
That shouldn't be problem, though I'm not sure that it will entirely fix this issue nor introduce other rendering bugs. I had already tried to implement a fix, but it didn't work, though I don't remember why. |
I've come up with the following patch, but as you can see in the image below, the offset is not high enough to render properly on cylinders, yet it already causes the red back faces to bleed through. diff --git a/src/render/rendergl3.cpp b/src/render/rendergl3.cpp
index 167ce03..7c786bf 100644
--- a/src/render/rendergl3.cpp
+++ b/src/render/rendergl3.cpp
@@ -886,11 +886,18 @@ public:
}
void Draw(OpenGl3Renderer *renderer) override {
+ // A hackish way to partially solve issues #377 and #379 simultaneously.
+ if (SS.GW.showEdges || SS.GW.showOutlines || SS.GW.showMesh) {
+ glEnable(GL_POLYGON_OFFSET_FILL);
+ // glPolygonOffset(a,b) offsets zdepth by a*fwidth + b
+ glPolygonOffset(SS.GW.showOutlines ? 2.0 : 1.0, 1.0);
+ }
glEnable(GL_CULL_FACE);
if(hasFillBack)
DrawFace(renderer, GL_BACK, fillBack);
DrawFace(renderer, GL_FRONT, fillFront);
glDisable(GL_CULL_FACE);
+ glDisable(GL_POLYGON_OFFSET_FILL);
}
void Remove(OpenGl3Renderer *renderer) override { |
@bcmpinc Yeah, I've had a few attempts to fix it with pretty much the same result as yours. Seems like an annoying problem. |
Yeah. There's some other solutions I can think of, though none of them that I really like to pick up. For example:
|
System information
SolveSpace version: 3.0~83a0a517
Operating system: Debian 9.x Stretch
Expected behavior
All solid edges should be rendered correctly
Actual behavior
Some edges drawm with glitches.
On screenshot, edges with glitches marked by yellow oval, normally rendered edges marked by green oval. All those edges are parallel.
Additional information
The text was updated successfully, but these errors were encountered: