Generate normals

Hello,

is there a jme class to generate normals ?



I create the mesh procedurally, i know index,vertex,uv but not the normals.



thank you,

1 Like

There is not predefined function,



but if you know the 3 vertexes, you can define a plane, And then you can use that plane to calculate a normal (see google or persons with better math skills)

jME3 Math Overview: plane

and

javadoc

What kind of mesh is it and how do you create it procedurally?

My code converts an image into a 3d shape, i will release it when i finish.

original image

polygonized

Simple symmetry Y

Simple Symmetry X

I have 8 symmetry operations.

Theoritically i could do spherical coordinate symmetry, radial symmetry, whatever and see if it is good looking.

I will use some of these as enemies, stage layout, doors, equipment.

Now i am implementing the extrude so it is 3d.

The only thing i would worry is the uv on the [y dimension] since it will be just extruded.

For that, the normals would be easy because they are all pointing in the same direction, right? So just Vector3f.UNIT_Y.



Not so much harder for the sides when extruded, either, but you will actually have to calculate them. But that’s just a cross product with Vector3f.UNIT_Y and the normalized vector if one of the x,z edges.

2 Likes

thank you, you are right