ScriptSpot

Forum topic · General Scripting

Change the bitmap file in a DirectX shader

By Matyrix · 2010-05-03

Description

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 (6)

lightcube · 2011-06-20

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.

Matyrix · 2010-05-04

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

le1setreter · 2010-05-04

try this:


myTextureMap = bitmapTexture()
myTextureMap.filename = "C:\\image1.jpg"

meditMaterials[1].g_TopTexture = myTextureMap.bitmap

Matyrix · 2010-05-03

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...

bMap = openBitMap

Anubis · 2010-05-04

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