Comments (6)
Raycasting is handled with a custom traversal algorithm so the raycast function on each mesh is replaced with a custom one on load to avoid redundant raycasting work. It's the only way to disable raycasting on an object in three.js.
Can you explain in more detail what you're trying to do? Why do you need to replace the raycasting function?
from 3dtilesrendererjs.
First, I still cannot get it why the code is written like Object.getPrototypeOf(c).raycast
rather than c.raycast
. I assume that it can also work with your custom traverse raycasting design above.
In my project, 3DTiles data is BIM which is so heavy and large. Even the raycasting has been optimised, the performance is still not good. In fact, I'm gonna replace raycast function to BVH. I noticed that you are also the BVH author, is there an elegant way to deal with it?
from 3dtilesrendererjs.
First, I still cannot get it why the code is written like Object.getPrototypeOf(c).raycast rather than c.raycast. I assume that it can also work with your custom traverse raycasting design above.
As I said the raycasting performs custom traversal by overriding the root "raycast" function and it's required to replace the existing raycast function with an "empty" one so duplicate raycasting is not performed. The prototype raycast function is retrieved when leaf nodes are traversed to so we have the associated raycast function associated with the object type. Because we replace the original raycast function with the empty one it's no longer available.
In my project, 3DTiles data is BIM which is so heavy and large. Even the raycasting has been optimised, the performance is still not good. In fact, I'm gonna replace raycast function to BVH. I noticed that you are also the BVH author, is there an elegant way to deal with it?
three-mesh-bvh suggests overriding the prototype of Mesh
in the documentation which will work just fine here since the prototype is modified:
Mesh.prototype.raycast = accleratedRaycast;
It's possible to add something that allows for more control over this but I'd like to avoid it if possible. At least this limitation should be listed in the documentation, I'd think.
from 3dtilesrendererjs.
three-mesh-bvh suggests overriding the prototype of
Mesh
in the documentation which will work just fine here since the prototype is modified:Mesh.prototype.raycast = accleratedRaycast;
I don't think this is an elegant way. Using c.raycast
is a better way. I only want to modify raycasting on some meshes, not all. Mesh.prototype.raycast
is a global affecting API. This may cause some compatible issues when using some other third-party libaraies
from 3dtilesrendererjs.
I don't think this is an elegant way. Using c.raycast is a better way.
I'm not interested in repeating what I've already stated previously. If there's something specific you don't understand about why the current approach is being used I'm happy to answer. But statements like this are not helpful.
I only want to modify raycasting on some meshes, not all.
I won't be dealing with hypothetical situations. Please be specific about what function you're replacing the raycast one with and why.
The current "optimizedRaycast" and "firstHitOnly" options enabled by the overwritten raycast functions provide a 2-5x performance improvement over the naive raycast approach in some cases. And it would be even higher (4-10x or more) if there were a way to get rid of some other unnecessary three.js overhead.
from 3dtilesrendererjs.
I'll close this until more information or details can be provided on the purpose. Ultimately changes need to be made in three.js to support this. Or a custom raycaster solution needs to be provided, which I don't think is an elegant solution.
from 3dtilesrendererjs.
Related Issues (20)
- Why only load JSON without loading any model files? HOT 8
- Aborted tiles leave remaining ImageBitmaps HOT 2
- GlobeControls: There's a big jump in speed at zoom out transition
- Remove callback assignments in favor of event listeners
- Remove gated logic behind r165
- Loaders: Change "load" to "loadAsync" to align with three.js api
- If loading a large model, will it use web work acceleration? HOT 1
- Move loaders to "loaders" folder
- EnvironmentControls: Clicking outside the click range can cause the camera to "jump" to a far position
- there is no BatchTable attribute for PNTS HOT 1
- The issue with testing by Jest HOT 1
- Bug: DOMException: signal is aborted without reason HOT 2
- GlobeControls: Hovering over the sky and zooming in zooms the camera forward instead of to mouse position
- GoogleTilesRenderer get all needed tiles loaded status HOT 1
- Remote textures cannot be loaded HOT 1
- EnvironmentControls: Width adjustHeight = false, maxAltitude is not respected
- EnvironmentControls: When the camera is underneath a model clicking does not work
- StructuralMetadata: Clean up code
- StructuralMetadata: Validate all fields from test data
- StructuralMetadata & MeshFeatures: Add more complete demo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 3dtilesrendererjs.