Model silhouette

Started by
16 comments, last by enigmagame 16 years ago
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: Screen 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!!
Advertisement
what is your approch of rendering the silhouette?
Quote:Original post by danw
what is your approch of rendering the silhouette?

I follow this document:
http://mrl.nyu.edu/~hertzman/hertzmann-intro3d.pdf
Specifically "Object Space Silhouette Detection" (Page 7-6)
Depending on how the data is stored in the *.obj file, you'll probably be able to calculate the normals yourself. That is actually what I did when i was writing a simple cell-shading/outlining algo.

Example Tri From The File:
Vert 1 ( 0, 0, 0 )
Vert 2 ( 0, 10, 0 )
Vert 3 ( 10, 0, 0 )

If you are using a clockwise winding order you can use the cross product to find the normals. Normal for Vert1, Vert2, and Vert3 in this case would be ( 0, 0, -1 )
Quote:Original post by enigmagame
...
In this rendering, there are some wrong edges.
For me is because some normals are wrong. It's correct?
...


What do you mean by "wrong edges"? What is the correct one in your mind?
Quote:Original post by ma_hty
What do you mean by "wrong edges"? What is the correct one in your mind?

For me, the correct image is this:
http://img337.imageshack.us/img337/5756/immagineli3.jpg
In the first image are also visible hidden edge, for example look
It looks like you're not enabling depth testing or your depth func is wrong.
Quote:Original post by glaeken
It looks like you're not enabling depth testing or your depth func is wrong.

No, depth testing is enabled.
How depth function I must use?
Thanks!
See this page for all the different depth comparators.
Quote:Original post by enigmagame
Quote:Original post by ma_hty
What do you mean by "wrong edges"? What is the correct one in your mind?

For me, the correct image is this:
http://img337.imageshack.us/img337/5756/immagineli3.jpg
In the first image are also visible hidden edge, for example look


What do you mean by "hidden edge"? Yours example looks arbitrary to me.

This topic is closed to new replies.

Advertisement