Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to automatically load textures associated with a 3D model


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Anzipane   Members   -  Reputation: 105

Like
0Likes
Like

Posted 23 January 2013 - 01:35 PM

Hi,

I'm trying to figure out how to automatically load textures (associated with a 3D model) into XNA without having to load them manually (like BasiEffect does for example, you just need to load the model).

Now, I can't use the BasicEffect class because I'm using a custom effect to draw the models, so how can I proceed with this? Do I have to make a Custom content processor or what? Thanks.

 

 



Sponsor:

#2 BornToCode   Members   -  Reputation: 904

Like
0Likes
Like

Posted 23 January 2013 - 05:16 PM

As long the texture name is part of the file you can have your loader extract the name and load it. Alot of the time the texture path will point to something that is usually match whoever did the export. So the filepath will be very different then what you have on your machine. So what you can do in that case is assume that the texture needs to be in the same path as the model and just extract the name and load it in your content loader.


Edited by BornToCode, 23 January 2013 - 05:16 PM.


#3 Tarika   Members   -  Reputation: 481

Like
1Likes
Like

Posted 25 January 2013 - 04:06 AM

As the saying goes, why re-invent the wheel. The default behaviour for the  ModelProcessor loads associated textures into into BasicEffect instances, so the least complicated way to load the textures and use your own effect is to load the Model then replace the effects with your own versions (copying the textures from the old BasicEffect instances). 

 

If you are writing your own ModelProcessor where you set a custom effect upon build, then I'd recommend looking at the skinned model example as that demonstrates replacing  effects in a content processor: http://xbox.create.msdn.com/en-US/education/catalog/sample/skinned_model

 

There is no need for you to do this manually, so get studying and good luck :)

 

Aimee


We are now on Tumblr, so please come and check out our site! 

 

http://xpod-games.com


#4 Anzipane   Members   -  Reputation: 105

Like
0Likes
Like

Posted 27 January 2013 - 10:18 AM

Thank you AmzBee for your detailed reply :)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS