Java3D graphics: solid line looks dashed

  • Context: Java 
  • Thread starter Thread starter Hassan2
  • Start date Start date
  • Tags Tags
    Graphics Line Solid
Click For Summary
SUMMARY

The discussion focuses on issues encountered while using the Java3D library to render finite element quad meshes. The first problem involves edges appearing dashed when using a line width of 1.0f, which can be mitigated by adjusting the line style or using an offset to prevent overlap with quads. The second issue pertains to poor line quality, which can be improved by enabling Anti-Aliasing (AA) and utilizing PolygonAttributes for rendering. The user discovered that using LineArray was unnecessary and that switching to PolygonAttributes could resolve the rendering issues.

PREREQUISITES
  • Familiarity with Java3D library
  • Understanding of Anti-Aliasing (AA) techniques
  • Knowledge of PolygonAttributes in 3D rendering
  • Experience with graphics driver settings
NEXT STEPS
  • Research how to enable Anti-Aliasing in Java3D
  • Explore the use of PolygonAttributes for rendering in Java3D
  • Investigate line style parameters in OpenGL and their Java3D equivalents
  • Learn about mip-mapping and high-quality texture settings in Java3D
USEFUL FOR

Java developers, graphics programmers, and anyone working with 3D rendering in Java3D who seeks to improve line rendering quality and manage visual overlaps in graphical applications.

Hassan2
Messages
422
Reaction score
5
Dear all,

In Java and using Java3D library, I have created a GUI for viewing finite element quad element meshes. I am facing two problems with the graphics:

1. In order to draw the meshes, I draw the quads and the edges separately so that I am able to remove one and leave the other on the screen view. The edges have different color than the quads. The problem is that when I choose line width 1.0f for the edges, they look like they are dashed. In fact they somehow overlap with the quads. If I choose wider lines, then it's fine but the appearance won't be good with thicker lines. How can I solve this problem?

2. The second problem is that even without the quads, the lines have poor quality , that means then they are not parallel with the screen sides, they have teeth ( they are not drawn finely). How can I draw them finer?

Your help would be appreciated.

Thanks

Hassan
 
Technology news on Phys.org
Hey Hassan2.

For the second problem you should try to see if you can turn on what is known as Anti-Aliasing (AA). You can do this software side and hardware (driver side) and if you disable it driver side you disable it for all software applications. It should be in your graphics driver options.

The other thing is to check whether the Java3D has a line style parameter. OpenGL has a line style parameter that allows you to set how you want to render lines and you should check if Java3D does as well.

One suggestion for the quads is to choose an offset that is slightly out of place where you don't get overlap.

Also you might want to check the texture options and make sure you have high quality textures and to use mip-mapping if you aren't using it.

Another suggestion is to do one of the following: create a border in your initial texture so that the border is the same color of the line. If you are using a solid fill color as opposed to a texture, then have slightly different vertices for the line and for the actual quads themselves.

The other suggestion is to use double precision for all your co-ordinate data instead of normal floating point numbers: this will make a big difference.
 
Thanks chiro,

I didn't find the AA option on my driver side. Enabling it on the software side makes the lines smoother but they are still broken ( due to overlapping).

I think the problem with the brokenness is that I have defined a LineArray as the borders of the quads. I just figured out that there is no need for the LineArray and we can use PloygonAttributes to render the polygons ( here quads) as points, lines or fill. I have not been able to draw both the lines and the fill yet, but I believe we can render both and I expect the lines would have no problem.


Thanks
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
8
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 75 ·
3
Replies
75
Views
7K