Hi :)
I a Questions about the .3ds File format.
1.Must calculate the Normal vector for each face i found in the .3ds File ? or is it allready done by 3d studio ?
- Jens
It's sort of already done but you might want to calculate them yourself anyway. But that involves working out smoothing groups too. As I recall both techniques are fiddly.
Cas :)
What normal data do you have?
If you need per vertex normals (to get smoother shading) instead of per face normals (which generally gives faceted, crystalline rendering and are outputted by most 3d file formats), its pretty easy to calculate them.
Basically, you need to identify the faces that a particular vertex touches, then average the face normals for each vertex like so:
vertexN.x = faceN1.x + faceN2.x + faceN3.x + faceNn.x ... / numFaces;
vertexN.y = faceN1.y + faceN2.y + faceN3.y + faceNn.y ... / numFaces;
vertexN.z = faceN1.z + faceN2.z + faceN3.z + faceNn.z ... / numFaces;
The mesh loader for the generic XML file format I am writing supports these calculations, will finish it when the next release comes out and share it if anyone is interested.
Then send the normal prior to each vertex when you are rendering triangles, job done.
Calculating face normals from vertices is a bit trickier, probably why they get outputted most of the time.
pixel
:)
Hi,
the background for that Question is that i was unable to Display
some .3ds Models via Gl4Java with the .3ds lib from MRI.
I thought the problem could be the Face Normals for Lightning
- Jens