Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Venerable Vampire

Software 3D Engine

This topic is 5230 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'm doing a software renderer as a little summer project, and I want to emulate some of the NeHe demos. I wanted to do a colored triangle like opengl can do with a different color at each vertex and smooth blending across the shape. I was able to do this using barycentric space and triangles and it looked pretty cool. The Screeny Now the question is: is there a better way to do this than what I'm doing? If not, what are some things to look out for to cause the tearing I'm seeing? Thanks a bunch! -------------------------------------------------------- Life would be so much easier if we could just get the source code. [edited by - Venerable Vampire on May 29, 2004 12:25:17 PM]

Share this post


Link to post
Share on other sites
Advertisement
I can''t honestly say that I have a lot of experience iwth a software engine, but typically when you have tearing like that, it means that you''re rendering a new position of the triangle in the middle of a moniter update. One way (and probably the simplist) to fix this is with vsync. Since stuff in this forum is supposed to be non-API specific, and the only way I know how to do it is through D3D device setup, I''m afraid I can''t give you any more details. That''s probably what you''ll want to do, though.

Share this post


Link to post
Share on other sites
The common way to interpolate a color accross a triangle for smooth blending is Gouraud shading, which only requires a few add operations for each pixel. Interpolate R,G,B linearly accross each edge of the triangle to get the color at the left and right edges, then for each scanline, interpolate linearly between the two. (That is, find the "slopes" dR/dx, dG/dx, ... and then just add onto the original R,G,B values as you move accross the line). Take a look at http://freespace.virgin.net/hugo.elias/graphics/x_main.htm or http://exaflop.org/.

Share this post


Link to post
Share on other sites
When rasterizing triangles of the type shown in your screenshot they are split into two triangles. That tear is just caused by a bug in the code of whoever wrote it. The programmer appears to be bounding both triangles to be ''less'' than the split line so there appears to be two scan lines missing from the final triangle.

Share this post


Link to post
Share on other sites
Well thanks everyone, I''ll look into the shading techniques.
And haro, I''m hurt... talking about me like I''m not here ("the programmer", sheesh)

--------------------------------------------------------
Life would be so much easier if we could just get the source code.

Share this post


Link to post
Share on other sites
quote:
Original post by Venerable Vampire
Well thanks everyone, I''ll look into the shading techniques.
And haro, I''m hurt... talking about me like I''m not here ("the programmer", sheesh)



Haha.. no offense. I had assumed that the first place you would have looked for the cause of the artifact would have been in your triangle splitting code. I further assumed that since you had not done this, it was likely that you did not write the splitting code yourself. Too many assumptions adds up to ass sometimes.

Share this post


Link to post
Share on other sites
Actually I haven''t implemented triangle splitting yet. The splitting is just really weird. I''ll get around to fixing it ... eventually

--------------------------------------------------------
Life would be so much easier if we could just get the source code.

Share this post


Link to post
Share on other sites
What??? What algorithm are you using to rasterize the triangles if you''re not splitting? This seems extremely unusual, especially considering that, that screenshot has the artifact exactly where you would split.

Share this post


Link to post
Share on other sites
I''m not sure what you mean by splitting. I''m just taking each projected edge, running it through the scan converter, and drawing the resulting scan lines. There is no need to make the 1 triangle anything other than 1 triangle. Wouldn''t splitting imply that only part of the triangle is valid, and therefore we need at least 2 triangles? Not sure if this makes sense but whatever...

--------------------------------------------------------
Life would be so much easier if we could just get the source code.

Share this post


Link to post
Share on other sites

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