dx displaying 2d images/sprites/pre-rendered 3D

Started by
17 comments, last by marc_moy 15 years, 10 months ago
guys, i need help.. you see the image above? there are two kinds of line.. i chose hot pink(R:255 G: 0 B:255) as the transparent portion of the images. the anti-aliased line leaves a very bad outline! so i know this is where Pixel art comes..BUT! i want my graphics to be pre-rendered! i model in 3dsmax then render it as png then load it in DX BUT!! the outline of the image(e.g cube) is anti-aliased!! so how can i solve this? btw, this is what i use to render 2d graphics
Quote: d3ddev->BeginScene(); sprite->Begin(D3DXSPRITE_ALPHABLEND); D3DXVECTOR3 center(0.0f,0.0f,0.0f); D3DXVECTOR3 pos(0.0f,0.0f,0.0f); sprite->Draw(d3dtex,&r,&center,&pos,D3DCOLOR_XRGB(255,255,255)); sprite->End(); d3ddev->EndScene(); d3ddev->Present(0,0,0,0);
ive already tried to turn ON the Antialias(d3ddev->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE,TRUE); BUT,,no changes..please help me!! thanks GUYS!!! THANKS A LOT!!!!!!!!!!
Just DO it!
Advertisement
Ok, I create my 2D Models in Cinema4D, too and had the same problem as you.
Solution seems pretty simple: I opened the image in Photoshop and chose the paint bucket tool. I turned anti-alias off (little checkbox on top) and just colored it.
That makes it look very sharp, but if you use the linear-texture-filter of DirectX it looks pretty good (maybe I would use the sharpen filter in Photoshop, too, it fits pretty good with the linear filter, I think).

Hope I could help ;-)
Can we see a screenshot? It sounds like your backbuffer isn't the same size as your client area, so D3D is stretching it to fit. Are you using AdjustWindowRect() to get the correct client area size?
yes!! my back buffer area is 640x480 and YES my image is 640x480 also..it isn't stretched.

Quote:
Ok, I create my 2D Models in Cinema4D, too and had the same problem as you.
Solution seems pretty simple: I opened the image in Photoshop and chose the paint bucket tool. I turned anti-alias off (little checkbox on top) and just colored it.
That makes it look very sharp, but if you use the linear-texture-filter of DirectX it looks pretty good (maybe I would use the sharpen filter in Photoshop, too, it fits pretty good with the linear filter, I think).

Hope I could help ;-)


how to turn off the anti-alias in photoshop??
and
linear-texture-filter??? how is that??

which is better?

can you show me some screenshots?

thanks GUYS!!

Just DO it!



can you see the image above?

the outline is still ugly though its small but IT IS INDEED VISIBLE!
what about what chicken90 said? about
Quote:
linear-texture-filter of DirectX


how can i use that? will it remove ugly outlines?? thanks!!!
THANKS GUYS!!!!
Just DO it!
Quote:Original post by marc_moy
yes!! my back buffer area is 640x480 and YES my image is 640x480 also..it isn't stretched.
What makes you think it's antialiased then?
the line's outline is semi transparent...
while the 2 line(outer) are solid lines.. like what paint does..
Just DO it!
So the cube you're rendering is a pre-rendered object? In that case, it's just that your source texture is wrong, and probably has a bad alpha channel.
Ok, in Photoshop u turn the PaintBucket-AntiAlias off with the little checkbox on top (when you have chosen the tool). It's there at least in my CS2 Version.

So, if there is still a pink outline, use the paint-bucket multiple times.
That should do just fine.

This is how you turn on the Filtering in DirectX:
SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
(At least you do so in Delphi)
ITS 3dsMax 8!
Just DO it!

This topic is closed to new replies.

Advertisement