PDA

View Full Version : Passing per object data to DX9 materials?


Gibbz
10-31-2006, 11:04 PM
Is it possible to pass custom per object data into DX9 shaders, and then setup the shader to read this information?

For example each object will have a unique texture related to it. I would like to pass this texture path into the shader. Then the shader will use this texture in the shader to give each object with the same shader a different look/texture.

ypuech
11-01-2006, 10:33 PM
Hi Gibbz,

I think it's only possible to do that with the SDK.

I think the best solution is to create a different DirectX 9 shader in MAXScript for each object and setup a texture bitmap parameter.

For example, if the texture is declared as this in the FX :

texture g_ DiffuseTexture <
string UIName = "Diffuse Map";
int Texcoord = 0;
int MapChannel = 1;
>;

You can set the value for this shader in MAXScript like that :

dxshader.g_ DiffuseTexture = DiffuseBitmap -- DiffuseBitmap is a bitmap value

CGTalk Moderation
11-01-2006, 10:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.