1 / 17

Comprehensive Guide to 3D Model Loading and Rendering with STL and OBJ Formats

Learn how to load, render, and modify 3D models using STL and OBJ formats. Explore file structures, APIs, and important functions like push_back and erase. Get hands-on with GLM features for optimal rendering.

mimi
Download Presentation

Comprehensive Guide to 3D Model Loading and Rendering with STL and OBJ Formats

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Homework Helpers

  2. Content • OFFfiles • STL: vector, algorithm • Model loaders: OBJ, 3DS

  3. OFF Format • Geomview Object File Format • Model archives (1, 2)

  4. OFF Reference

  5. STL:vector • Iterators: begin(), end() • Size(), operator[] • Modifiers: • push_back(..), • pop_back(), • insert (iter, …), • erase (iter), • clear();

  6. Element Access

  7. Algorithm: sort (first, last [,compare])

  8. OBJ (Wavefront) File Structure • Outline • v: geometry, vn: vertex normal, vt: texture coordinates • f: face specification (v)/(vt)/(vn) • vertex count starting from 1 • mtllib: material library • usemtl: material name • #: comments • g: group • References: (1)

  9. Typical MTL File Ns: shininess OBJ [0,1000]OpenGL [0,128]

  10. Files: glm.c, glm.h (from Nate Robin) Related: Free 3D models on the Internet (3dcafe, …) Model converter (deep exploration) Important APIs: glmUnitize (m) glmFacetNormals (m) glmVertexNormals (m) glmLinearTexture (m) glmSpheremapTexture(m) glmDelete (m) glmScale(m,scale) glmReadOBJ (filename) glmDraw (m, mode) glmList (m, mode) See glm.h for more details Using OBJ Loader

  11. Load model Render model glmDraw (pmodel, mode); mode: bitwise-ORed options GLM_FLAT, GLM_SMOOTH, GLM_MATERIAL, GLM_TEXTURE (for models with textures) Example: glmDraw (pmodel, GLM_SMOOTH | GLM_MATERIAL); glmDraw (pmodel, GLM_SMOOTH | GLM_MATERIAL | GLM_TEXTURE); Typical Usage centered at origin, [-1,1]3 bounded

  12. Draw model using glmDraw (GLM_SMOOTH|GLM_MATERIAL|GLM_TEXTURE); Only load png textures OBJ Models with Textures

  13. What exactly is in glmDraw? Every group has one material!

  14. Restrictions • One “usemtl” per group • Only “map_Kd” is handled

  15. For 3DS Models Builds: 3ds2obj & 3dsdump

More Related