-
Notifications
You must be signed in to change notification settings - Fork 107
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
Boundingsphere radius is NaN when initializing raycaster. #55
Comments
What is the reproduction scenario for this issue? Currently there is no Z coordinates for rendering primitives, since this is huge memory wasting for planar designs. |
If you create a Raycaster object and ray tracing the object, the above image error occurs. |
Yes, this will not be that simple with the current implementation. You can try to add Z coordinates in your fork. However, I doubt that approach used in three.js for Raycaster will have good performance with huge DXFs. |
logic is huge, so I failed to add the Z-axis as I thought. Could you please briefly tell me how to do it? |
Probably some easiest "quick and dirty" way is modifying attributes arrays (instead of digging into batch construction code): Line 718 in 151b7de
Line 735 in 151b7de
These arrays initially contain X/Y coordinates as [X1,Y1,X2,Y2,...] , should be modified to [X1, Y1, 0, X2, Y2, 0,...] .
Shader code probably should be changed as well: Line 586 in 151b7de
May be something else I missed. However, I doubt you will get what you want after that, each Three.js object is a whole batch, which consists from primitives from unrelated DXF entities, grouped by common material. |
yes,most memory wasting is due to TTF font entities. In my case, in order to catch mouse events by raycaster, I've added Z to my vertices, it costs lots of memory when there's lots of texts in the dxf file. And it wastes more time. I think perhaps later we need to render shp fonts instead. Shp fonts have only lines instead of triangles which will save huge memory and rendering time. |
No performance problems on even low-profile integrated graphics, I've added some complicated animations in my case, for example, drawing and moving rectangle annotions, a small square that can be magnetically attached to the edge of the line and the intersection of lines. Add an animate function in DxfViewer, when triggered some plugin, for example raycaster events, change some variable like Animate() {
if (this.HasRenderer()) {
this.Render()
}
if(somePluginEnabled) requestAnimationFrame(this.Animate.bind(this))
} Because of your amazing work, three.js is perfectly combined with dxf-viewer. |
I had thoughts to migrate to text rendering based on signed distance field textures, which AFAIK is state-of-the-art, and combines advantages from both vector and raster worlds. Probably I should plan it as one more big feature in the next major release. |
If this code is added to DxfViewer.js CreateObject, it is possible to render at high speed without problems, and it is confirmed that the above errors do not appear. |
This should be done in a fork, since it is a workaround which has no value for the library at the moment. |
It seems to be a problem that does not include the z position in the matrix.
Considering the difficulty of development in the next release, I think we need a logic to put fake Z coordinate values.
The text was updated successfully, but these errors were encountered: