How to differenciate bump map / normal map in the bump slot
Hello everyone,
I am trying to convert a vray material into a standard material, and I have a problem to write this algorithm in MAXScript :
if (the bump map slot is not empty) do
(if (the slot contains a normal map) do (normal map goes to bump slot of the standard material)
else (bump map goes to bump slot of the standard material))
Probably I'm wrong, but the problem is that i don't know how to differentiate the 3 possible choices.
This is my actual code which is wrong :
for o in geometry do ( if classof o.material == VRayMtl do ( newmtl = Standardmaterial () if (o.material.texmap_bump != undefined) do ( if o.material.texmap_bump.normal_map.filename != undefined then ( newmtl.bumpMap.FileName = o.material.texmap_bump.normal_map.filename newmtl.bumpMapAmount = o.material.texmap_bump_multiplier ) else ( newmtl.bumpMap.FileName = o.material.texmap_bump.filename newmtl.bumpMapAmount = o.material.texmap_bump_multiplier ) ) o.material = newmtl ) )
Thank you.
Attachment | Size |
---|---|
preview.jpg | 12.95 KB |
Comments
I found the real problem.Do
I found the real problem.
Do you know how to test if inside the Normal Map there is a map ?
Your script doesn't contain this case.
In your script, even if you remove or not the line "obj.material.texmap_bump.normal_map.filename != undefined", the VrayNormalMap won't be converted to Normal Map with a material with a Normal Map with no map inside.
In my script if I add the line "o.material.texmap_bump.normal_map.filename != undefined" as a condition, and if I have just a bump map in my material, I will have this error "Unknown property: "filename" in undefined".
I will be grateful if you can solve this problem.
Rodman
if you want to test if
if you want to test if "NormalBump" have "mormal_map" use this
For your code not need to twice check NormalMap, try this
bga
Thank you ! I've used both of
Thank you ! I've used both of your codes to integrate it with mine. I understand how it works now.
Rodman
fine.now you can continue
fine.now you can continue with the rest of script.
cheers!
bga
I have a new problem. I want
I have a new problem.
I want to add the case where the bump map slot contains a checker (for example)
First I transform the checker into a Bitmap inside a path name ThePath
But after this I cant insert this Bitmap inside the new bump slot of my Standardmaterial
I have this :
And this error : Unknown property: "filename" in undefined
I don't know how to say that o.material.texmap_bump is not checker but Bitmap.
I need your help.
Rodman
This is your code
Don't use any more ".FileName" property to assigne bitmap.
You have more then this problem in your code.
Compare my code and your and you;ll see what i mean.
bga
Thank you very much. What
Thank you very much.
What does it mean this : "where not isKindOf o targetObject" ?
Rodman
Means that target objects
Means that target objects (camera, light target etc.) are
also geometry objects and should be isolated from for-loop
try this to see from yourself
bga
You can red this
You can red this thread
http://www.scriptspot.com/forums/3ds-max/scripts-wanted/switch-maps-text...
bga
I saw it. But I didn't find
I saw it. But I didn't find any clue in it.
Rodman