Loading obj through scripts

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
albert29
Posts: 4
Joined: Tue Feb 03, 2015 10:13 pm

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.
User avatar
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
albert29
Posts: 4
Joined: Tue Feb 03, 2015 10:13 pm

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
palhano
Licensed Customer
Posts: 21
Joined: Sat Apr 10, 2010 7:24 pm

Thomas, can you make it recursive so that it will load the entire content of the specified folder?
p3taoctane
Licensed Customer
Posts: 1418
Joined: Mon Jan 25, 2010 12:53 am

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
Windows 7 Pro_SP 1_64 bit_48 GB Ram_Intel Xeon X5660 2.80 GHZ x2_6 580GTX_1 Quadra 4800
User avatar
bepeg4d
Octane Guru
Posts: 10326
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy
Contact:

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 :D
ciao beppe
p3taoctane
Licensed Customer
Posts: 1418
Joined: Mon Jan 25, 2010 12:53 am

Thanks man... I'll give it a shot :D

Peter
Windows 7 Pro_SP 1_64 bit_48 GB Ram_Intel Xeon X5660 2.80 GHZ x2_6 580GTX_1 Quadra 4800
Post Reply

Return to “Lua Scripting”