Change the bitmap file in a DirectX shader

Hello everyone,

I'm working on a simple way to create bitmap texture in a DirectX material. The steps:

1) (we create a Dx shader: ) meditMaterials[1] = DirectX_9_Shader ()
2) (we load the StandardFx shader: ) meditMaterials[1].effectfile = "\maps\fx\StandardFX.fx"
3) here must be the bitmap file in the diffuse...

I can check the bitmap file in the Dx shader, with this...:
meditMaterials[1].g_TopTexture
...and the result is (for example) : "Bitmap:D\test01.jpg"

But when i write this...:
meditMaterials[1].g_TopTexture = Bitmap:D\test02.jpg
...it is not work.

What is the right syntax of this line?
meditMaterials[1].g_TopTexture = ... what?

Thanks your answers in advance,

Matyrix

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lightcube's picture

I have a script that utilizes

I have a script that utilizes the StandardFX.fx but the problem I am having is that I do not know how to programmatically turn on/off the texture usage.

How do I turn on Top Diffuse Color Enable (or bottom, specular, normal, etc) via MAXScript as I would via the UI?

Thanks in advance.

_______________________

Shawn Olson

Developer of Wall Worm

lightcube's picture

Got an answer over at the

Got an answer over at the Area: http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/directx-shader...

_______________________

Shawn Olson

Developer of Wall Worm

Matyrix's picture

Anubis, le1setreter: really

Anubis, le1setreter: really thanks for your help! it works fine!

le1setreter's picture

try this: myTextureMap =

try this:

myTextureMap = bitmapTexture()
myTextureMap.filename = "C:\\image1.jpg"
 
meditMaterials[1].g_TopTexture = myTextureMap.bitmap
Matyrix's picture

I'm searching the solution,

I'm searching the solution, and i have seen that this question was asked on the CGTalk:
http://forums.cgsociety.org/archive/index.php/t-519984.html

But there is no good result, i think what Dave Black wrote is not the best solution in my case.

So i hope you have got some tipps...

Anubis's picture

bMap = openBitMap

bMap = openBitMap "C:\\test01.jpg"
meditMaterials[1].g_TopTexture = bMap

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.