Convert a 3D character from FBX format and Render using processing 3.0
Deliverables:
1. I want a software application to convert a 3D character from FBX format and store to a suitable format to draw in processing 3.0
2. I want a function in processing 3.0 to read the new format and draw the converted character. For example, using OpenGL or primitive commands like fill(0, 255, 0) and vertex(-100, 10, 10) etc. The example code below can be used to demonstrate a successful solution.
Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. You can find more about processing 3.0 here [login to view URL]
An example processing program is included below which draws an open box shape. The OpenBox function should be replaced by a function that draws the converted character.
The source format is FBX (another common format could be considered). For more information see [login to view URL]
Example fbx files are also available online, for example [login to view URL]
// example Processing code - [login to view URL]
/*************************************
sketch_3D_test
to show rotating 3D object
*************************************/
// amount to rotate the character
int pitch = 0;
int roll = 0;
int yaw = 0;
// initialise
void setup ()
{
size(1000, 600, P3D);
}
// each draw event
void draw ()
{
//Set background black
background(0);
// modify the rotations
pitch += 1;
roll +=2;
yaw += 3;
/////////////////
// draw the 3D object
pushMatrix();
// shift origin x, y, z
translate(width/2, height/2, -60);
// rotate character
rotateX(yaw*PI/360);
rotateY(pitch*PI/360);
rotateZ(roll*PI/360);
// scale character
scale(4);
// Draw the character from primitives
openBox(); // set of draw commands to make the object
//////////////////////
popMatrix();
}
// ### Make a new Function for this ###
// Draw the character using processing primatives
void openBox()
{
beginShape(QUADS);
// 6 sides of the shape
fill(0, 255, 0); vertex(-10, 10, 10);
fill(0, 255, 0); vertex( 10, 10, 10);
fill(0, 255, 0); vertex( 10, -10, 10);
fill(0, 255, 0); vertex(-10, -10, 10);
fill(0, 255, 255); vertex( 10, 10, 10);
fill(0, 255, 255); vertex( 10, 10, -10);
fill(0, 255, 255); vertex( 10, -10, -10);
fill(0, 255, 255); vertex( 10, -10, 10);
fill(255, 0, 255); vertex( 0, 10, -10);
fill(255, 0, 255); vertex(-10, 10, -10);
fill(255, 0, 255); vertex(-10, -10, -10);
fill(255, 0, 255); vertex( 0, -10, -10);
fill(255, 255, 0); vertex(-10, 10, -10);
fill(255, 255, 0); vertex(-10, 10, 10);
fill(255, 255, 0); vertex(-10, -10, 10);
fill(255, 255, 0); vertex(-10, -10, -10);
fill(255, 0, 0); vertex(-10, 10, -10);
fill(255, 0, 0); vertex( 0, 10, -10);
fill(255, 0, 0); vertex( 0, 10, 10);
fill(255, 0, 0); vertex(-10, 10, 10);
fill(0, 0, 255); vertex(-10, -10, -10);
fill(0, 0, 255); vertex( 0, -10, -10);
fill(0, 0, 255); vertex( 0, -10, 10);
fill(0, 0, 255); vertex(-10, -10, 10);
endShape();
}