• Advertisement
Sign in to follow this  

How to store different texture coordinates?

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

Hi, how can I store different texture coordinates into one DirectX .x file? I tried to export an object which has 2 different uv channels from 3ds max using the Panda DirectX Exporter. But it always exports the first uv channel only... Thanks, Christian

Share this post


Link to post
Share on other sites
Advertisement
I would like to know this also. I did some research and apparently panda can export two texture coordinates, however the second uses FVFData.

Some info on that here: http://groups.google.com/group/microsoft.public.win32.programmer.directx.graphics/browse_thread/thread/ef692033357a85f1/29c54b9c6b390cec?&hl=en#29c54b9c6b390cec

Seems like a major pain to me. If you find an easy way to do it, I'd like to hear about it.

For my needs, I could use the same texture coordinates for both textures. So I cloned the mesh using CloneMeshFVF, locked the index and vertex buffers, and copied the coordinates from the first set into the new set that I had created with CloneMeshFVF.

However, this seems like a silly way to do things. If anyone has any better ideas, I'd like to hear them.

Share this post


Link to post
Share on other sites
The DirectX .X format can certainly support more than one texcoord set. I'm not sure if this is some error with the Panda exporter, but are you sure there isn't a setting in the exporter for multiple texcoords? IIRC, that exported had a lot of options, I doubt it fails at exporting 2 texcoord sets.

Have you tried saving as .3ds and using conv3ds.exe? Do you get the same problem?

Are you sure the model is actually saved with only one texcoord set? Does the format have the TexCoord1 flag, and not the TexCoord2 one?

Quote:
Original post by Zee Man
For my needs, I could use the same texture coordinates for both textures. So I cloned the mesh using CloneMeshFVF, locked the index and vertex buffers, and copied the coordinates from the first set into the new set that I had created with CloneMeshFVF.

However, this seems like a silly way to do things. If anyone has any better ideas, I'd like to hear them.


You can set 2 textures to use the same set of texcoords. I'm assuming you're using the FFP, in which case, look into D3DTSS_TEXCOORDINDEX.

If you're using shaders, you can duplicate the texcoords in the VS, so you'll have two sets of coords in the PS. If you're using PS2.0 or higher (this might work in 1.4 as well), you can just use one set to sample two textures.

If you're drawing transformed vertices with PS1.x, then you're out of luck.

Hope this helps.

Share this post


Link to post
Share on other sites
Thanks for the help, sirob. I'll look into TEXCOORDINDEX.

As for panda, on the version history page of the website it says:
Quote:

Multi UV Texture coordinate support via the FVFData template (see DirectX9 SDK)

Note: Only the UVW map modifier(s) will be exported with their settings, not the settings applied in the material selection. So multiple map modifiers need assigning to different channels as part of the model. Channel 1 is the default channel which will still appear in the default TexCoordinates template. All subsequent channels, 2 onwards will be placed in the FVFData. Of course you can't specify more than one texture filename per material, but your application can fill in the details. Tested with Quest3D 2.2 demo version.

Share this post


Link to post
Share on other sites
Quote:
Original post by MrSparkle
Hi,
how can I store different texture coordinates into one DirectX .x file? I tried to export an object which has 2 different uv channels from 3ds max using the Panda DirectX Exporter. But it always exports the first uv channel only...
Thanks,
Christian



Try to add UVW Map (or other mapping modifier) and in the "Map Channel" paramater set appropriate texture layer number. Second (and above) coordinates will then be exported as FVFData, but usually you doesn't need to make any special data handling. D3DXLoadMeshFromX() should load mesh correctly with multiple coordinates.

Share this post


Link to post
Share on other sites
I applied two texture coordinates using the UVW Unwarp modifier, then exported the object with the Panda Exporter. It stored only the first uv channel into the texture coordinates and the second into the FVF data section. Isn't the x file format intended to store more than one (in my case three or four) different texture coordinates for different texture maps (e.g. diffuse map, dirt map and light map) without any converting and maipulation before rendering using my shaders?

Share this post


Link to post
Share on other sites
Btw. what exactly is the FVFData and how can I access it in the vertex and pixel shaders?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement