enigma
03-21-2008, 09:28 AM
I must render the silhouette of an arbitrary 3D model.
The models are in OBJ format.
First I have follow this to read obj file:
http://cggmwww.csie.nctu.edu.tw/courses/cgu/2002/prog1.htm
It works, but only if in the file are stored vertex normals.
For example:
v -1.500976 13.063408 0.460043
vn -0.461797 0.858629 -0.222485
vt 0.000000 0.000000
But if the vertex normals are not stored in this manner, I'm not able to found a silhouette.
So, I have tried this code for read obj file:
http://www.gamedev.net/community/forums/topic.asp?topic_id=330992&forum_id=12&gforum_id=0
(third post, objread.h).
Whit this code, vertex normal are manually generated.
It works, but with some problems, for example:
http://img522.imageshack.us/img522/6122/10950779pk2.th.jpg (http://img522.imageshack.us/my.php?image=10950779pk2.jpg)
In this rendering, there are some wrong edges.
For me is because some normals are wrong. It's correct?
How can I solve this problem?
Thanks!!
The models are in OBJ format.
First I have follow this to read obj file:
http://cggmwww.csie.nctu.edu.tw/courses/cgu/2002/prog1.htm
It works, but only if in the file are stored vertex normals.
For example:
v -1.500976 13.063408 0.460043
vn -0.461797 0.858629 -0.222485
vt 0.000000 0.000000
But if the vertex normals are not stored in this manner, I'm not able to found a silhouette.
So, I have tried this code for read obj file:
http://www.gamedev.net/community/forums/topic.asp?topic_id=330992&forum_id=12&gforum_id=0
(third post, objread.h).
Whit this code, vertex normal are manually generated.
It works, but with some problems, for example:
http://img522.imageshack.us/img522/6122/10950779pk2.th.jpg (http://img522.imageshack.us/my.php?image=10950779pk2.jpg)
In this rendering, there are some wrong edges.
For me is because some normals are wrong. It's correct?
How can I solve this problem?
Thanks!!