OpenGL Object Loading can load virtually every 3d.obj file you can find on the internet, without using another object loading library

Overview

OpenGL-Object-Loading

OpenGL Object Loading using OpenGL 4.3 is capable of loading virtually every 3d.obj file you can find on the internet, without using another object loading library (assimp for example). The program can load 3d objects with 12M+ triangles and more.

The purpose of this project is to provide a shooting point for my camera in the physical based rendering with Lux project. Real time camera position can be turn on to choose the best view spot.

Challange

Loading object in opengl seem to be an easy problem at first, but it acttually can be very hard. The following problems will arise when you tried to load an object without using well known library like assimp:

  1. Applying texture is non trivial in Opengl:

If you only draw object by vertex coordinate, that's easy. But apply texture to the object can become a problem, texture will become disarray and there seem to be no way to fix. This problem arise because one vertex share many texture coordinates, and opengl only store the first texture coordinate you fetch into memory. To Solve this problem, treat them as seperate vertex, for example, if v have 2 texcoords: t1, t2 and you have to store them as v-t1, v-t2, instead of v-t1-t2.

  1. Limited Texture available:

OpenGL only allowed maxium 32 textures at a times while Crytek Sponza have over 70 textures, San-Miguel have 354 textures. To overcome this problem, model are drawn by mesh instead of drawing as a whole, this technique also explain why assimp use mesh in their source code.

Fun Fact: Most Tutorials on the internet, if not all, choose the easy way, they only show you how to load object having 1 or 2 textures and not telling you how to do it when there are more than 32 textures.

  1. Large models:

If you want to draw large models like San Miguel 10.7M triangles, Factory 12M triangles and bigger. Computer usually ran out of memory and return error. There are two reasons for this problem:

a. You tried to draw the model as "a Whole", you have to divide model into mesh, the most optimal way is to split them by material.

b. You stored VAO, VBO and IBO into one big array or vector, or store them as three large vectors separately. Again, divide them into mesh, each mesh have its own data.

Above are the 3 main problems when it come to loading object, after completely understand the source code, you will have a more in depth look of how object loading library work and the way they run millions of triangles in real time!

PS: it is only possible to load SanMiguel with modern OpenGL pipeline, old OpenGL will crush your computer without mercy!

PSS: I didn't put the image of 12M factory since the only Factory model I can find turn out to be wrong, they have wrong vertex and face data, The program run smoothly, no vertex data is missing and result in black screen 😄

Gallerry

San Miguel 10.7M Triangles. image

RungHolt 9.7M Triangles. image

Owner
Phan Sang
Phan Sang
nsfminer is an Ethash GPU mining application: with nsfminer you can mine every coin which relies on an Ethash Proof of Work.

nsfminer (no stinkin' fees) Ethereum (ethash) miner with OpenCL, CUDA and stratum support nsfminer is an Ethash GPU mining application: with nsfminer

Jean M. Cyr 508 May 11, 2022
OpenGL®-Starter is a template for your upcoming OpenGL Projects which has been compiled to run the most basic Hello World OpenGL Program from LearnOpenGL.com.

OpenGL®-Starter OpenGL®-Starter is a template for your upcoming OpenGL Projects which has been compiled to run the most basic Hello World OpenGL Progr

Kushagra 8 Jan 14, 2022
Yet another Chip-8 interpreter, this time written in C++ using GLFW and OpenGL as its graphics library 💻

Yet another Chip-8 interpreter, but this time with a beautiful interface ??

Akshit Garg 22 Apr 20, 2022
3D engine from scratch (without OpenGL or any other 3D graphics library)

Simple 3d engine based on SFML library. I tried to make this engine powerful and easy to understand.

Vectozavr 20 Apr 6, 2022
A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

GLFW Introduction GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan application development. It provides a simple, platf

GLFW 9k May 12, 2022
A legacy OpenGL simulator for OpenGL 4.4, written in C++.

the-ancient-tri A legacy OpenGL simulator for OpenGL 4.4, written in C++. Why? My Uni forces us to use legacy OpenGL (eww!), and I didn't want to lear

Mohammad Issawi 4 Feb 10, 2022
Epoxy is a library for handling OpenGL function pointer management for you

Epoxy is a library for handling OpenGL function pointer management for you. It hides the complexity of dlopen(), dlsym(), glXGetProcAddress(), eglGetP

Eric Anholt 535 May 7, 2022
Basic framework for D3D11 init, model/texture loading, shader compilation and camera movement.

reed-framework Basic framework for D3D11 init, model/texture loading, camera movement, etc. Instructions: #include <framework.h> Link with framework.l

Nathan Reed 33 Dec 24, 2021
RGL - 3D visualization device system for R using OpenGL

RGL - 3D visualization device system for R using OpenGL INTRODUCTION The RGL package is a visualization device system for R, using OpenGL or WebGL as

null 52 Apr 22, 2022
Axel Gneiting 1.3k May 16, 2022
A 2d Graphing Calculator using OpenGL

glGraph A 2d Graphing Calculator using Modern OpenGL Demo glGraph.mp4 Information This has only been tested on Fedora 34, it should work on other OS's

Nathan Medros 16 Apr 19, 2022
This is a openGL cube demo program. It was made as a tech demo using PVR_PSP2 Driver layer GPU libraries.

OpenGL Cube Demo using PVR_PSP2 Driver layer GPU libraries This is a openGL cube demo program. It was made as a tech demo using PVR_PSP2 Driver layer

David Cantu 5 Oct 31, 2021
3D CA in C++ using OpenGL, freeglut, glew

3D Cellular Automata in C++ with OpenGl Compile make Run make run or ./main [@bool animation enabled] [@bool rotation enabled] [@int rule number] [@in

Sol Zilberman 3 Nov 29, 2021
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Low Level Graphics Library (LLGL) Documentation NOTE: This repository receives bug fixes only, but no major updates. Pull requests may still be accept

Lukas Hermanns 1.3k May 12, 2022
Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.

This project is not actively maintained. NanoVG NanoVG is small antialiased vector graphics rendering library for OpenGL. It has lean API modeled afte

Mikko Mononen 4.3k May 5, 2022
Software RayTracing engine written in C++ without the usage of any libraries.

Software Raytracing Engine This is a software unidirectional raytracing engine, fully written in C++17, with no dependencies or external libraries use

Makar Ivashko 1 May 4, 2022
OpenGL Demo: Simulating Ocean Waves with FFT

OceanFFT Realistic ocean wave simulation, primarily based on J. Tessendorf's paper, using OpenGL compute shaders. Checkout the demo video here. In the

Achal Pandey 59 May 8, 2022
OBS Linux Vulkan/OpenGL game capture

OBS Linux Vulkan/OpenGL game capture OBS plugin for Vulkan/OpenGL game capture on Linux. Requires OBS with EGL support (currently unreleased, you need

David Rosca 160 May 11, 2022
NodeEditor basiced on Qt and OpenGL/CV

Vapour 基于Qt的轻量级的节点式几何建模工具与shader材质生成工具 可能加入图像处理(合成)的功能 日志: 2021-5-17: 完成背景绘制,右键菜单,节点连线,节点删除,初步拓扑排序 (细节)连线位于节点层级之下,使用lambda处理右键菜单slot,节点创建生成在鼠标位置处 2021

Cuimi 13 Apr 14, 2022