Help with sword trails

Started by
6 comments, last by Sante05 17 years, 7 months ago
Hi, I just implemented a "sword trails" effect in the project I'm working on, but I'm having some rendering artifacts. Have tried to find the cause, unsuccessfully, so I'd really appreciate some help on it. As you can see in this zoomed in pic, it looks just like aliasing. It's more visible the slower the sword moves. What I'm doing here is rendering a triangle strip as the sword moves. No textures involved so far, just vertex colors and alpha blending. So, if you've implemented this effect before, or ran into this same problem, how did you solve it? Thanks!
-----DevZing Blog (in Spanish)
Advertisement
Pretty much a guess, but I'm thinking that triangles are overlapping slightly with their neighbors. How could you fix this? Not sure, but mabye using fewer triangles will help.
I agree with Ezbez, it looks like parts of the triangles are overlapping. The only way that I can think of to fix it would be to use a triangle fan.

Looks pretty cool btw.

Good luck!
Quote:Original post by Ezbez
Pretty much a guess, but I'm thinking that triangles are overlapping slightly with their neighbors. How could you fix this? Not sure, but mabye using fewer triangles will help.


Yeah, I think as well that is caused by overlapping triangles. Using fewer triangles reduces the problem, but doesn't solve it, though (even when extremely reducing the number of them, there are still artifacts in their shared borders)

Also, I found out it's not really related to the speed the sword is moving, but with if the sword is turning or not. In this new capture you can see same sword, almost same speed, same number of triangles, and way fewer artifacts. Only difference: the guy's not twisting the sword around, but rather moving it vertically.

-----DevZing Blog (in Spanish)
as Programmer16 suggested, try using a Triangle fan. Other than that, you could try to filter out the artifacts... Have a loop scan through the positions of the pixels along the shared borders and just set any errant pixel to the right color/alpha... It is a difficult, Incredibly inefficient, and Incredibly stupid way to do it, but it should work.
There was a saying we had in college: Those who walk into the engineering building are never quite the same when they walk out.
Are you truly sharing vert postions in the strip?

Quote:Original post by medevilenemy
as Programmer16 suggested, try using a Triangle fan. Other than that, you could try to filter out the artifacts... Have a loop scan through the positions of the pixels along the shared borders and just set any errant pixel to the right color/alpha... It is a difficult, Incredibly inefficient, and Incredibly stupid way to do it, but it should work.


Not a triangle fan - a triangle strip with shared vertices at shared borders.
Well, solved it. It turned to be rather easy after taking some sleep [rolleyes]

The problem happened because I was getting the hand's position to create the inner vertices of the strip. When rotating, the hand almost doesn't move, so I'm getting lots of almost degenerated triangles, in some cases overlapping each other and such.

To solve it, I'm just taking a different inner point, in the lower part of the sword, rather than the hand itself. It's a quick fix, sure, but we need to get a demo working for next week, and have to work on some bigger issues, so no time to rewritting the whole thing.

Thanks for the help!
-----DevZing Blog (in Spanish)

This topic is closed to new replies.

Advertisement