Page 1 of 1
					
				Loading obj through scripts
				Posted: Tue Feb 03, 2015 10:15 pm
				by albert29
				Is it possible to script octane renderer to load a .obj file and display the result?
I'd be very interested in knowing if this can be done.
			 
			
					
				Re: Loading obj through scripts
				Posted: Tue Feb 03, 2015 11:50 pm
				by stratified
				Hi,
Sure that's possible. For example with this script:
Code: Select all
-- create mesh node and load obj file
mesh = octane.node.create{ type = octane.NT_GEO_MESH, name = "loaded mesh" }
mesh:setAttribute(octane.A_FILENAME, "/home/thomas/Documents/obj-files/cube.obj")
-- create render target and connect with mesh
rt = octane.node.create{ type = octane.NT_RENDERTARGET, name = "OBJ render" }
rt:connectTo(octane.P_MESH, mesh)
-- render
octane.render.start{ renderTargetNode = rt }
cheers,
Thomas
 
			
					
				Re: Loading obj through scripts
				Posted: Wed Feb 04, 2015 10:04 am
				by albert29
				Cool, thanks!
Just to know: is it also possible to "move the camera away"? I can render my sample obj cube but it's too close to the camera.
I'm a newbie so I'm not sure how this can be accomplished. I tried searching for "Scale of view" in the scripting LUA API but couldn't find anything
			 
			
					
				Re: Loading obj through scripts
				Posted: Wed Jun 17, 2015 9:33 pm
				by palhano
				Thomas, can you make it recursive so that it will load the entire content of the specified folder?
			 
			
					
				Re: Loading obj through scripts
				Posted: Wed Jun 17, 2015 11:48 pm
				by p3taoctane
				This has a lot of potential...
I could not Lua my way out of a wet paper bag.... but seeing this makes me ask...
Is it possible set up a Lua script to load a series of sequentially named OBJs and shatter nodes so that they replace the obj/scatter node currently loaded called mesh_xxxx.01/ scatterxxxx.01 etc so that if
xxx.01 is all rigged up to a render node set to 5000 samples
That it renders out the image saves it with a sequential name and loads the next OBJ/scatter and rinse and repeat???
I have a bunch of scatter nodes that change over time and describe the location of an OBJ that slightly morphs over time but has the same number and named materials. I could load and replace each one and save the file... 
But could lua save me the agony??
Thanks
Peter
			 
			
					
				Re: Loading obj through scripts
				Posted: Fri Jun 19, 2015 10:00 am
				by bepeg4d
				Hi Peter,
sure, with Lua you can do what you asking for and much more, like create a specific material and assign it to the mesh or part of it, deeply define the various rt options and so on 

I'm a newbie in Lua and basically I cut and paste parts of devs code here and there with lot of tries and errors, but it's quite easy to understand when you dirt your hands with it 

ciao beppe
 
			
					
				Re: Loading obj through scripts
				Posted: Fri Jun 19, 2015 3:21 pm
				by p3taoctane
				Thanks man... I'll give it a shot  
 
 
Peter