[Closed] Apply Bitmap to DirectX Shader Material
Hi there,
I know how to apply a bitmaptexture to a Standard Material via MaxScript, but how about DirectX Shader Materials? It does work differently as there is no bitmaptexture applied but rather the map directly.
Say you have a DirectX Shader Material applied to your object and for example you load the lightmap.fx file, so you will get two map slots, one diffuse texture and one lightmap texture slot. Then apply any texture to them.
I access the diffuse texture slot via MaxScript:
$.material.diffusetexture
BitMap:C:\3ds Max 2010 64\Maps\seafloor.dds
So far so good. But how can I apply this map to the slot via MaxScript? I couldn’t find a way to do so. I’ve tried:
$.material.diffusetexture = BitMap:C:\3ds Max 2010 64\Maps\seafloor.dds
-- Syntax error: at keyword parameter, expected <factor>
-- In line: $.material.diffusetexture = BitMap:C
and
$.material.diffusetexture = Bitmap
-- Type error: set property requires BitMap, got: BitMap
-> Well, hmm… “requires BitMap, got: BitMap”!? – strange!
Just how do I apply this texture correctly? I guess it’s ridiculously simply, but I just can’t figure it out. Any help would be very much appreciated. Thank you!
Try this:
$.material.diffusetexture = bitmap:(openBitmap "C:\3ds Max 2010 64\Maps\seafloor.dds")
To use image from file you have to load it to get "bitmap" value.
EDIT
I misunderstood you question before.
I check but not found diffusetexture property in DirectX Shader material or Standard material.
D.Shader material contains another ‘stock’ material, you can acess to it by:
$.material.renderMaterial
So if you want change diffuse map in this material you will use:
$.material.renderMaterial.diffuseMap = bitmaptexture filename:"C:\3ds Max 2010 64\Maps\seafloor.dds"
(where object’s material is DirexctX Shader and renderMaterial is Standard)
Your code produces a syntax error, but I removed “bitmap:” and it worked:
[left]$.material.diffusetexture = openBitmap "C:/3ds Max 2010 64/Maps/seafloor.dds"
[/left]
[left] [/left]
[left]But I now run into problems when using variables in the path string… I’ll check it out…[/left]
[left]Thank you so far![/left]
[left]EDIT:[/left]
[left]
[/left]
[left]I misunderstood you question before.[/left]
I check but not found diffusetexture property in DirectX Shader material or Standard material.
[left]
[/left]
[left]You need to load the lightmap.fx file first. This contains the diffusetexture property. I do NOT want to change the diffusemap of the Standard Material.[/left]