Loading obj through scripts

Forums: Loading obj through scripts
Forum for OctaneRender Lua scripting examples, discussion and support.

Loading obj through scripts

Postby albert29 » Tue Feb 03, 2015 10:15 pm

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

Re: Loading obj through scripts

Postby stratified » Tue Feb 03, 2015 11:50 pm

stratified Tue Feb 03, 2015 11:50 pm
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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Loading obj through scripts

Postby albert29 » Wed Feb 04, 2015 10:04 am

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

Re: Loading obj through scripts

Postby palhano » Wed Jun 17, 2015 9:33 pm

palhano Wed Jun 17, 2015 9:33 pm
Thomas, can you make it recursive so that it will load the entire content of the specified folder?
palhano
Licensed Customer
Licensed Customer
 
Posts: 21
Joined: Sat Apr 10, 2010 7:24 pm

Re: Loading obj through scripts

Postby p3taoctane » Wed Jun 17, 2015 11:48 pm

p3taoctane Wed Jun 17, 2015 11:48 pm
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
p3taoctane
Licensed Customer
Licensed Customer
 
Posts: 1418
Joined: Mon Jan 25, 2010 12:53 am

Re: Loading obj through scripts

Postby bepeg4d » Fri Jun 19, 2015 10:00 am

bepeg4d Fri Jun 19, 2015 10:00 am
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
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 9940
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: Loading obj through scripts

Postby p3taoctane » Fri Jun 19, 2015 3:21 pm

p3taoctane Fri Jun 19, 2015 3:21 pm
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
p3taoctane
Licensed Customer
Licensed Customer
 
Posts: 1418
Joined: Mon Jan 25, 2010 12:53 am

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 6 guests

Fri Mar 29, 2024 12:04 pm [ UTC ]