Hi. Here’s the scenario.
We have a room model in 3ds Max. All structural components such as individual walls, ceilings and floor are segmented into separate mesh nodes. When we export the room to a GLB using the Babylon Exporter plugin for 3ds Max, the walls which are either facing the +ve or -ve x-axis have correct normals but the walls facing in other directions have their normals wrong ( or atleast different from the one in 3ds Max ). Can someone please advise regarding how we can solve this issue? Willing to provide more context/details if need be.
Thanks
More details would be nice
I’ll cc @PatrickRyan who has a lot of max experience in the meantime
Sure. For instance, in the real-time solution that we are building, we load the exported room GLB and place items on the walls. The user can drag and place those items on other walls as well. While the user is doing that, we orient the item ( facing away from the wall, say a picture frame ), using the face normals.
Here’s a top down view ( screenshot from our app ).
As you can see, the wall with the green tick has correct placement of items as it’s face normals are correct. However, if we try and drag an item from the green-tick wall to another one, this happens
The pink dot represents where the pointer is. We’ve also tried debugging it and printing the normal values, our assumption stands correct. The face normals for these other walls are wrong, as compared to the original normals in the max file.
Let me know if that makes sense.
@Mukarram, I think a little more information would be needed here. Is there a way for you to export a simple repro of the issue using cubes and provide a playground showing the issue? The reason I ask for this is that if the face normals of your side wall meshes were incorrect, that should also show up in the render of the walls since the lighting calculations are dependent upon the surface normal. Even if you are using a completely custom shader for your lighting, there would be a difference between the side and back walls. If you are using emissive color only on the walls, I would still expect there to be some rendering differences unless you are rendering double sided meshes.
The fact that you are aligning to the face normal, but the moved geometry appears to be facing down - if I am understanding the image above - seems to suggest it’s aligning to the face tangent rather than the normal. Also, when exporting, is the room mesh a single mesh, a combination of sub-meshes in one export, or multiple exports that are loaded individually? Are there any differences in the stack between the back and side walls if they are separate?
Just from what I am seeing in the screen shots, it seems like I am missing some context. Taking a look at a sample would be super helpful. And if you want me to look at the actual file, you can certainly PM me and I would be happy to dig in. If there is a problem with the exporter, we need to get a repro before we can really understand what is going on. Thanks!
Hi Patrick. Each wall is a separate mesh. I am afraid it won’t be possible to share it in a playground or a repo. The only babylon product we are using in our pipeline is the GLB exporter.
Also what you’ve mentioned about the lighting, I had been thinking the same. Nonetheless when we try to get the face normals from the “faulty” walls, those normals are not pointing in the expected direction.
I can share the max file with you if that helps though. Let me know.
Thanks
Hey. Quick update. Problem solved. Turns out we were looking in the wrong place
hah!
3 Likes