Sign in to follow this  

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

This topic is 3488 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

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,¢er,&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!!!!!!!!!!

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites



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!!!!

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Sorry, but can't imagine why the outline's still there. Did you use the bucket tool multiple times (without anti-alias?!!!) on the pink background? Did you use the sharpen filter? And the TextureFilter within DirectX?
How do you show the picture in DirectX? As a texture on a mesh?

Share this post


Link to post
Share on other sites
You might have more success posting this in the Visual Arts forum, since it's a problem with Photoshop rather than D3D (The alpha isn't correct where you think it is).

Share this post


Link to post
Share on other sites
Quote:

d3dsprite->Begin(D3DXSPRITE_ALPHABLEND);

and just make the png picture has the transparent part or semi transparent.. don't make the BG of your sprite HOT PINK,,just delete the BG (it will be transparent in Photoshop) then it will be also transparent in DX...but make sure you include the code above..

it's really simple,isn't it? hehe

Share this post


Link to post
Share on other sites

This topic is 3488 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