Results 1 to 15 of 15

Thread: [RESOLVED] XNA: Poor Texture Quality

  1. #1

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Resolved [RESOLVED] XNA: Poor Texture Quality

    I am having some problems with my 2d textures in XNA. For some reason the quality is coming out all blury. I am using PNG format files for this. Is there anything obvious that may be making it blury?

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: XNA: Poor Texture Quality

    Are you scaling the textures? Have you made sure that they are drawn with the scale 1.0f?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Re: XNA: Poor Texture Quality

    Where about's would this be done?

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: XNA: Poor Texture Quality

    When you draw the texture using the SpriteBatch there's an overload that lets you set the scale as a floating point number, where 1.0f would be original scale.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  5. #5

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Re: XNA: Poor Texture Quality

    Ok would it go in this line?

    Code:
    MainSB.Draw(Textures("Frame"), FrameRect, Color.White)

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: XNA: Poor Texture Quality

    Yeah, it appears as if you are not using the overload that sets the scale..so it should default to 1.0f. But still, try explicitly setting the scale to 1.0f by using an appropriate Draw overload.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Re: XNA: Poor Texture Quality

    To be honest I don't really know what you mean by draw overload. Could you explain an maybe give an example?

  8. #8
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: XNA: Poor Texture Quality

    Try something like this:

    Code:
    MainSB.Draw(Textures("Frame"), FramePosition, null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 1)

    Where FramePosition is a Vector2 denoting the position of the texture. Try that.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  9. #9

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Re: XNA: Poor Texture Quality

    Ok when using that I am getting the following error:

    'Null' is not declared. 'Null' Constant is no longer supported, use 'system.DBnull' instead

  10. #10
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: XNA: Poor Texture Quality

    Ah yes, you appear to be using VB.NET, use Nothing instead.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  11. #11

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Re: XNA: Poor Texture Quality

    Ok that work's without any errors but doesn't solve problem it seems a bit more clearer but it is not the original size i created it. Maybe if i post some screen shots. The left image is what it looks like rendered and the right is the original image created in photoshop.
    Attached Images Attached Images   

  12. #12
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: XNA: Poor Texture Quality

    Try this. Double the size of your texture images in Photoshop, then in the game, apply a 0.5 scale to them. They should retain more of their crispness.

    Also, let me look at how to tell XNA to turn on anisotropic filtering. This will definitely help your texturing issues.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  13. #13

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Re: XNA: Poor Texture Quality

    I have tried that and for some reason it wasn't drawing it to half the size it was stretching the width out. I don't really understand why it's doing this as i'm not doing anything different to the last game and that textured came out perfect on there.

    By the way still haven't got the installer to work on the last game. If I open the exe from the prject file it works fine but if i create an installer using the exe file it brings up the windows error message.

    Not having much luck with XNA

  14. #14

    Thread Starter
    Addicted Member mouse88's Avatar
    Join Date
    Mar 2009
    Location
    South Wales, United Kingdom
    Posts
    225

    Re: XNA: Poor Texture Quality

    Ok problem solved. In my first game the graphics were done in Photoshop CS2 and in this I did them in Photoshop 7. I have re-installed CS2 and redone the graphics and for some reason they now look fine.

  15. #15
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: [RESOLVED] XNA: Poor Texture Quality

    Weird. PS7 must have done something funky with anti aliasing.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width