Rendering an object from all angles?
Hello,
My objective is to come up with an easily repeatable method of rendering an object rotated in all possible positions at N degree increments. For example, 20 degree increments would produce 18 images along a single axis with a total of 18 * 18 * 18 for the entire set (5832 frames in total).
I imagine the best way to do this is via a simple script; although at the level of documentation for the javascript SDK this is quite difficult.
example code:
//percentage degree change
var n,x,y,z;
//how do we get an object? (Question 1)
var obj=doc.???? ("Folder1")
n=20;
for (x=0; x<=360;x+n) {
for (y=0; y<=360;y+n) {
for (z=0;z<=360;z+n){
//get radians
ix=Math.PI*2*cx/360;
//determine position of camera
cx=d*Math.sin(ix)
cy=d*Math.cos(iy)
cz=d*Math.sin(iz)
//some how set rotation of entity (Question 2)
obj.setParameter("rotation",cx,cy,cz)
//render the current frame to movie (or render & save)
doc.render() //how to get this to save to movie? (Question 3)
}
}
}
I'm finding this difficult to write because:
a) how do I reference an entity within a scene (like doc.getActiveCamera() except for objects / folders)
b) I assume it's just object.setparameter("rotation"),x,y,z) to change an objects orientation - is this correct?
c) i know about doc.render(); - is there way to save files automatically or to render to a movie file? (saving by hand each job is not practical)
Any help in this matter would very much be appreciated...
Hello,
My objective is to come up with an easily repeatable method of rendering an object rotated in all possible positions at N degree increments. For example, 20 degree increments would produce 18 images along a single axis with a total of 18 * 18 * 18 for the entire set (5832 frames in total).
I imagine the best way to do this is via a simple script; although at the level of documentation for the javascript SDK this is quite difficult.
example code:
//percentage degree change
var n,x,y,z;
//how do we get an object? (Question 1)
var obj=doc.???? ("Folder1")
n=20;
for (x=0; x<=360;x+n) {
for (y=0; y<=360;y+n) {
for (z=0;z<=360;z+n){
//get radians
ix=Math.PI*2*cx/360;
//determine position of camera
cx=d*Math.sin(ix)
cy=d*Math.cos(iy)
cz=d*Math.sin(iz)
//some how set rotation of entity (Question 2)
obj.setParameter("rotation",cx,cy,cz)
//render the current frame to movie (or render & save)
doc.render() //how to get this to save to movie? (Question 3)
}
}
}
I'm finding this difficult to write because:
a) how do I reference an entity within a scene (like doc.getActiveCamera() except for objects / folders)
b) I assume it's just object.setparameter("rotation"),x,y,z) to change an objects orientation - is this correct?
c) i know about doc.render(); - is there way to save files automatically or to render to a movie file? (saving by hand each job is not practical)
Any help in this matter would very much be appreciated...