Creating mesh with bump texture in facets

Hi All-

I think this a pretty nutso question, but here goes!

I have been printing out models I create in BJS with a 3d printer and it works great, but all my pretty bump textures get lost. Which makes sense.

I understand that the bumps aren’t really there and they are simulated using normals but does anybody have an idea of how to build meshes that have the bumps ‘baked in’?

Maybe make facets that are offset from the face plane by the difference between the bump normal and face normal?

If I’m not completely out to lunch maybe someone can point me toward accessing the array of bump normals.

Thanks everyone and I hope you’re 2023s are incredible!

Your buddy in Trenton NJ-

Flex

Hey there! I’ve encountered this before, Rhino which is a CAD program can do this “baking” of the bump map into the texture. It’s not open source so I don’t know exactly what they do, but my general idea would be something like that: for each face of the model, get the average normal value of the displacement map, get the angle difference between the model normal and the displaced normal, and apply that to the vertices (like this very bad diagram but in 3D):
image

It would work better with very subdivided models, and there must be a bunch of edge cases to work through, but it’s doable

Oh no! So many maths! Such wow!

All kidding aside, that sounds about right. My models are not very subdivided at all. I think with a sphere you’d be starting in a better place. Let me have a look at the source and see it makes any sense to me.

Thank you, Carol

And for what it’s worth, since I have been working with BJS and have had to dig up geometry from the dark recesses of my brain, not touched for 45 years I have had to make so many lovely diagrams like that.

1 Like

The daily life of Babylon.js dev :rofl:

image

1 Like