Sign in to follow this  

Poly Freckles

This topic is 4712 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 seem to be having a problem with tiny gaps in polys which are supposed to be aligned perfectly. I've hack-forced my vertex shader to align every vertex on a unit, so no vertex can be between single decimal integers, etc. This means they should have no error between them. For some reason, the sparkling is still coming through. Do the vertices have to be resting in the same exact spot to prevent this? Is it not possible to simply have two polys of different shapes be side-by-side? Does anyone know of a trustworthy hack or safe fix for this? Here's a visual for the problem. Notice the white dots. White because of a bright skybox. Thanks for any help

Share this post


Link to post
Share on other sites
Ah, nothing better than sparklies in the morning. Sparklies are generally caused by floating point error and/or vertices not being correctly positioned. T-junctions are a also a common cause of sparklies. Are you doing any CSG or scene partitioning?

Quote:
Original post by Jiia
I've hack-forced my vertex shader to align every vertex on a unit, so no vertex can be between single decimal integers, etc. This means they should have no error between them.


Maybe you could past this shader code so we can see exactly what you mean.

Quote:
Original post by Jiia
Does anyone know of a trustworthy hack or safe fix for this?


Sorry, but not without more information or knowledge of a the actual cause.

[Edited by - Sages on January 16, 2005 7:26:45 PM]

Share this post


Link to post
Share on other sites
I should have mentioned that the vertices are not welded. The maps are constructed with a single quad that changes positions and shape. So yes, you could say that my entire map is made up of partitioned quads. The sparklies are more of a problem in what I think you mean by T-junctions. Like where vertices are aligned beside another poly edge, but not by it's vertices.

The hack I mentioned in my shader was a temporary check I performed to see if having zero error would avoid the gaps, but it doesn't seem to matter. It was as simple as setting the vertex position coordinates to an int, then back to float. Basically to remove any digits beyound the decimal so that errors would be extremely obvious. The tiny sparkle gaps are still present.

The best fix I've found so far is to add a small bit of scaling onto each end of the quads (about 0.05, which is kind of a lot considering 1.0 is an inch). Doing this, the sparkles still show up, but require more distance from the camera to do so. It also feels like another hack, which I'm not sure will work as well on other cards.

Any ideas?
Thanks again, I appreciate it

Share this post


Link to post
Share on other sites
Quote:
Original post by Jiia
I should have mentioned that the vertices are not welded. The maps are constructed with a single quad that changes positions and shape. So yes, you could say that my entire map is made up of partitioned quads. The sparklies are more of a problem in what I think you mean by T-junctions. Like where vertices are aligned beside another poly edge, but not by it's vertices.


Yes, this sounds like a T-junction. It isn't difficult to implement an algorithm to tesselate surface to get rid of T-junctions. Once the T-junctions have been removed you'll want to snap your vertices together and after that sparklies should be nearly non-existant.

Quote:
Original post by Jiia
The best fix I've found so far is to add a small bit of scaling onto each end of the quads (about 0.05, which is kind of a lot considering 1.0 is an inch). Doing this, the sparkles still show up, but require more distance from the camera to do so. It also feels like another hack, which I'm not sure will work as well on other cards.


Whoa, what a hack! [grin] I've heard of people doing things like this before and I have to recommend against it. If you aren't careful with this method you'll just end up creating other visual artifacts. T-junction removal is the only real solution to your problem. I believe there was an article on T-junction removal in Game Gems 3 but if you don't have access to this tomb of knowledge there is alway [google]. If I can be of further assistance please let me know.

Share this post


Link to post
Share on other sites
if you don't clear the color buffer most of the sparkles will be unnoticable. you just have to make sure you don't have too much overdraw with your skybox, otherwise the skybox will show through rather than nearby pixels. if you cut your skybox in half and only draw the top half of the skybox it'll cut down on overdraw. anything below halfway isn't actually sky, its like gross world detail. its like making a skydome, but with a box :)

Share this post


Link to post
Share on other sites
Quote:
Original post by emosoft05
if you don't clear the color buffer most of the sparkles will be unnoticable. you just have to make sure you don't have too much overdraw with your skybox, otherwise the skybox will show through rather than nearby pixels. if you cut your skybox in half and only draw the top half of the skybox it'll cut down on overdraw. anything below halfway isn't actually sky, its like gross world detail. its like making a skydome, but with a box :)


Interesting suggestion, I think I like it. Relying on the previous frame buffer contents is something I had not thought of. I suppose this method is a viable solution. However, it still feels as though it's just another hack. I'm an advocate of fixing problems as opposed to working around them, so I'm going to have to stand by my previous solution as it is the 'proper' way. Anything else?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can't really get around dropouts if your geometry has t-junctions... there's really no way around it.

Share this post


Link to post
Share on other sites
I agree, kill the T-junctions. Overlapping geometry will be a killer later when doing blending, for lighting, shadows, etc. You can get double-lit spots, and it won't be pretty... ;)

Share this post


Link to post
Share on other sites
I've always heard problems from other users when not clearing the color buffer. I myself don't have them, but some people have said the screen flickers. It would be even worse to have flickering rainbow colored freckles. Does anyone know why this would happen? Their card settings are forcing 2 back buffers perhaps?

I appreciate the suggestions, but I'm forced to align the vertices. I was originally shooting for t-junctions because the maps were going to be very low poly. Something like a doorway would cause 2 edges down the center of a floor, on the back wall, and even up the ceiling. But the engine also uses static textured lighting (it's not calculated based on light positions, they will be generic shading textures rendered by hand). This means I would need a different shading texture around the doorway and on the backwall. So having a seperate poly there will just fit it all together.

My guess for the reason sparkles happen is because of the line tracing algorithm the API renders with. Having the vertices at seperate points makes the starting line for each poly fill begin and end on different pixels. In other words, drawing two oriented lines at the same angle but different starting points will probably not allow them to line up at some point. My guess anyways.

Thanks again

Share this post


Link to post
Share on other sites

This topic is 4712 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.

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