Jump to content
  • Advertisement
Sign in to follow this  
Unresolved External

problem retrieving material-color when importing model

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

[color=#4A4A4A][color=#526569][font=verdana, arial, helvetica, sans-serif]Hello!I've created a model in Blender and want to load and draw it in XNA.The model has materials assigned to it. If I use the BasicEffect class it can find the materials and draw the model in its correct colors. But If I use my own shader it complains that "COLOR0 is missing", I guess this is because it doesn't have colors assigned to its vertices, since I also tried to export the model with vertex paint instead. It sort of worked for .fbx except that the different model parts weren't coherent, for .x it didn't work at all.[/font]


[color=#4A4A4A][color=#526569][font=verdana, arial, helvetica, sans-serif]I've looked through the model-file (tried with both .x and .fbx), and found that the materials are listed there, with the correct color values. Inside the ModelMeshPart I also found a parameter called DiffuseColor, if I output that the values are always (0, 0, 0, 0),not as in the model-file.[/font]


[color=#4A4A4A][color=#526569][font=verdana, arial, helvetica, sans-serif]So my question is, how can I retrieve the correct material properties from my model and get them into my shader? How does the BasicEffect do it?[/font]

Share this post


Link to post
Share on other sites
Advertisement
i know this is probably pretty obvious, but it might not even apply since i have never used xna. but are you sure you have a color component in your vertex structure? and if you do, are you making sure to set the input layout correctly (if xna even uses an input layout, i really don't know, just suggesting)

Share this post


Link to post
Share on other sites
Thanks for the reply! I'm using the pre-defined class Model in XNA. I'm not sure which vertex declaration it uses internally. It has a vertex buffer but in the reference I can't see which type of vertex declaration it is using.

I guess it is using "VertexPositionNormalTexture" as vertex declaration which has no color member:
http://msdn.microsof...re_members.aspx

That might be why I'm getting that error in my shader. Does anyone know which vertex delcaration the Model class is using and if it is possible to change it?

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!