There are two kinds of paths drawn using the OpenGL renderer:
The default pen is thin(), which has line width exactly one "virtual" pixel. Unfortunately when you start using render != 1, you get more than one "virtual" pixel per "actual" pixel (for antialiasing), which means your black lines fade to gray and get really hard to see.
For any line width other than thin(), what's actually drawn is not a path but a tube. This is not the default because it's slower to render and also can have the sort of issues you describe in your next post.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The default pen is thin(), which has line width exactly one "virtual" pixel. Unfortunately when you start using render != 1, you get more than one "virtual" pixel per "actual" pixel (for antialiasing), which means your black lines fade to gray and get really hard to see.
I just follow the advice, and did the following things:
For any line width other than thin(), what's actually drawn is not a path but a tube. This is not the default because it's slower to render and also can have the sort of issues you describe in your next post.
So, as you suggested, I should use the "thin()", thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The error suggests that the MSDOS utility convert is being used instead of
the one that comes with ImageMagick; you can specify a path to the correct convert program
in your config file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, any workaround about this issue? I'm thinking to scale the cylinder and circle a bit, but I'm not sure what is the radius of the tube line? It looks like I need to reduce the radius of the cylinder by the radius of the tube. And reduce the height of the cylinder by 2 times of the tube's radius.
All you need to do is use a higher value of settings.render (for example, 4). This is the number of pixels per bp. You can avoid such rendering issues by producing vector graphics (PRC) output and embedding that in a pdf file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, with higher value of settings.render = 8, I get such result. (see in attachment)
You see that all the skeleton lines of the cylinder get lost.
You can avoid such rendering issues by producing vector graphics (PRC) output and embedding that in a pdf file.
I does not have adobe reader install on my computer. But my image will finally embeded into exam or papers, I don't think PRC can solve my issue, because they will be printed to paper material。
When the thin enabled for darwing the 3D line, I think opengl use glLineWidth(1); or similar code is used to draw the 3D line, am I right? I just looked the asymptote's source code, but I can't find how a 3D line with it's linewidth=0 is draw by OpenGL.
Then, I would suggest if we could have an option for glLineWidth(2); or even bigger value, because this make all the 3D line have unique width shown on the screen.
Any good ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If that is possible, I think my feature request: Is there a simple way to draw hidden line as dotted line can also be implemented, because OpenGL natived support this kind of drawings.
Most of the 3D modeling software use the dotted line to show some hidden geometry.
Last edit: ollydbg 2016-05-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I guess this is the way OpenGL draw a one pixel line. So, is it possible to add an option to adjust the glLineWidth - OpenGL 4 Reference Pages function?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just disabled the drawing of surface, and when render=1, I see that the default thin gives the expected result(I get the screen shot from OpenGL viewer).
But if I draw the surface, I get such bad image(also I get the screen shot from OpenGL viewer)
So, I think a wider unique witdh line is need here.
Only width 1 is guaranteed to be supported; others depend on the implementation.
So we are forced to implement thick lines as tubes.
This is what you get when you specify
frontpen=black+0.5mm.
The result is correctly drawn (remembering as Charles pointed out that thick lines are really tubes
so you can only see half of the back tube).
In OpenGL a linewidth of 0 forces a line that is always one pixel wide, which can be hard to see.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible at least add an option to tweak the glLineWidth? Though it is 100% supported, but this feature is good for technical drawing rendering output.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just use the FreeCAD(a multi-platform free and opensource 3D CAD software) to create a cylinder object, and see the image shot below.
There are five cylinders, and from left to right, I can set the line width from 1 to 5. This gives quite nice sketch output. I'm using FreeCAD in a very old PC on WinXP which I brought in year 2008. So, I think most OpenGL implementation has support such nice feature.
Our reasoning in implementing tubes rather than relying on OpenGL is that for linewidths greater
than the hardware limit (which could be 1 on some systems; we don't know), tubes are required.
So now that tubes are implemented why not use them always? Are you perhaps concerned about file size? That is the only difference I can think of.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Our reasoning in implementing tubes rather than relying on OpenGL is that for linewidths greater than the hardware limit (which could be 1 on some systems; we don't know), tubes are required. So now that tubes are implemented why not use them always?
The reason is that the tubes are shown badly if the tube line intersect with a face. I have another post stating this issue, see: https://sourceforge.net/p/asymptote/discussion/409349/thread/1946c31a/#3998, half of the line is hidden by the surface, then the generated image doesn't have equal width lines. That's not good for book or technique drawing. Charles Staats helped me a lot in that thread, but it is still hard to implement a good expected result.
Well, with the native opengl line, we can simply get the expected result. Another thing is that the opengl native lines don't have the projection effect(I mean they don't get smaller when they are far from the camera), so I can achieve the equal width lines similar like in our render=0 condition.
An extra feature reqeust, which some users expect is the dotted hidden line, this can also be done in OpenGL, I have posted another thread here:Is there a simple way to draw hidden line as dotted line. This can show hidden geometry without using transparent surfaces. I think transparent surfaces are not quite good to used in a printed paper or books.
Here is the test code:
Here is the screen shot:
This does not happens when I use the render=0 option in non OpenGL mode.
Any reasons?
I have looked at the code of solids.asy:
What does the code snippet:
means?
In my test code, the value "red+linewidth(defaultpen)" is assign to the argument "pen frontpen=currentpen", am I right? Thanks.
Last edit: ollydbg 2016-05-12
There are two kinds of paths drawn using the OpenGL renderer:
thin()
, which has line width exactly one "virtual" pixel. Unfortunately when you start usingrender != 1
, you get more than one "virtual" pixel per "actual" pixel (for antialiasing), which means your black lines fade to gray and get really hard to see.thin()
, what's actually drawn is not a path but a tube. This is not the default because it's slower to render and also can have the sort of issues you describe in your next post.Thanks for the reply.
I just follow the advice, and did the following things:
But I still get the color in gray, not pure black, I have tried both pdf and png output. So, is there any issue in my system?
My settings:
So, as you suggested, I should use the "thin()", thanks.
Try adding the settings:
-antialias=1 -multisample=0
Hi, John, thanks, but I get the error:
For now try -f pdf instead of -f png
The error suggests that the MSDOS utility convert is being used instead of
the one that comes with ImageMagick; you can specify a path to the correct convert program
in your config file.
Hi, John, thanks, by adding the line:
in the config files, this did solved the issue.
Both pdf and png files generate black lines.
Hi, all, even the default thin() is used, I see the image is still look so bad, see the image shot below.
Here is the source file:
and the config file:
and the command line:
So, any workaround about this issue? I'm thinking to scale the cylinder and circle a bit, but I'm not sure what is the radius of the tube line? It looks like I need to reduce the radius of the cylinder by the radius of the tube. And reduce the height of the cylinder by 2 times of the tube's radius.
All you need to do is use a higher value of settings.render (for example, 4). This is the number of pixels per bp. You can avoid such rendering issues by producing vector graphics (PRC) output and embedding that in a pdf file.
Hi, with higher value of settings.render = 8, I get such result. (see in attachment)
You see that all the skeleton lines of the cylinder get lost.
I does not have adobe reader install on my computer. But my image will finally embeded into exam or papers, I don't think PRC can solve my issue, because they will be printed to paper material。
Last edit: ollydbg 2016-05-13
Sorry I forgot that these lines were being drawn as thin lines. You can override this by specifying
frontpen=black+0.5mm.
Thanks, with the method you mentioned, I experienced another issue, just see another thread I posted here: partial of the edge lines are hidden by the surface, how to solve it?, I currently don't have a good way to let the image have unified line width.
When the thin enabled for darwing the 3D line, I think opengl use glLineWidth(1); or similar code is used to draw the 3D line, am I right? I just looked the asymptote's source code, but I can't find how a 3D line with it's linewidth=0 is draw by OpenGL.
Then, I would suggest if we could have an option for glLineWidth(2); or even bigger value, because this make all the 3D line have unique width shown on the screen.
Any good ideas?
If that is possible, I think my feature request: Is there a simple way to draw hidden line as dotted line can also be implemented, because OpenGL natived support this kind of drawings.
Most of the 3D modeling software use the dotted line to show some hidden geometry.
Last edit: ollydbg 2016-05-13
I just read the source code, found that some related code in drawpath3.cc
I guess this is the way OpenGL draw a one pixel line. So, is it possible to add an option to adjust the glLineWidth - OpenGL 4 Reference Pages function?
I just disabled the drawing of surface, and when render=1, I see that the default thin gives the expected result(I get the screen shot from OpenGL viewer).
But if I draw the surface, I get such bad image(also I get the screen shot from OpenGL viewer)
So, I think a wider unique witdh line is need here.
OpenGL doesn't guarantee support for thick lines. From https://www.opengl.org/sdk/docs/man/html/glLineWidth.xhtml:
So we are forced to implement thick lines as tubes.
This is what you get when you specify
frontpen=black+0.5mm.
The result is correctly drawn (remembering as Charles pointed out that thick lines are really tubes
so you can only see half of the back tube).
In OpenGL a linewidth of 0 forces a line that is always one pixel wide, which can be hard to see.
Is it possible at least add an option to tweak the glLineWidth? Though it is 100% supported, but this feature is good for technical drawing rendering output.
I just see that one of my Ubuntu computer's OpenGL support 1 to 10 pixels witdh 3D lines. So, I think this is doable, right? Thanks.
I just use the FreeCAD(a multi-platform free and opensource 3D CAD software) to create a cylinder object, and see the image shot below.
There are five cylinders, and from left to right, I can set the line width from 1 to 5. This gives quite nice sketch output. I'm using FreeCAD in a very old PC on WinXP which I brought in year 2008. So, I think most OpenGL implementation has support such nice feature.
Last edit: ollydbg 2016-05-17
Our reasoning in implementing tubes rather than relying on OpenGL is that for linewidths greater
than the hardware limit (which could be 1 on some systems; we don't know), tubes are required.
So now that tubes are implemented why not use them always? Are you perhaps concerned about file size? That is the only difference I can think of.
The reason is that the tubes are shown badly if the tube line intersect with a face. I have another post stating this issue, see: https://sourceforge.net/p/asymptote/discussion/409349/thread/1946c31a/#3998, half of the line is hidden by the surface, then the generated image doesn't have equal width lines. That's not good for book or technique drawing. Charles Staats helped me a lot in that thread, but it is still hard to implement a good expected result.
Well, with the native opengl line, we can simply get the expected result. Another thing is that the opengl native lines don't have the projection effect(I mean they don't get smaller when they are far from the camera), so I can achieve the equal width lines similar like in our render=0 condition.
An extra feature reqeust, which some users expect is the dotted hidden line, this can also be done in OpenGL, I have posted another thread here:Is there a simple way to draw hidden line as dotted line. This can show hidden geometry without using transparent surfaces. I think transparent surfaces are not quite good to used in a printed paper or books.
Thanks.
By the way: there are two of my posts in the thread Asymptote / Discussion / Help:partial of the edge lines are hidden by the surface, how to solve it?, which showns "Post awaiting moderation.", so as an administrator, can you verify them? Thanks.