Sign in to follow this  
Sante05

Help with sword trails

Recommended Posts

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!

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this