This. If Im understanding the issue right, thats definitely the problem. In the texture sampler filter, set everything to POINT instead of LINEAR. I remember finding the same "issue" the first time I did my pixel perfect sprite class.
What kind of filtering are you using?
I'm not sure if filtering applies to the edges of sprite renders but it may be worth looking at, since it's just changing a flag.
Linear is good if you will rotate the sprite, but for translation it leaves a ghost when the sprite moves/lies across/on coords that arent pixel perfect ( i.e. 1.06 pixels to righ)
I just tried doing as you describe with no discernible effect on the issue I am experiencing. Unless I'm doing something wrong.
To write the lines below I used this page for help which I found from Googling what you stated: http://www.toymaker....ler_states.html
If I have misinterpreted your instructions or not carried them out appropriately please let me know.
md3dDevice->SetSamplerState( 1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR ); md3dDevice->SetSamplerState( 1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR ); md3dDevice->SetSamplerState( 1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR ); md3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT ); md3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT ); md3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT );
If you want pixel perfect sprites you have to make sure that coordinates get mapped exactly to pixels. I think that is the problem you seem to experience.
I understand this to most likely be the case, but my last post here was about how it wasn't fixing the issue (or indeed making any noticeable change).
Do you mean you are using the Sprite class?
What the article describes sounds like it could be related to the issue I'm having.
This might help the issue.
The problem is, I'm not drawing a 2D texture to a surface. It's a standalone sprite. I'm unsure how I can deal with this.
What you need to do is shift your Projection Matrix to account for the issue. This is how i setup mine and it seems to work. I'm not a DX master by any means but give it a shot and see if it helps. My Coordinate system has 0,0 at the center of the screen and +Y is up.
Device.SetTransform(TransformState.Projection, Matrix.Translation(-0.5f, 0.5f, 0.0f) * Matrix.OrthoLH(_form.ClientSize.Width, _form.ClientSize.Height, 0, 1));
I've finally worked out that the reason I can't find these DirectX functions is because they don't exist, they're part of .NET but I'm not using it, I'm using the pure Win32 API. Do you know how I can replicate what you're doing here using normal DirectX functions?
Having since altered my code so I set the View Matrix and Projection Matrix, I'm currently setting my Projection Matrix in this manner:
D3DXMATRIXA16 projectionMatrix; D3DXMatrixPerspectiveFovLH(&projectionMatrix, fieldOfView, aspectRatio, closestZLimit, furthestZLimit); md3dDevice->SetTransform(D3DTS_PROJECTION, &projectionMatrix);