-
Notifications
You must be signed in to change notification settings - Fork 183
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
Some advise about model loader #44
Comments
@q750831855 |
@q750831855 However if you were to happen to look at any other demos that load in gltf models like Bi-Directional_Difficult_Lighting.js(UtahTeapot), BVH_Point_Light_Source.js(Bunny), BVH_Spot_Light_Source.js(Bunny), BVH_Terrain.js(Terrain), HDRI_Environment.js(Dragon), and BVH_Visualizer.js(Dragon), I don't really need this feature because all the models are self-contained single meshes, and so the 'geolist' code is not really doing anything. It was put in there a long time ago before I knew what model I was going to be using for all the various demos. However, if you do have a mesh with multiple children meshes, the built-in three.js 'traverse' method should kick in and will automatically combine every single triangle into 1 large 'modelMesh' that ends up being passed into the GPU data texture as well as the BVH_Builder so that a hierarchy of bounding boxes can be placed around each and every triangle of the 'combined' mesh for ray tracing purposes. Hope I have clarified the issue. Let me know if you have any other questions or concerns. |
@q750831855 I will return later tonight or tomorrow with the updated code and example rendering. |
Hello @q750831855 Even with the non-standard color choice, I must say it looks quite realistic in the outdoor environment! I will go through and update all the model-loading BVH demos to be able to handle multiple mesh parts like this. Thanks again for the suggestion and sorry that I didn't get your point when you first opened this issue! ;-) |
Hi!@erichlof |
Hey @erichlof, first thanks for that awesome path-tracer! I really enjoy looking at your project.
But on some combinations I get an error: This seems to be the causing line: I tried to make a condition here, but did not work
Do you may have any clue? |
@Fluqz I have pinged n2k3 in the above paragraph - maybe he can shed some light on the model loading error as he was closer to his own source files than I was. If either he doesn't respond, or if he can't figure out the cause for error, I would suggest instead using my .js model-loading code for my various BVH demos. Chances are, I have updated them more frequently to reflect the various changes in Three.js library as well as its GLTFLoader() source. Hopefully we'll know more soon. :-) |
Hey, sorry for my late reply. I'll be working on this again in about a month or so. |
Hey long time no hear. Still excited to see it work, thanks :) @erichlof I saw that, for quite a while already, on your To-Do list is the feature to import threejs scenes to the path tracer engine. |
Hello! Yes loading the Three.js scene as it is right into the path tracer has been on my TODO list for a long time indeed. There a couple of reasons for the delay in getting this feature working. The first is material conversion. There is not a direct 1:1 ratio between Three.js materials as they are saved on disk or server and the types of materials and parameters I need to be able to show the correct materials. The closest is Three's Physical material, but unless the scene was saved with exclusively that, I wouldn't be able to extract some of the necessary parameters for path tracing purposes. Then the question becomes: do we just guess? Or put a default material on the surfaces with missing info? The next gray area is lights. How lights are sampled and the number of lights can greatly affect the distracting noise when path tracing. If the Three.js scene had 1 sunlight or a couple of indoor lights, that wouldn't be too much to worry about. But most users' indoor scenes have much more than that, and then we really need a separate acceleration structure for the lights themselves, which I don't have in place as of yet. The final and most pressing issue would be how the scene geometry itself is treated when importing. Right now I can successfully load in a gltf model, place it in a simple scene, and render it. But if you tried it with an arbitrary number of objects/models, or a heavy amount of architectural geometry for instance, the shader compilation starts getting finicky and crashing. Again what would be needed is an acceleration structure over the objects that have their own acceleration structures! It gets kind of messy real quick. That's not to say it can't be done, it's just that thoughtful planning needs to happen as well as implementing some more advanced acceleration structures, in order to have a seamless 1:1 transition from stored scene to path traced scene. |
Happy Lantern Festival!
A model may consist of multiple parts,I suggest that you traverse all model IDs and add.
for (let i = 0; i <meshList.length;i++){ geoList.push(meshList[i].geometry); } modelMesh = new THREE.Mesh(); modelMesh.geometry = THREE.BufferGeometryUtils.mergeBufferGeometries(geoList);
元宵节快乐!
一个模型可能由多个部分组成,我建议您遍历所有模型id后再加入。
The text was updated successfully, but these errors were encountered: