create3000 / x_ite

X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.
https://create3000.github.io/x_ite/
Other
67 stars 15 forks source link

No Anti-aliasing on lines from indexedLineSet #104

Closed olafgithub closed 2 years ago

olafgithub commented 2 years ago

A minor thing, but I noticed that lines from an indexedLineset look a bit rough in X_ITE There is no anti-aliasing.

ils_bs_contact With BS Contact

ils_x_ite With X_ITE

I am not sure if there is a setting I missed. Other shapes look great and the movement between viewpoints is much smoother in X_ITE.

Windows 10 Google Chrome: Version 99.0.4844.51 (Official Build) (64-bit) X_ITE: v4.7.15

create3000 commented 2 years ago

The lines in your image should be antialiased, but depending on the antialiasing setting of the browser, the images can differ. You can check if antialiasing is enabled in X_ITE if you check the Wellcome-Message in the console. There should be something like this to read:

Rendering Properties
      Antialiased: true

I do not explicitly set antialiasing option when the WebGL context is created, but by NOT setting the flag the browser will generally try to use antialiasing.

olafgithub commented 2 years ago

I checked the AA setting in X_ITE. It is (and was) On all the time.

I did not mention that with BS_Contact I use Direct X and not OpenGL as renderer. When I changed the renderer in BS_Contact to OpenGL the results are about the same as X_ITE. There is also a setting in BS_Contact under Graphics -> Edges -> Antialias When I check this option I see another problem: Lines close to the viewer are rendered too wide...

Just to be sure why the lines look smoother in BS_Bontact using DirectX I did a comparison:

reference

Part of a scene

bs_contact_direct_x_1000pct

At 1000% as rendered in BS_Contact with DirectX

x_ite_1000pct

At 1000% as rendered in X_ITE (with antialias On)

Looks very different...

All this may seem not very important, but I used IndexedLineSet to make a 3D wiring diagram of a motorcycle. When you hover the mouse over a wire, the details are displayed on a Billboard node.

The other bug (No TouchSensor on IndexedLineSet) is of course much more important.

Thanks for looking into this,

Olaf

create3000 commented 2 years ago

The images of you show that the lines are antialiased. When one set the antialiasing in OpenGL there is a 'strength' value, which can be 0,2,4,8,16,32. Probabl BS Contact has a higher antialiasing strength. When no antialiasing would be applied you would see every pixel of the line with the same color as shown below.

tmp10a0143_thumb

olafgithub commented 2 years ago

Correct.

I assumed that there was no antialiasing at all. Only when I took a screenshot did I see that there is indeed some antialiasing. At first, it looked like a simple Bresenham's line to me.

The nicest lines are seen when BS Contact is rendering with DirectX.

Thanks for looking into it.

Olaf