cs 4363/6353 other things you should know. overview matrix stacks raytracing and npr physics engines...
TRANSCRIPT
![Page 1: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/1.jpg)
CS 4363/6353
OTHER THINGS YOU SHOULD KNOW
![Page 2: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/2.jpg)
OVERVIEW• Matrix Stacks
• Raytracing and NPR
• Physics Engines
• Common File Formats
![Page 3: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/3.jpg)
MATRIX STACKS• Typically, matrices are stored in a stack to avoid this
• Stacks give us the ability to rotate one body around another
• Stacks are also how (character) animation is done
• Let’s say we wanted to fly through the solar system
• You still have a camera matrix
• The sun has been translated (but probably not rotated)
![Page 4: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/4.jpg)
MATRIX STACK EXAMPLE
Camera matrix
![Page 5: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/5.jpg)
MATRIX STACK EXAMPLE
Camera matrix
“Push” the camera matrix.Note: everything is rotated by our camera matrix…
![Page 6: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/6.jpg)
MATRIX STACK EXAMPLE
Camera matrix
“Push” the translation of the sun
Sun trans matrix
![Page 7: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/7.jpg)
MATRIX STACK EXAMPLE
Camera matrix
“Push” the translation of the sun
Sun trans matrixCombine everything on the stack into one MV matrix, then drawthe sun. Trans first, then camera!
mMV
Ord
er o
f ope
ratio
ns
![Page 8: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/8.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
The Earth is both translated
Note: yes, yes… I know it’s not to scale…
![Page 9: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/9.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
The Earth is both translated
Earth trans matrix
![Page 10: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/10.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
The Earth is both translatedand rotated (in that order), sowe push those on a separateframe… Earth trans matrix
Earth rot matrix
![Page 11: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/11.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
WRONG! The matrices aremultiplied TOP DOWN!
Earth trans matrixEarth rot matrix
![Page 12: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/12.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
WRONG! The matrices aremultiplied TOP DOWN!
Earth rot matrixEarth trans matrix
![Page 13: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/13.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
Combine everything on thestack into one MV matrix,then draw the Earth!
mMVEarth rot matrix
Earth trans matrix
Ord
er
![Page 14: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/14.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
What about the moon?
Earth rot matrixEarth trans matrix
![Page 15: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/15.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
Well, the moon has a translation… Moon trans matrix
Earth rot matrixEarth trans matrix
![Page 16: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/16.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
Well, the moon has a translation… as well asa rotation…
Moon trans matrixMoon rot matrix
Earth rot matrixEarth trans matrix
![Page 17: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/17.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
Well, the moon has a translation… as well asa rotation…
Moon rot matrixMoon trans matrix
Earth rot matrixEarth trans matrix
![Page 18: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/18.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
So we combine everythingon the stack into one MVmatrix, then draw the moon
mMV Earth rot matrixEarth trans matrix
Moon rot matrixMoon trans matrix
Ord
er
![Page 19: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/19.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
What if we want to draw a little independent spaceship?
Earth rot matrixEarth trans matrix
Moon rot matrixMoon trans matrix
![Page 20: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/20.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
POP the Moon stuff!
Earth rot matrixEarth trans matrix
![Page 21: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/21.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
POP the Earth stuff!
Earth rot matrixEarth trans matrix
![Page 22: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/22.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Sun trans matrix
POP the Sun stuff!
![Page 23: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/23.jpg)
MATRIX STACK EXAMPLE
Camera matrix
…Leaving us with just thecamera matrix. Then, wecan add the spaceshipmatrices on top of that.
![Page 24: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/24.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Push the spaceship trans first!
Ship trans matrix
![Page 25: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/25.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Then the rotation! Why?
Ship trans matrixShip rot matrix
![Page 26: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/26.jpg)
MATRIX STACK EXAMPLE
Camera matrix
Now that you have your MV,draw the ship…
Ship trans matrixShip rot matrix
mMV
![Page 27: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/27.jpg)
RAYTRACING• Easy to read article at http://en.wikipedia.org/wiki/Ray_tracing_(graphics)
Note: there are independent reflection, refraction and shadow rays
![Page 28: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/28.jpg)
EXAMPLES(AGAIN, FROM WIKIPEDIA.ORG)
![Page 29: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/29.jpg)
EXAMPLES(AGAIN, FROM WIKIPEDIA.ORG)
![Page 30: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/30.jpg)
RAYTRACING• Advantages:
• Realistic simulation of lighting
• Natural shadows
• Simple to implement (but not trivial)
• Heavily parallelizable
• Disadvantages
• Still an approximation
• not truly photorealistic
• Must limit depth
• Recursively adds up light values of rays
• Ssssssssssssslllllllllllllllloooooooooooooooowwwwwwwwwwwwww
![Page 31: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/31.jpg)
• “…holds that when human replicas look and act almost, but not perfectly, like actual human beings, it causes a response of revulsion among human observers”
THE UNCANNY VALLEY…
http://en.wikipedia.org/wiki/Uncanny_valleyFinal Fantasy: The Spirits Within
![Page 32: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/32.jpg)
NPR(NON-PHOTOREALISTIC RENDERING)
• Stylistic
• Water color
• Impressionism
• Example: Toon Shading
• Geometry remains the same
• Shading changes
• Commonly seen in video games
• Borderlands
http://en.wikipedia.org/wiki/File:Toon_Shader.jpg
![Page 33: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/33.jpg)
![Page 34: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/34.jpg)
WORKING WITH PHYSICS ENGINES• There are several out there:
• Tokamak (open source, no longer maintained)
• Bullet (open source – several commercial games and movies like “2012” and “Bolt”)
• Havok (commercial – Ireland, loads of commercial games)
• PhysX (commercial – Ageia/NVDIA, CUDA, uses PPU, tons of games as well)
• Usually provide:
• Gravity
• Collision (between static and dynamic bodies)
• Soft-body physics
• Ragdoll physics
• Vehicle dynamics
• Fluid simulations
• Cloth simulations
![Page 35: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/35.jpg)
HOW WE USE THEM…• Physics engine is a black box
• We “load” the physics engine
• Tell it which objects are dynamic
• Tell it which are static
• Define parameters, such as gravity, bounce and so on
• During each frame of animation:
• Update the physics engine by a delta time
• Ask the physics engine for:
• The location of each dynamic object
• The orientation of each dynamic object
![Page 36: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/36.jpg)
TOKAMAK EXAMPLE• Typically have a limited number of basic shapes
• Cube
• Capsule
• Sphere
• Must declare variables to hold all of the objects in your scene
#include <tokamak.h>
neSimulator* gSim = NULL; neRigidBody* gCubes[NUM_CUBES]; neRigidBody* sphere; neAnimatedBody* floor1 = NULL; neT3 t;
![Page 37: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/37.jpg)
void setupPhysicsEngine() {// This will define the size and shape of each cubeneGeometry* geom;// length, width and height of the cubeneV3 boxSize1; neV3 gravity;neV3 pos;float mass;float fmass = 0.2f;// The number of total objects the simulator has to keep track of...neSimulatorSizeInfo sizeInfo;
// Fill in the size info about the environmentsizeInfo.rigidBodiesCount = NUM_CUBES+1;sizeInfo.animatedBodiesCount = 1;// total number of objectssizeInfo.geometriesCount = sizeInfo.rigidBodiesCount + sizeInfo.animatedBodiesCount;// total number of collisions possible n*(n-1)/2sizeInfo.overlappedPairsCount = sizeInfo.geometriesCount*(sizeInfo.geometriesCount-1)/2;sizeInfo.rigidParticleCount = 0;sizeInfo.constraintsCount = 0;sizeInfo.terrainNodesStartCount = 0;
gravity.Set(0.0f, -3.0f, 0.0f);gSim = neSimulator::CreateSimulator(sizeInfo, NULL, &gravity);
// Setup a box - using loopfor (int i = 0; i < NUM_CUBES; i++) {gCubes[i] = gSim->CreateRigidBody();// Get the geometry object from the cubegeom = gCubes[i]->AddGeometry();boxSize1.Set(1.0f, 1.0f, 1.0f);geom->SetBoxSize(boxSize1[0], boxSize1[1], boxSize1[2]);gCubes[i]->UpdateBoundingInfo();mass = 1.0f;gCubes[i]->SetInertiaTensor(neBoxInertiaTensor(boxSize1[0], boxSize1[1], boxSize1[2], mass));gCubes[i]->SetMass(mass);pos.Set(i%10-5, i/10+0.5, -30);gCubes[i]->SetPos(pos);
}
// Create the spheresphere = gSim->CreateRigidBody();geom = sphere->AddGeometry();geom->SetSphereDiameter(2);sphere->UpdateBoundingInfo();sphere->SetInertiaTensor(neSphereInertiaTensor(2, fmass));sphere->SetMass(fmass);pos.Set(0, 1, -4);sphere->SetPos(pos);sphere->SetAngularDamping(0.01f);
// Create the floorfloor1 = gSim->CreateAnimatedBody();geom = floor1->AddGeometry();boxSize1.Set(100, 0.001, 100);geom->SetBoxSize(boxSize1[0], boxSize1[1], boxSize1[2]);floor1->UpdateBoundingInfo();pos.Set(0, 0, 0);floor1->SetPos(pos);
}
![Page 38: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/38.jpg)
void display () { degree += 0.1f; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gSim->Advance(0.015);
//Cubes for (int i = 0; i < NUM_CUBES; i++) {
t = gCubes[i]->GetTransform();cube_state[0][0] = t.rot[0][0]; cube_state[1][0] = t.rot[1][0]; cube_state[2][0] = t.rot[2][0]; cube_state[3][0] = t.pos[0];cube_state[0][1] = t.rot[0][1]; cube_state[1][1] = t.rot[1][1]; cube_state[2][1] = t.rot[2][1]; cube_state[3][1] = t.pos[1];cube_state[0][2] = t.rot[0][2]; cube_state[1][2] = t.rot[1][2]; cube_state[2][2] = t.rot[2][2]; cube_state[3][2] = t.pos[2];cube_state[0][3] = 0.0f; cube_state[1][3] = 0.0f; cube_state[2][3] = 0.0f; cube_state[3][3] = 1.0f;
drawCube(…); }
// Sphere t = sphere->GetTransform(); sphere_state[0][0] = t.rot[0][0]; sphere_state[1][0] = t.rot[1][0]; sphere_state[2][0] = t.rot[2][0]; sphere_state[3][0] = t.pos[0]; sphere_state[0][1] = t.rot[0][1]; sphere_state[1][1] = t.rot[1][1]; sphere_state[2][1] = t.rot[2][1]; sphere_state[3][1] = t.pos[1]; sphere_state[0][2] = t.rot[0][2]; sphere_state[1][2] = t.rot[1][2]; sphere_state[2][2] = t.rot[2][2]; sphere_state[3][2] = t.pos[2]; sphere_state[0][3] = 0.0f; sphere_state[1][3] = 0.0f; sphere_state[2][3] = 0.0f; sphere_state[3][3] = 1.0f; drawSphere(…);
glutSwapBuffers(); glutPostRedisplay();}
![Page 39: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/39.jpg)
COMMON FILE FORMATS• .3ds – AutoDesk 3DS Max (legacy)
• .blend - Blender
• .c4d – Cinema 4D
• .dae – COLLADA (xml)
• .fbx – AutoDesk
• .lwo – LightWave Object
• .ma/.mb – AutoDesk Maya
• .max – AutoDesk 3DS Max
• .md2/.md3 – Quake 2/Quake 3
• .pov – POV ray file
• .skp – Google Sketchup
• .sldasm – SolidWorlds Assembly
• .smd – Valve’s format
• .u3D – Universal 3D (3D Industry Consortium - xml)
![Page 40: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/40.jpg)
THE .OBJ FILE FORMAT• Also called WaveFront OBJ
• Text-based
• Easy to work with and widely accepted
• File specifies:
• Position of each vertex
• UVs of each vertex
• Normals of each vertex
• List of faces (triangles)
![Page 41: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/41.jpg)
EXAMPLE(HTTP://EN.WIKIPEDIA.ORG/WIKI/WAVEFRONT_.OBJ_FILE)
# List of Vertices, with (x,y,z[,w]) coordinates, w is optional. v 0.123 0.234 0.345 1.0 v ... ...
# Texture coordinates, in (u,v[,w]) coordinates, w is optional. vt 0.500 -1.352 [0.234] vt ... ...
# Normals in (x,y,z) form; normals might not be unit. vn 0.707 0.000 0.707 vn ... ...
# Face Definitions (see below) f 1 2 3 # Vertices only f 3/1 4/2 5/3 # Vertices/Texture coords f 6/4/1 3/5/3 7/6/5 # Vertices/Textures/Normals f ... ...
![Page 42: CS 4363/6353 OTHER THINGS YOU SHOULD KNOW. OVERVIEW Matrix Stacks Raytracing and NPR Physics Engines Common File Formats](https://reader036.vdocuments.site/reader036/viewer/2022062718/56649e7a5503460f94b7a906/html5/thumbnails/42.jpg)
OTHER OPTIONS• Smooth shading
• s 1 – smoothing is true
• s off – no smoothing
• Materials may be put into a separate .mtl file
• newmtl myMat
• Ka 1.000 1.000 1.000 #ambient white
• Kd 1.000 1.000 1.000 #diffuse white
• Ks 0.000 0.000 0.000 #specular off
• Ns 50.000 # size of spec (s from our lighting equation)
• Tr 0.9 #transparency