erichlof / Babylon.js-PathTracing-Renderer

Real-time PathTracing with global illumination and progressive rendering, all on top of the Babylon.js WebGL framework. Click here for Live Demo: https://erichlof.github.io/Babylon.js-PathTracing-Renderer/Babylon_Path_Tracing.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Loading gltf failure

pcarret opened this issue · comments

Hi Erich,

Thanks for your tremendous work
I have an error message when loading a "simple" gltf file with two files :
babylon.js:16 BJS - [08:42:31]: Unable to load assets from https://raw.githubusercontent.com/pcarret/assets/master/alk/twoParts-opaque.gltf: Error in onSuccess callback (Cannot merge vertex data that do not have the same set of attributes)

function loadModel()
{
	modelNameAndExtension = "twoParts-opaque.gltf";
	BABYLON.SceneLoader.LoadAssetContainer("https://raw.githubusercontent.com/pcarret/assets/master/alk/", 
        modelNameAndExtension, pathTracingScene, function (container)
..
}

This gltf is correctly loaded in Babylon
Any help iwould be welcome

@pcarret

Hi, sorry you are having trouble loading your gltf file into the path tracer. I will definitely take a look, and if I can't figure it out, I will forward this issue over to the Babylon.js path tracing forum thread. Over there are gltf experts ready and willing to come to the rescue! 😉

I'm afraid one of my many programming weaknesses is gltf loading and gltf data processing. I was so excited to just get the path tracing of gltf working in the beginning (ha), but I knew that my code is not robust and I knew there would be cases like yours in the future that don't fit my simple gltf processing scheme.

I will say this though, I think it is possible what you're trying to do: with my original three.js pathtracing renderer, I was able to combine multiple gltf models into 1 bigger model, and then path trace the whole thing as a unit. I used three.js' 'mergeBufferGeometry' utility when these cases came up, and it would magically squash all the separate gltf components, no matter how many there are (could be dozens or hundreds). I can't seem to locate the Babylon.js equivalent, but hopefully we can get some help from the Babylon.js experts.

One more note: take a look at my three.js pathtracing renderer GitHub page and find the 'gltf Viewer' demo, that was contributed by a second person, other than myself. He seems to be able to do what you're wanting to do with the three.js renderer version, in that his large apartment model starts out as dozens of smaller gltf models, each with their own vertex attributes, but then somehow get squashed into one large 'apartment' file for path tracing purposes.

The way my triangle BVH acceleration structure is set up, at the moment you can have only 1 large merged gltf model by the time it is sent down the pipeline to the path tracer. Handling multiple gltf models and ray tracing with different tiers of acceleration structures (like NVIDIA does with their proprietary technology) but in webgl and the browser would be very challenging and is a possible project for the future - hence the requirement to merge gltf component files into 1 final resulting model.

Will be back with more info on your issue.

-Erich

@pcarret

As a follow-up, I just now forwarded your issue to the Babylon.js forum/team.
https://forum.babylonjs.com/t/path-tracing-in-babylonjs/11475/189

Hopefully someone there will be able to understand the error message and spot the problem. Once I know what is wrong, I can start working on making the loading code more robust for a wider array of glTF use-cases.

Will report back with any findings. :-)

@erichlof
Hi Erich,

Many thanks for your answers. I hope you will get some help from Babylon experts
Your work is amazing. I hope I will be able to integrate it in my future app. It seems it will be integrated in Babylon directly but I have no clue if any information is available on a "release". I saw a sample was done by pichoupichou in Typescript but O was unable to make it working.

Hi Erich,

Would it be possible for you to send me the src code of this :
image

Best regards,
Philippe

Hi Erich,

Do you think reading the texture data from babylon gltf import will be possible ?

Hi @pcarret ,
Sorry I got a little side-tracked with that RTX 3090 issue over on the Babylon forum. And then I've had to tend to some other things going on in life (ha). I promise I'll take a look at this for you very soon!

That will be Fantastic if PathTracing can handle textures !
I saw the discussion about the RTX 3090. Seems Chrome has a memory issue versus Firefox.

For curiosity, you can check this link where I tried a webgl renderer