Archived

This topic is now archived and is closed to further replies.

Kryptus

3D Studio MAX 3 Texture problems with DX

Recommended Posts

I use DX8 and 3D Studio MAX R3, when i make a scene i use the material editor and tile a texture on ground for example but when insert it into DX the scene isn''t tiled! The textures are stretched! why does it do this? do i need 3D Studio MAX 4? please help me out here

Share this post


Link to post
Share on other sites
It seems like you have to change texture addressing mode from clamping the texture to repeat it. I am not so much into DirectX so I couldn''t give you the exact function call but I am sure you will find it in MSDN. I hope it helps.

Share this post


Link to post
Share on other sites
You have to access the parameters called "repeat" and "offset" in 3DSMax (that''s if you''re doing your wn exporter) and convert it to a texture matrix.

I guess something like:

[ repeatU 0 0 offsetU ]
[ 0 repeatV 0 offsetV ]
[ 0 0 repeatW offsetW ]

and associate it with the right texture stage (SetTextureStageState)

Next You have to read the wrapping mode under 3ds max : some checkbox named "tile" and "mirror" and call the corrresponding D3D state when using this texture.

Note that for this purpose it is convenient to use 2 struct/class to store a given texture:

CTexture
{
LPDIRECT3DTEXTURE8 pTex;

//...
}

CTransformedTexture
{
CTexture* pTexture; //use an ID instead of a pointer if you want

enum eWrapMode
{
WRAP_REPEAT,
WRAP_MIRROR,
WRAP_CLAMP
//...
};

eWrapMode m_wrapModeU,
m_wrapModeV,
m_wrapModeW

TextureMatrix m_texMat;
};

It would be dumb to reload a texture in memory simply because it is warped or tiled differently.

Share this post


Link to post
Share on other sites
You have to access the parameters called "repeat" and "offset" in 3DSMax (that''s if you''re doing your wn exporter) and convert it to a texture matrix.

I guess something like:

[ repeatU 0 0 offsetU ]
[ 0 repeatV 0 offsetV ]
[ 0 0 repeatW offsetW ]

and associate it with the right texture stage (SetTextureStageState)

Next You have to read the wrapping mode under 3ds max : some checkbox named "tile" and "mirror" and call the corrresponding D3D state when using this texture.

Note that for this purpose it is convenient to use 2 struct/class to store a given texture:

CTexture
{
LPDIRECT3DTEXTURE8 pTex;

//...
}

CTransformedTexture
{
CTexture* pTexture; //use an ID instead of a pointer if you want

enum eWrapMode
{
WRAP_REPEAT,
WRAP_MIRROR,
WRAP_CLAMP
//...
};

eWrapMode m_wrapModeU,
m_wrapModeV,
m_wrapModeW

TextureMatrix m_texMat;
};

It would be dumb to reload a texture in memory simply because it is warped or tiled differently.

Share this post


Link to post
Share on other sites
You have to access the parameters called "repeat" and "offset" in 3DSMax (that''s if you''re doing your wn exporter) and convert it to a texture matrix.

I guess something like:

[ repeatU 0 0 offsetU ]
[ 0 repeatV 0 offsetV ]
[ 0 0 repeatW offsetW ]

and associate it with the right texture stage (SetTextureStageState)

Next You have to read the wrapping mode under 3ds max : some checkbox named "tile" and "mirror" and call the corrresponding D3D state when using this texture.

Note that for this purpose it is convenient to use 2 struct/class to store a given texture:

CTexture
{
LPDIRECT3DTEXTURE8 pTex;

//...
}

CTransformedTexture
{
CTexture* pTexture; //use an ID instead of a pointer if you want

enum eWrapMode
{
WRAP_REPEAT,
WRAP_MIRROR,
WRAP_CLAMP
//...
};

eWrapMode m_wrapModeU,
m_wrapModeV,
m_wrapModeW

TextureMatrix m_texMat;
};

It would be dumb to reload a texture in memory simply because it is warped or tiled differently.

Share this post


Link to post
Share on other sites