Skip to main content
GameDev.net gamedev.net
🔒 Locked

Multiple Texture Coordinates?

Started by SeraphLance Oct 8, 2008 at 2:59 PM 2 replies 850+ views
Original Post
SeraphLance
SeraphLance
I'm currently (have been for a long time, actually) trying to get a shader to work in XNA with a .FBX file, but after reading about the situation, I've come to understand that the FBX importer (as of XNA 2.0) does not support multiple texture coordinates. Therefore, my question is as follows: Is there any way to overwrite the FBX file importer, and if so, where do I find documentation on this? MSDN has something, but it doesn't mention overwriting a standard importer, only extending a standard processor and creating a completely new importer, so I'm not sure if it works the same way. Or: Is there a way to add another set of texture coordinates at runtime, and how? I imagine, if this is practical, it involves editing the vertices directly, but I don't really know how to navigate the hierarchy of a model.
MJP
MJP
I don't know too much about importers, but you should be able to roll your own custom importer for any type you want. However as I understand the new FBX importer in XNA GS 3.0 supports multiple sets of texture coordinates, so you could just wait for that or use the beta.

As for adding a set of texture coordinates, you'd probably want to do that in a custom processor. Your processor will already have all the generic form, and would be able to look at the existing vertex channels to determine the amount of texture coordinates sets present. You could then add a new channel for the second set of coordinates, and assign any value you want.
SeraphLance
SeraphLance
Until now, I've been avoiding waiting for XNA 3.0 on account of how far away it was, though that's not nearly as big a deal now with it close to release, so I might just do that. There are still a few things I can touch up on before the graphics become the absolute last thing to work with.


Quote:
Original post by MJP
As for adding a set of texture coordinates, you'd probably want to do that in a custom processor. Your processor will already have all the generic form, and would be able to look at the existing vertex channels to determine the amount of texture coordinates sets present. You could then add a new channel for the second set of coordinates, and assign any value you want.


By vertex channels, are you referring to the stuff in Microsoft.Xna.Framework.Content.Pipeline.Graphics, or something else?
MJP
MJP
Quote:
Original post by SeraphLance

By vertex channels, are you referring to the stuff in Microsoft.Xna.Framework.Content.Pipeline.Graphics, or something else?


Yup. More specifically, VertexChannel and VertexChannelCollection.

Basically you'll have one channel for each element in your vertex declaration, with each channel having an element for every vertex in the mesh. So to add a new texture coordinate, you'd make a new channel with and fill it with the coordinates for every vertex.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.