0
\$\begingroup\$

Is there any way to have the texture of a model loaded from a Png ?

I have a simple prism to test it on, but i just want to be able to edit an image and have the model's texture change.

Thanks!

\$\endgroup\$
  • \$\begingroup\$ Start here and extrapolate your solution. \$\endgroup\$ – Jonathan Dickinson Dec 7 '11 at 11:12
  • \$\begingroup\$ Crap, I once wrote the perfect tutorial on this for you but it was on Ziggyware which unfortunately went down and I don't have a backup :(. \$\endgroup\$ – Roy T. Dec 8 '11 at 9:22
1
\$\begingroup\$

You can use a png as a texture. First you have to add it to the game project content :

http://msdn.microsoft.com/en-us/library/dd282477(v=XNAGameStudio.40).aspx

And then you call Load method of ContentManager :

http://msdn.microsoft.com/fr-FR/library/bb197848(v=XNAGameStudio.40).aspx

You can access the ContentManager through the Content properties of Game class :

http://msdn.microsoft.com/fr-FR/library/microsoft.xna.framework.game.content(v=XNAGameStudio.40).aspx

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ But how can i actually render it onto the model? Also how can i know what configuration the texture should be in to fit onto the model? \$\endgroup\$ – Joel Dec 7 '11 at 10:15
  • \$\begingroup\$ To render a texture on a model, it had to have uv coordinate. Does your model comes from a graphics software? The easiest solution to do this is to use a graphics software such as 3DS Max, Maya or Blender. You will draw a model and then apply a texture to it. Then these software will give you a file containing all informations about your model. After you just have to add it to your project and load it. \$\endgroup\$ – Julien Pires Dec 7 '11 at 10:30
  • \$\begingroup\$ It was done in Sketchup as a 2 second throw together. I guess i'll load it in 3ds or whatever now to check it out. \$\endgroup\$ – Joel Dec 7 '11 at 10:31
  • \$\begingroup\$ By searching google i find these links wich can help you : jamesewelch.com/2008/03/07/… and wiki.flightgear.org/Textures_%26_Texture_Maps_in_SketchUp \$\endgroup\$ – Julien Pires Dec 7 '11 at 10:36
  • \$\begingroup\$ Ahh there we go, didn't know that the textures would be stored outside the .x Thanks for the links :) \$\endgroup\$ – Joel Dec 7 '11 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.