Jump to content
  • Advertisement
Sign in to follow this  
jad_salloum

my images have blur why is that

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

hi guys i am loading my images as texture on a surface using textureloader.fromfile(device,filename) but when i draw it on a surface it becomes asif it is blured !!! i tried to load it using the same size and with filters but same blur prob , check these lines of codes i used and any suggestion would be gr8 , thanks in advance
    if (device.DeviceCaps.TextureFilterCaps.SupportsMinifyAnisotropic)
            {
                device.SamplerState[0].MinFilter = TextureFilter.Anisotropic;
            }
            else if (device.DeviceCaps.TextureFilterCaps.SupportsMinifyLinear)
            {
                device.SamplerState[0].MinFilter = TextureFilter.Linear;
            }

            // Do the same thing for magnify filter
            if (device.DeviceCaps.TextureFilterCaps.SupportsMagnifyAnisotropic)
            {
                device.SamplerState[0].MagFilter = TextureFilter.Anisotropic;
            }
            else if (device.DeviceCaps.TextureFilterCaps.SupportsMagnifyLinear)
            {
                device.SamplerState[0].MagFilter = TextureFilter.Linear;
            }

  //Filters used
            Filter _MyFilter = Filter.Linear;  // or using Filter.Triangle
            Filter _MyMipFilter = Filter.Point;

            VB = new VertexBuffer(typeof(CustomVertex.PositionTextured), 8, device, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default);

//i tried to load it using both ways

                  _TArrayButtomBoard = TextureLoader.FromFile(device, Utility.FindMediaFile(@"Media\NewBut\but_0000.png"));
// OR      
          _TArrayButtomBoard = TextureLoader.FromFile(device, Utility.FindMediaFile(@"Media\NewBut\but_0000.png"), Salloum.Game.frm.Twidth, Salloum.Game.frm.Thieght, 0, 0, Format.Unknown, Pool.Default, _MyFilter, _MyMipFilter, 0);
      
//and i draw it using the following :

	device.SetTexture(0, _TArrayButtomBoard );
				device.TextureState[0].ColorArgument1 = Microsoft.DirectX.Direct3D.TextureArgument.TextureColor;
				device.TextureState[0].ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.SelectArg1;
				device.TextureState[1].ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Disable;
				device.VertexFormat = CustomVertex.PositionTextured.Format;
				device.SetStreamSource(0, VB, 0);
				device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);


Image and video hosting by TinyPic Image and video hosting by TinyPic

Share this post


Link to post
Share on other sites
Advertisement
I dont think you've included enough details for us to give you a full answer.

D3DX can and will resize non 2N images when creating a texture. What are your source dimensions?

What texture coordinates are you using? If you're trying to do "2D in 3D" then incorrect texture coordinates combined with filtering will often lead to blurry/distorted results. Check the classic 'Directly Mapping Texels To Pixels' article in the SDK help files. But At a guess your CustomVertex.PositionTextured would suggest this is regular 3D geometry - correct?

I'm not sure what your two images are - is the top one the results you're getting (looks a little blurrier) and the bottom one what you wanted to achieve?

hth
Jack

Share this post


Link to post
Share on other sites

thanks guys for ur reply , i am using a texture with size 720x576 and i am drawing this texture using a vertex buffer of 4 vertics position textured

{-10,0,10} , {10,0,10} , {10,0,-10} , {-10,0,-10}

and it is in 3D and the buttom image is what i want to achieve .

and for the filtering i am using for mipfilters point filter and for the filter linear filter

and could anyone tell me how to load my images in the best way with the best filtering ??

thanks for all

Share this post


Link to post
Share on other sites
Quote:
Original post by jad_salloum
i am using a texture with size 720x576
That is definitely not 2N - what is the size AFTER you've loaded it. Use IDirect3DTexture9::GetLevelDesc( 0, ... ) and inspect the height/width properties. You might find that D3DX re-sampled it up to 1024x1024. If this is the case, try using D3DX_DEFAULT_NONPOW2 as the height/width when calling D3DXCreateTextureFromFileEx().


hth
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!