Sign in to follow this  
sqpat

d3dxsprite border issues and texel-pixel mapping in 3d?

Recommended Posts

I understand the whole texel-pixel filtering issue that causes the problems with averaging the edges of a texture with the transparent pixels getting something ugly and halfway in between. However I don't know how to fix this while using world space and not screen space coordinates. It would see that in screen space youd just add an 0.5 pixel offset wherever you're drawing but in 3d the coordinates dont match pixels on screen. I've seen other solutions elsewhere on searches, such as texture clamping or point filters, but it doesnt fix the issue. I don't want to use a hack like setting a D3DRS_ALPHAREF render state cutoff, either. I think i would want to be setting an 0.5 u/v offset but I don't know how to do that with d3dxsprite. What should i do?

Share this post


Link to post
Share on other sites
Well, you can't really clamp to pixel centers for 3D coordinates because your object will always move one whole pixel at a time and that wouldn't look good.

Usually you don't care about that with 3D objects/sprites. Do you have a screenshot to show the artifacts you want to get rid of?

Share this post


Link to post
Share on other sites
http://sqpat.com/project/mysample23-spriteobjectsbetter.PNG

it's those bushy things. those bright green borders are incorrect (0,255,0 is the transparent color and thats why its becoming that way)

Share this post


Link to post
Share on other sites
i'm also getting the same issue for my triangles in 3d. i tried offsetting the u/v values by various amounts but it didnt work. what is it supposed to be, 0.5/texture size? 0.5/viewport dimensions? 1.0/viewport dimensions? I've seen various answers online but they still seem to mostly be talking about 2d!

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