Unexpected Filename from diffuseMap

Unexpected Filename from diffuseMap

Anonymous
Not applicable
330 Views
3 Replies
Message 1 of 4

Unexpected Filename from diffuseMap

Anonymous
Not applicable
I can't figure out where this filename is coming from in my output.
My scene has 2 materials. both have the diffuse channel mapped to an actual .dds file and should have readbale names in the output.

My script is saying the filename is {E39FE6C3-ABE1-40B6-AE4C-55F092CB08C9}, which looks more like a registry key than a filename! 😛

Anyone have suggestions on how that output is showing up?

The same script works on other scenes I have, but I don't see that value anywhere in the actual scene. I have one object - an asteroid. I have assigned my material to it several times to be sure, and that material has diffuse mapped to a .dds file.

Here is the material export part of my script:




global MATERIAL_START = 0

-- Material type bytes
global STANDARD_MATERIAL = 0

-- Shader Types
global MAX_ANISOTROPIC = 0
global MAX_BLINN = 1
global MAX_METAL = 2
global MAX_MULTILAYER = 3
global MAX_OREN_NAYAR_BLINN = 4
global MAX_PHONG = 5
global MAX_STRAUSS = 6
global MAX_TRANSLUCENT = 7

-----------------------------------------------------------------------------------------------------------
-- ExportMaterial
--
-- @param rootMaterial - The root material to be written out to file
-- @param outFile - The opened binary file to write to
--
-- @throws error message string, if there was an error

fn ExportMaterial rootMaterial binFile =
(
format " Exporting Material...\n"
format " {\n"

writeByte binFile MATERIAL_START #unsigned
format " Material Start Marker\n"
format " Wrote Byte: %\n\n" MATERIAL_START

-- Standard Material
if classOf rootMaterial == standardMaterial then
(
writeByte binFile STANDARD_MATERIAL #unsigned
format " Standard Material Type\n"
format " Wrote Byte: %\n\n" STANDARD_MATERIAL

if rootMaterial.shaderType == MAX_BLINN then
(
writeByte binFile MAX_BLINN #unsigned
format " Blinn Shader Type\n"
format " Wrote Byte: %\n\n" MAX_BLINN
)
else
(
throw "Unsupported shader type used"
)

-- Ambient
if rootMaterial.ambientMapEnable == true then
(
writeByte binFile 1 #unsigned
format " Ambient Color Mapped\n"
format " Wrote Byte: %\n\n" 1

texMap = rootMaterial.ambientMap
if classOf texMap == BitmapTexture then
(
writeString binFile (filenameFromPath texMap.filename)
format " Ambient Color Filename\n"
format " Wrote String: %\n\n" (filenameFromPath texMap.filename)
)
else
(
throw "One or more materials mapped ambient to something other than a bitmap, which is not supported"
)
)
else
(
writeByte binFile 0 #unsigned
format " Ambient Color Not Mapped\n"
format " Wrote Byte: %\n\n" 0

writeFloat binFile (rootMaterial.ambient.r / 255.0)
writeFloat binFile (rootMaterial.ambient.g / 255.0)
writeFloat binFile (rootMaterial.ambient.b / 255.0)
writeFloat binFile (rootMaterial.ambient.a / 255.0)
format " Ambient Color RGBA\n"
format " Wrote 4 Floats: "
format "% " (rootMaterial.ambient.r / 255.0)
format "% " (rootMaterial.ambient.g / 255.0)
format "% " (rootMaterial.ambient.b / 255.0)
format "% \n\n" (rootMaterial.ambient.a / 255.0)
)

-- Diffuse
if rootMaterial.diffuseMapEnable == true then
(
writeByte binFile 1 #unsigned
format " Diffuse Color Mapped\n"
format " Wrote Byte: %\n\n" 1

texMap = rootMaterial.diffuseMap
if classOf texMap == BitmapTexture then
(
writeString binFile (filenameFromPath texMap.filename)
format " Diffuse Color Filename\n"
format " Wrote String: %\n\n" (filenameFromPath texMap.filename)
)
else
(
throw "One or more materials mapped diffuse to something other than a bitmap, which is not supported"
)
)
else
(
writeByte binFile 0 #unsigned
format " Diffuse Color Not Mapped\n"
format " Wrote Byte: %\n\n" 0

writeFloat binFile (rootMaterial.diffuse.r / 255.0)
writeFloat binFile (rootMaterial.diffuse.g / 255.0)
writeFloat binFile (rootMaterial.diffuse.b / 255.0)
writeFloat binFile (rootMaterial.diffuse.a / 255.0)
format " Diffuse Color RGBA\n"
format " Wrote 4 Floats: "
format "% " (rootMaterial.diffuse.r / 255.0)
format "% " (rootMaterial.diffuse.g / 255.0)
format "% " (rootMaterial.diffuse.b / 255.0)
format "% \n\n" (rootMaterial.diffuse.a / 255.0)
)
)
else
(
throw "Unsupported material type used"
)

format " }\n\n"
)


EDIT:
I checked the name property of the material and it is indeed the correct material. The diffuse channel is mapped to "C:\users\cpisz.HOMENETWORK\documents\graphics\asteroid\asteroid02_diffuse.dds"

I am stupified.
0 Likes
331 Views
3 Replies
Replies (3)
Message 2 of 4

Steve_Curley
Mentor
Mentor
It's a GUID - globally unique identifier. Wikipedia: guid
Often used in registry keys, but also used for many other things such as ClassIDs - you'll find some in the MXS help, especially in the SuperClasses sections.

What on earth one is doing in your filename I'm really not sure.

Ahh - I knew this had come up before.
See http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/filenamefrompath-in-max-2010-does-somethin...

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 4

Anonymous
Not applicable
The link you gave is 404 :(

EDIT: Chopped the link, it looks like it got part of the url twice. Found the thread and it worked. TY.

I hope Autodesk is aware of this bug and plans a fix?
0 Likes
Message 4 of 4

Steve_Curley
Mentor
Mentor
No idea what happened there - I re-inserted the link (having tried it manually) and it broke again - who knows...
Got rid of the URL tags and it now seems to work.

Glad you found it, and yes - bit of a problem that, if you're on x64.

It has been reported, of that I'm certain. How far up the to-do list it is I couldn't say.

You can report it as well - Defect Report Submission Form. The more reports they get the more chance there is of it being fixed.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes