Csoki
Csoki

Reputation: 139

Calculate normals

I loaded a heightmap from a bmp picture and drew it. But the lights do not work because it doesn't have normals. How do you calculate the normals from 3 vertex? (I saw a C++ question here but I cannot do it in Java)

Upvotes: 0

Views: 775

Answers (1)

Ian Panzica
Ian Panzica

Reputation: 354

Are you using OpenGL (or JOGL) at all?? The link you posted involves using functions in OpenGL for cross products and normalization. That being said, these functions are easy enough to do out step by step.

Here's the math: https://math.stackexchange.com/questions/305642/how-to-find-surface-normal-of-a-triangle

Upvotes: 1

Related Questions