Skip to content

A C++ .obj and .fbx file parser to display 3D model using OpenGL.

License

Notifications You must be signed in to change notification settings

tiagzoc/FBX-OBJ-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PARSER OBJ-FBX Project

THIS PROJECT WAS THE WORK OF 3 PEOPLE BUT I COULDN'T FORK THE ORIGINAL REPO DUE TO MY SCHOOL'S ORGANIZATION

OTHER CONTRIBUTORS :


General Information

This project is a C++ 3D model parser and renderer developed to better understand how a graphics engine works internally and how to parse 3D model file. The goal was to parse .obj and .fbx files and render them using OpenGL, without relying on external parsing or rendering libraries.

The project supports:

  • Parsing .obj files (vertices + textures)
  • Parsing .fbx files (vertices only – texture rendering currently buggy)
  • Displaying parsed models using OpenGL

Technologies used:

  • C++20
  • OpenGL
  • CMake for build management

How to Build and Run

Prerequisites

  • Visual Studio 2022 (or compatible)
  • CMake >= 3.30
  • Git

Steps

  1. Clone the repository:
git clone https://github.com/tiagzoc/FBX-OBJ-Parser
  1. Create a build directory and navigate into it:
mkdir build && cd build
  1. Run CMake to configure the project:
cmake .. 
  1. Build the project and open the .sln (or .slnx) file:
cmake --build . --config Debug
  1. Right Click on the app project and Set as Startup project.
  2. Run the program.

Note: You can change which file you want to load in the main.cpp file of the app project.


How the Project Works

  • The project reads 3D model files and parses their internal structure.
  • For .obj files:
    • Vertices, texture coordinates, and faces are parsed correctly.
    • Textures are loaded and displayed using OpenGL.
  • For .fbx files:
    • Vertex data is parsed and rendered.
    • Texture parsing is incomplete and currently not displayed correctly.
  • OpenGL is used directly to:
    • Upload vertex data to the GPU
    • Manage buffers and shaders
    • Render the model to the screen

What I Learned

  • Understanding the structure of .obj and .fbx files
  • Implementing a custom parser in C++ without external libraries
  • Using OpenGL for:
    • Vertex buffers (VBO)
    • Vertex array objects (VAO)
    • Shaders

Possible Improvements

  • Fix FBX texture parsing and rendering
  • Support materials (.mtl) more extensively
  • Add support for more 3D formats
  • Implement a camera system (free cam, FPS cam, etc.)
  • Optimize rendering for larger models
  • Add basic lighting

Demo

Gameplay Video

About

A C++ .obj and .fbx file parser to display 3D model using OpenGL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages