XNA Creators Club Online
Page 1 of 1 (11 items)
Sort Posts: Previous Next

Png texture color nullifying

Last post 6/5/2009 6:19 PM by George Clingerman. 10 replies.
  • 6/4/2009 10:27 PM

    Png texture color nullifying

    Hey I just ran into 2 small problems

    the first is I forget how to make XNA forget about a backdrop color but now I can't remember the RGB values I need to use to make the backdrop unreadable by XNA

    The second is that I forget how to do rotation If someone could refer me to a XNA 3.0 tutorial It would be helpfull

    Thanks!
  • 6/5/2009 12:35 AM In reply to

    Re: Png texture color nullifying

    I don't quite understand what you are asking. Can you please elaborate? ^.^
  • 6/5/2009 1:41 AM In reply to

    Re: Png texture color nullifying

    theallunKnowing1:
    the first is I forget how to make XNA forget about a backdrop color but now I can't remember the RGB values I need to use to make the backdrop unreadable by XNA


    Maybe you are talking about how the pipeline by default makes the color magenta transparent on a texture?

    theallunKnowing1:
    The second is that I forget how to do rotation If someone could refer me to a XNA 3.0 tutorial It would be helpfull


    Rotation can be done a number of ways, but you are probably looking to apply a rotation matrix to a model.  Just create one using Matrix.RotationX(...
    Use RotationX, RotationY, and RotationZ depending on what axis you want to rotate around.
    Also, you can rotate a 2d sprite with SpriteBatch - it is a parameter in one of the overloads.  Be sure to identify the point you want the rotation to occur around or it might not rotate correctly.
  • 6/5/2009 2:15 AM In reply to
    • (23)
    • premium membership
    • Posts 74

    Re: Png texture color nullifying

    The color does not matter.  Simply set the A-value to 0 for any color.
  • 6/5/2009 2:04 PM In reply to

    Re: Png texture color nullifying

    App:
    The color does not matter.  Simply set the A-value to 0 for any color.


    Sorry "A" value?

    I have GIMP so I haven't seen any A value in the color editor if there is an A value I'm not sure where it is.

    If it is in fact either the R, the G or the B value please tell me which one it is

    Thanks
  • 6/5/2009 2:30 PM In reply to

    Re: Png texture color nullifying

  • 6/5/2009 3:33 PM In reply to

    Re: Png texture color nullifying

    If you are asking what the default color for transparancy is, then it is magenta. This is R-255, B-255 & G-0

    Note that you can set the transparency color to whatever you want. In Visual Studio, right-click your image in the solution explorer, select properties, expand the content processor field and the color is set in the color key field. This is handy if your sprite actually uses magenta and you want a different color for transparancy.
  • 6/5/2009 4:16 PM In reply to

    Re: Png texture color nullifying

    Thanks

    that was really helpfull from now on I think I'll change the transparency color to Black since i'm making a space shooter :)
  • 6/5/2009 4:19 PM In reply to

    Re: Png texture color nullifying

    Oh and by the way I fixed my sprite rotation problem after a bit of messing with my code

    :)
  • 6/5/2009 5:39 PM In reply to

    Re: Png texture color nullifying

    theallunKnowing1:
    Thanks

    that was really helpfull from now on I think I'll change the transparency color to Black since i'm making a space shooter :)


    Before you do, that is probably a bad idea. Surely one of your sprites will use black somewhere other than the background? The reason magenta is the default is because it is such a horiffic, gaudy colour that no-one would ususlaly use it in an actualy sprite =D
  • 6/5/2009 6:19 PM In reply to

    Re: Png texture color nullifying

    If you're using PNG files (and it sounds like your using GIMP) the best thing to do is to actually make the parts transparent that you want transparent instead of using some color.

    To do that in GIMP, simple right click on the layer and say add Alpha Channel. Now use the color selector tool to select the areas of color you want to be transparent. Once they're selected, simply hit delete. You'll see the color goes away and that's not a transparent area (by default you should see a checkered background in GIMP for transparent areas). Now just save your PNG file and viola, no need to mess with setting any colors as a transparent color.
Page 1 of 1 (11 items) Previous Next