Jump to content
  • Advertisement
Sign in to follow this  
enigmagame

Model silhouette

This topic is 3793 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!!

Share this post


Link to post
Share on other sites
Advertisement
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 )

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!