Home › Forums › Programming › Material loaded from separate glTF not applying correctly
Tagged: materials, separate gltf
- This topic has 15 replies, 2 voices, and was last updated 5 years, 3 months ago by Yuri Kovelenov.
-
AuthorPosts
-
2019-08-29 at 2:48 pm #18259cbostonCustomer
Hi,
I’ve built a configurator app which loads an initial glTF which has all the base geometry and some materials. Because our clients have so many options for chair materials we separated those into other glTF which we load dynamically when a user selects the option. For the most part applying these separately loaded materials seems to work fine but in certain cases it does not. Specifically, the roughness/reflective properties aren’t loading correctly when coming from a referenced glTF file.
[removed link]
This example shows the “Target Berry” material initially which was included in the base glTF so the reflection is correct. However if you select the Cornhusk option (which will load the separate Target materials glTF) and then switch back to Berry you can see its lost its reflection.
The Durathane Brick option has neither its proper relfection or roughness texture.
Do you have any ideas as to what the issue could be? Please any help would be greatly appreciated as I’m still fairly new to WebGL.
2019-08-29 at 3:21 pm #18263Yuri KovelenovStaffHi,
For some reason your gltf files are requested several times. I’m not sure if this might be the reason for that problem, but nevertheless, it looks suspicious. Also you’re using 2.9 which is fairly old version – may be the latest Verge3D will work better?
If the above does not help, can you reproduce the issue with a simpler standalone application? Just a few puzzles or something like that – and send this project our way via enterprise support mail? It might help us narrow down this issue. Thanks!
Attachments:
You must be logged in to view attached files.2019-08-29 at 5:32 pm #18271cbostonCustomerThanks for the reply.
The multiple entries in the Network tab are related to our hosting architecture where the app requests a file from API and it then 301 redirects to the actual file location. I’ve updated that link to temporarily use the direct file url but the issues still occur.
Previously I posted here asking about if you were able to put the v3d.js on NPM to make it easier to stay up to date. Were you able to do this yet? In the mean time I grabbed the 2.14 version and its now using that.
We are not using any Puzzles for this app but just directly interacting with your V3d.js library.
I’m using
v3d.GLTFLoader()
to load in the separate files. To apply the material I’m using thescene.getObjectByName
and then just doingobj.material = newMaterial
.Is that all correct?
2019-08-31 at 5:37 am #18302Yuri KovelenovStaffput the v3d.js on NPM to make it easier to stay up to date
We are still considering this. I’ll consult with the developers to recall the reason why this is not done yet.
I’m using v3d.GLTFLoader() to load in the separate files. To apply the material I’m using the scene.getObjectByName and then just doing obj.material = newMaterial.
It’s correct except that instead using the low-level v3d.GLTFLoader, I’d recommend to go with the more convenient loadScene and appendScene methods. Check out the visual_logic.js file of the Load Unload demo for some examples.
2019-09-03 at 3:26 pm #18393cbostonCustomerMy only issue with appendScene is I do not actually want that scene to appear on screen. I just need the materials inside it to be able to apply to the geometry from the original base glTF.
Looking at what appendScene does however led me to discover the
_updateSceneCubeUVEnv
function. Simply including that in my loader callback seems to have fixed my issue. Do you see any issue with me calling that directly? Attached a shot of it in context.Also, is it possible for me to see the v3d.js source code unminified? I was able to figure out the appendScene logic but it would be nice to see the full code.
Thanks!
2019-09-03 at 3:39 pm #18395Yuri KovelenovStaffI do not actually want that scene to appear on screen. I just need the materials inside it to be able to apply to the geometry from the original base glTF.
You can do it as follows: apply your materials to some light-weight geometry such as planes in an appended glTF, and make these planes invisible so that they load hidden. The materials then can be applied using the assign material puzzle as usual.
Looking at what appendScene does however led me to discover the _updateSceneCubeUVEnv function. Simply including that in my loader callback seems to have fixed my issue. Do you see any issue with me calling that directly? Attached a shot of it in context.
This is great that it worked for you. However, this is low-level API subject to possible changes in the future so I’d recommend using the same methods that are used behind Puzzles since they are heavily tested by us and by the community.
Also, is it possible for me to see the v3d.js source code unminified? I was able to figure out the appendScene logic but it would be nice to see the full code.
Of course, your company is an Enterprise customer. You may download the extended version of Verge3D with the source code of the engine from the dashboard (download access is granted to the same account using which your company purchased the Enterprise license).
2019-09-03 at 3:57 pm #18396cbostonCustomerGot it, thanks for your help!
Which dashboard do you mean for finding the source code? The App Manager? I’m not able to find it there.
2019-09-04 at 6:39 am #18401Yuri KovelenovStaff2019-09-05 at 1:50 pm #18434cbostonCustomerHey, I’m back :)
Unfortunately, after I got our model working using the method above I had our 3D artist re-export the chair in the latest 2.14 version from 3DS Max and its caused the “durathane” material to not display at all now. Another concern our artist had is some emission maps he had in there are displaying much more vibrant than the previous version. Seems like maybe somewhere changed with how the saturation works? He previously had exported using 2.11.1
I’ve tried with the
_updateSceneCubeUVEnv
solution mentioned above and with usingappendScene
and both give the same results.Any ideas what could be going on?
[removed link]
Thanks!
2019-09-05 at 2:13 pm #18435Yuri KovelenovStaff2019-09-05 at 2:34 pm #18436cbostonCustomerThe Sneak Peek of just the durathane swatches looks fine as it does by itself in the app:
[removed link]That same durathane glTF looks fine in combination with the 2.11.1 base model
[removed link]Then in combination with the 2.14 model it has the issue
[removed link]I’ve updated the app to use
appendScene
and without the swatch planes invisible so you can see it to the left of the chair.My artist mentioned it could be related to a gamma issue which he is going to look into.
2019-09-05 at 3:21 pm #18439Yuri KovelenovStaffI see. Can you make a quick test? Create a new Standard project with the App Manager. Use you chair model in the main scene so that it loads by default. Finally, use the append scene and assign material puzzles to load your swatches and apply materials to the chair.
2019-09-05 at 4:02 pm #18441cbostonCustomerI setup a standard project and used the puzzles but unfortunately the same result with the durathane materials.
On another note, even the materials that work seem to have different brightness from 3DS Max Sneak Peek to the actual exported version. See attached. Although that may be really just be due to some caching as we see it inconsistent between different PCs
2019-09-06 at 6:35 am #18464Yuri KovelenovStaff2019-09-06 at 7:17 pm #18485cbostonCustomerJust sent it. Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.