Notifications
Clear all

[Closed] Passing per object data to DX9 materials?

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.

1 Reply

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