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

Raycaster #16

Open
ferhat-aslan opened this issue Jan 1, 2023 · 11 comments
Open

Raycaster #16

ferhat-aslan opened this issue Jan 1, 2023 · 11 comments

Comments

@ferhat-aslan
Copy link

Hi, Dear Developer, I really loved your job. It is the fastest and most comprehensive dxfviewer. I am trying to implement Threejs.Raycaster. But I couldn't. I think The Vertices in buffer geometry do not contain z values. This is causing the error.
I tried to add z value to vertices. But I could not. This is beyond my abilities. I hope you add the raycaster feature in the future. I would love to work with you on this.
best regards,
ferhat

@vagran
Copy link
Owner

vagran commented Jan 2, 2023

Hello,
What is the end result you are trying to achieve?
If that is a DXF primitive picking, it is not so easy to implement. Using three.js built-in features might not be helpful, because the viewer batches many primitives in a big rendering batches (anything which can be drawn by a single draw call, usually same type and material), so it loses releation between rendering entities and source primitives. This is done to maximize rendering performance. The primitives picking could be done by introducing some addional vertex attributes with feature IDs, and utilizing some common picking techniques (like rendering twice, once in custom framebuffer to fill it with IDs and pick from, second time in displayed canvas). That sounds like next big feature, I would like to implement this, but unfortunately I cannot commit now anything about possible timeframe.

@ferhat-aslan
Copy link
Author

Hi,
Thank you very much your reply, I mean that selecting objects such as line and getting object ID or points. I added z values to vertices. by using geometry.setattributes(). But raycasting is not working real-time.(slow and not correct).Now I will try GPU picking. If you give some resources(links, articles) about method that you mentioned. I may work on that.
Thanks in advance,
best regards,
Ferhat

@vagran
Copy link
Owner

vagran commented Jan 2, 2023

What I mentioned is something like described here: https://webglfundamentals.org/webgl/lessons/webgl-picking.html
Among with modifying rendering pipeline it also requires saving IDs of each primitive as vertex atribute. Since we have 2D-only viewer, probably the depth buffer can be used alternatively instead of separate redering pass, however I am not sure if WebGL guarantees it has enough bits per sample for storing IDs.

@ferhat-aslan
Copy link
Author

Ok, Thank you very much everything.
best regards,

@dotoritos-kim
Copy link
Contributor

I hope this issue is resolved too.

@jdh-invicara
Copy link
Contributor

I'd be very interested in any proof of concept work done on Raycasting for picking elements of the model.

@KaivnD
Copy link

KaivnD commented Apr 23, 2023

+1

@vagran
Copy link
Owner

vagran commented Apr 24, 2023

This feature is planned for the next major release. It requires significant architectural changes to the library, which will make it very different from its current state as just a dummy renderer.

@KaivnD
Copy link

KaivnD commented Apr 25, 2023

check out this one three-cad-viewer he made a nested group class for scene structure, might be helpful.

@dotoritos-kim
Copy link
Contributor

Hi, Thank you very much your reply, I mean that selecting objects such as line and getting object ID or points. I added z values to vertices. by using geometry.setattributes(). But raycasting is not working real-time.(slow and not correct).Now I will try GPU picking. If you give some resources(links, articles) about method that you mentioned. I may work on that. Thanks in advance, best regards, Ferhat

How did you do it? I would be grateful if you could explain it briefly.

@feslan
Copy link

feslan commented Apr 26, 2023

Hi, Thank you very much your reply, I mean that selecting objects such as line and getting object ID or points. I added z values to vertices. by using geometry.setattributes(). But raycasting is not working real-time.(slow and not correct).Now I will try GPU picking. If you give some resources(links, articles) about method that you mentioned. I may work on that. Thanks in advance, best regards, Ferhat

How did you do it? I would be grateful if you could explain it briefly.

Hi,It's been a long time, I don't remember exactly, I added z(0) value to the 3rd element of the position attribute array with a for loop.then raycaster started working without error anymore. but not sensitive. and often showed incorrect values.

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

No branches or pull requests

6 participants