Skip to content
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

Increase texture coordinate precision on picking #764

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DRx3D
Copy link

@DRx3D DRx3D commented Aug 22, 2017

X3DOM supports only 8-bit precision when picking texture coordinates. This is leads to poor quality results
when textures are > 256 in any dimension. The "B" channel is currently not used during this operation. This
modification uses the "B" channel to add 4 bits each to the U & V coordinates when picking textures giving a
total of 12 bits or 4096 unique coordinate values in each direction. No change was made to any computation of
S & T coordinates (X3D texture coordinates) to retain the [0.0,1.0] range. The change is in the value stored
in the picking (mouseover) event. Returned values are integers in [0,4095].

This change is public domain.

X3DOM supports only 8-bit precision when picking texture coordinates. This is leads to poor quality results
when textures are > 256 in any dimension. The "B" channel is currently not used during this operation. This
modification uses the "B" channel to add 4 bits each to the U & V coordinates when picking textures giving a
total of 12 bits or 4096 unique coordinate values in each direction. No change was made to any computation of
S & T coordinates (X3D texture coordinates) to retain the [0.0,1.0] range. The change is in the value stored
in the picking (mouseover) event. Returned values are integers in [0,4095].
@DRx3D
Copy link
Author

DRx3D commented Aug 23, 2017

I should have included the link to the online demo of this revision - http://tools.realism.com/Basx3D/x3dom/tmp/TexturePickingTest.html. This example uses a texture of 2048x2048 and automatically sets 'debug' mode.

*
* shader += "z = floor(x/256.)/levels/levels;\n";
* shader += "z = z + floor(levels*fragColor[1])/levels*(1.+1./256.);\n";
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this part of the comment still apply ?

this.stateManager.enable(gl.DEPTH_TEST);

//Set Depth Mask
this.stateManager.depthMask(!depthMod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start

this.stateManager.enable(gl.DEPTH_TEST);

//Set Depth Mask
this.stateManager.depthMask(!depthMod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end. This would need to go into src/gfx_webgl.js . Any reason to have the file in src/shader ?

this.stateManager.enable(gl.DEPTH_TEST);

//Set Depth Mask
this.stateManager.depthMask(!depthMod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why in src/shader ? Probably the file should just stay in src/ .
z is not used, so ok.

@DRx3D
Copy link
Author

DRx3D commented Nov 3, 2017 via email

@andreasplesch
Copy link
Contributor

Please take a look. I didn't see collisions with existing functionality but perhaps it is worth checking again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants