Results 1 to 2 of 2

Thread: Addition to Max Collada Export (exporting Specular maps)

  1. #1

    Addition to Max Collada Export (exporting Specular maps)

    at the top of the file under the line:

    Code :
    global all_scene_maps = #()

    add the following line:

    Code :
    global all_scene_maps_types = #()

    under the line:

    Code :
    global All_Xref_objects = #()

    add the following two lines:

    Code :
    -- collada names for the map types
    global maptypes = #("AMBIENT","DIFFUSE","SPECULAR","","","","TRANSPARENCY","","BUMP","","","")


    In function Write_DAE_TEXTURE_LIBRARY after the line which reads:

    Code :
    format "\t\t<texture id=\"%\" name=\"%\">\n"  name_string  name_string  to:file_ptr
    add this line:

    Code :
    maptype = maptypes[all_scene_maps_types[i]]

    and alter the line below with '<param name=\"DIFFUSE\"' to:

    Code :
    format ("\t\t\t<param name=\""+maptype+"\" type=\"float3\" flow=\"OUT\"/>\n") to:file_ptr
    In the function Write_DAE_MATERIAL_LIBRARY, after the lines:

    Code :
    if ((isproperty this_mtl #diffusemap) and (this_mtl.diffusemap != undefined)) then
    		(
    			local texture_name_string = (DAE_Element_Name this_mtl.diffusemap)
    			format "<input semantic=\"TEXTURE\" source=\"#%\"/>\n"  texture_name_string  to:file_ptr
    		)
    add the following lines:

    Code :
    	if ((isproperty this_mtl #specularmap) and (this_mtl.specularmap!= undefined)) then
    		(
    			local texture_name_string = (DAE_Element_Name this_mtl.specularmap)
    			format "<input semantic=\"TEXTURE\" source=\"#%\"/>\n"  texture_name_string  to:file_ptr
    		)
     
    		if ((isproperty this_mtl #bumpmap) and (this_mtl.bumpmap!= undefined)) then
    		(
    			map = this_mtl.bumpmap
     
    			if ((classof map) == Normal_Bump) then
    			(
    				map = map.normal_map
    			)
     
    			local texture_name_string = (DAE_Element_Name map)
    			format "<input semantic=\"TEXTURE\" source=\"#%\"/>\n"  texture_name_string  to:file_ptr
    		)
    In function Collect_Material_Maps change the for map to mat.maps loop to:

    Code :
    		for nmap = 1 to mat.maps.count do
    		(
    			map = mat.maps[nmap]
     
    			if (map != undefined) then
    			(
    				-- if normal map get the normal map itself
    				if ((classof map) == Normal_Bump) then
    				(
    					map = map.normal_map
    				)
     
    --				if ((finditem all_scene_maps map) == 0) then	-- don't add if already there
    --				(
    					if (hasproperty map #filename) then			-- this one references a file
    					(
    						if ((finditem all_map_filenames map.filename) == 0) then -- we have not collected this one yet
    						(
    							append all_map_filenames map.filename  --  collect it
    						)
    					)
    					append all_scene_maps map  					-- add this map reference to the list
    					append all_scene_maps_types nmap			-- add the type of this reference
    --				)
    			)
    		)


    You can now specify a map for the specular color of a material and it will be exported to Collada.

    Also, You can use a Normal_Bump material in the bump channel of the material and it will export the normal map of the Normal_Bump as a 'BUMP' texture type in the Collada file.

  2. #2
    Junior Member
    Join Date
    Aug 2004
    Location
    Autodesk, San Francisco
    Posts
    19
    Thanks.

    I will do the modifications and test them. If everything works fine, I will post the new script.

    Jean-Luc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •