Notifications
Clear all

[Closed] Billboards from all bitmaps in a folder

DOH!

bitmaptex filename:map.filename name:””

assign a filename not a bitmap to the bitmaptex.

beats head on desk.

I’m getting closer I can feel it!

for starters I did have the vray version of bitmaptex wrong…

(	for f = 1 to files.count do 
   	(	
   			local theMap = bitmap 10 10 color:white
   			theMap.filename = files[f]
   					
   				
   				-- Get the ratio of the bitmap and set the length and width acordingly
   					local planeRatio = (theMap.width as float)/(theMap.height as float)
   							
   					local theLength = 68 --will be variable later
   					local theWidth = theLength*PlaneRatio
   					
   		
   				--Set naming
   					local refPlaneName = (getFilenameFile theMap.filename)
   
   					print refplaneName
   		
   				--build material 
   					local matName = (getFilenameFile theMap.filename)
   					local theMaterial = VRayMtl()
   					theMaterial.name = refPlaneName 
   					theMaterial.texmap_diffuse = Bitmaptexture fileName:theMap
   					theMaterial.texmap_diffuse.name = (refPlaneName + "_Diffuse")
   					theMaterial.texmap_diffuse.coords.blur = 0.01 
   					theMaterial.texmap_opacity = Bitmaptexture fileName:
   					theMaterial.texmap_opacity.name = (refPlaneName + "_Opacity")
   					theMaterial.texmap_opacity.rgboutput = 1 
   					theMaterial.texmap_opacity.monooutput = 1 
   					theMaterial.texmap_opacity.coords.blur = 0.01 
   					showTextureMap theMaterial theMaterial.texmap_diffuse on 	
   					
   					print matName
   					print theMaterial
   				
   				--build plane 
   					local refPlane = plane name:refPlaneName length:theLength width:theWidth lsegs:1 wsegs:1 mapCoords:true
   					refplane.material = theMaterial 
   					refplane.realWorldMapSize = off 
   					refplane.lengthsegs = 1 
   					refplane.widthsegs = 1 
   								
   				--position the plane
   					in coordsys (transmatrix refplane.transform.pos) refplane.rotation = (eulerangles -90 0 0)
   					ResetXForm refplane ; CollapseStack refplane
   					refplane.pivot = [(refplane.max.x+refplane.min.x)/2, refplane.min.y, refplane.min.z]
   					refplane.pos = [0,0,0]
   	)
   )

Error:

#("...\3D\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl400.tif", "...\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl401.tif", "...\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl402.tif", "...\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl403.tif", "...\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl404.tif", "...\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl405.tif")
 "peopl400"
 -- Error occurred in f loop; filename: C:\Program Files (x86)\Autodesk\3ds Max 9\Scripts\UserScripts\MyTools_BitmapPlanesFromFiles.ms; position: 893
 --  Frame:
 --   theMaterial: peopl400:VRayMtl
 --   theMap: BitMap:...\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl400.tif
 --   planeRatio: 1.0
 --   refPlane: undefined
 --   refPlaneName: "peopl400"
 --   matname: "peopl400"
 --   theLength: 68
 --   thewidth: 68.0
 --   f: 1
 --   called in anonymous codeblock
 --  Frame:
 -- Unable to convert: BitMap:...\resources\materials\images\People\RealWorldImagry\urbanmoods\32bitTIFimages	emp\peopl400.tif to type: FileName
 OK

You’re trying to feed a bitmap class into a string (Filename) slot.

Don’t feed it the whole themap bitmap just feed it themap.filename

[b]BINGO BABY!!!:bounce:

[/b]You rock!!!

Sometimes I get on a roll with scripting and everything works. Most of the time I hit the wall and my brain freezes. Thanks so much for the help.

When (if) I get the rollout setup I’ll post the completed script. I haven’t found anything exactly like this out there. I’m sure someone has written it somewhere.

Hehe… I actually have one on my toolbar at work that I wrote. I just tend to reuse code over and over instead of writing from scratch. Creating a material is one of those little blocks of code I just usually copy paste. Evidently I need to write it from scratch more often.

For anyone who happens upon this before I get the whole thing posted, here is a functioning version of my mess above.

files = getFiles "\\\\insert your own path here\\*.tif" --will be variable later
(	for f = 1 to files.count do 
	(	
			theMap = openBitMap files[f]
			theMap.filename = files[f]
					
				
				-- Get the ratio of the bitmap and set the length and width acordingly
					local planeRatio = (theMap.width as float)/(theMap.height as float)
					(		
					local theLength = 68 --will be variable later
					local theWidth = theLength*PlaneRatio
					)
		
				--Set naming
					local refPlaneName = (getFilenameFile theMap.filename)

					print refplaneName
		
				--build material 
					local matName = (getFilenameFile theMap.filename)
					local theMaterial = VRayMtl()
					theMaterial.name = refPlaneName 
					theMaterial.texmap_diffuse = Bitmaptexture fileName:theMap.filename
					theMaterial.texmap_diffuse.name = (refPlaneName + "_Diffuse")
					theMaterial.texmap_diffuse.coords.blur = 0.01 
					theMaterial.texmap_opacity = Bitmaptexture fileName:theMap.filename
					theMaterial.texmap_opacity.name = (refPlaneName + "_Opacity")
					theMaterial.texmap_opacity.rgboutput = 1 
					theMaterial.texmap_opacity.monooutput = 1 
					theMaterial.texmap_opacity.coords.blur = 0.01 
					showTextureMap theMaterial theMaterial.texmap_diffuse on 	
					
					print matName
					print theMaterial
				
				--build plane 
					local refPlane = plane name:refPlaneName length:theLength width:theWidth lsegs:1 wsegs:1 mapCoords:true
					refplane.material = theMaterial 
					refplane.realWorldMapSize = off 
					refplane.lengthsegs = 1 
					refplane.widthsegs = 1 
								
				--position the plane
					in coordsys (transmatrix refplane.transform.pos) refplane.rotation = (eulerangles -90 0 0)
					ResetXForm refplane ; CollapseStack refplane
					refplane.pivot = [(refplane.max.x+refplane.min.x)/2, refplane.min.y, refplane.min.z]
					refplane.pos = [0,0,0]
	)
)

For me this was more about building the image planes at the proportion of the bitmaps and at a specified height.

I have NodeJoe for materials. I highly recommend this to anyone. It has boosted my creativity in building materials. It’s my favorite tool by far.

Page 2 / 2