[Closed] How to get all the texture name of DirectX shader
I want to get all the textures name of the directX shader using maxscript.
I donot know how to get it .
Can anyone help?
I find it’s much more hard to use maxscript than maya mel !!!
Hi brow
Do you mean the name of the file in the “Base texture” field?
select an object with the directX shader on it and run
$.material.tex0 will return the texture path and name
$.material.name will return the material name
$.material.effectfile will return the .fx file used by the DX shader
you can use also
show $.material
.effectfile : filename
.technique : integer
.renderEnabled (Force_Software_Render) : boolean
.renderMaterial : material
.Tex0 : bitmap
.LightDir : integer
.GlowColor : fRGBA color
.GlowAmbient : fRGBA color
.GlowThickness : float
.effectFilename : filename
.softwareBitmap : bitmap
false
the show command will list you all the properties !
As you said you´re comming from MEL Script , theres a nice article about the diferences between MaxScript and MEL in the Bobo´s home page.
http://www.scriptspot.com/bobo/mel2mxs/mel2mxs.htm
hope it helps
Oh, the fun i’ve had with converting dx materials…
material_count = meditMaterials[1].materialList.count
for n = 1 to material_count do
(
old_name2 = (getProperty meditMaterials[1].materiallist[n] #renderMaterial)
old_name = old_name2.diffusemap.filename
print old_name
)
this should work
first, Thank you for the quick reply!!!
I still cannot get directX Shader ‘s texture name use $.material.tex0
errot message is
– Unknown property: “tex2” in CarDirectX_9_Shader
the .fx shader is written by our programmer
it contains light Direction, Ambient… then the texture map channel
feel so upset !!!
If I want to get all the texture name in current scene, will it be easy?
Please help, Thank you
Hi
CarDirectX_9_Shader ???
is this a plugin shader ?
The .tex0 property is exclusive for DirectXShaders.
I don´t think it´s a native shader that comes with 3dMax.
using the ” show $.material ” with this shader on the selected object , what do you get in the listener?
Hi,
If you want to get all the bitmaps filename used in a DirectX Shader, you can try :
-- Loop over scene materials
for mtl in sceneMaterials do
(
-- DxMaterial?
if(Classof mtl == DirectX_9_Shader) do
(
-- Get used bitmap(s) in the effect
for i = 1 to mtl.numberofbitmaps() do
(
bmp = mtl.geteffectbitmap i
BmpFileName = bmp.filename
)
)
)
This code only works with DirectX 9 Shader material that ships with 3ds Max. Otherwise, getProperty() that access parameter block can be handy if your material is a C++ plugin or a scripted material that extends DirectX 9 Shader material.
EDIT: Also, I’ve written an article about Using DirectX Shadersin 3ds Max.
Thank you guys for the help!!!
I can get it use .TEXTURE0
because the .fx file define the texture map as TEXTURE0…