Home |  | Sign in | English US
3D wavefront OBJ model
Published by Patrice TERRIER
in the category Tools
New features

This project shows you how to import Alias|Wavefront OBJ and MTL files into a GDImage/OpenGL application.

The OBJ file format is one of the most widely supported 3D file formats.
All of the most popular 3D content creation packages includes support for this file format either natively or through third party plugins.

Models are rendered using either the fixed function pipeline or the programmable pipeline.
The fixed function pipeline is used on hardware that only supports OpenGL 1.x.
The programmable pipeline is used on hardware that supports OpenGL 2.0 and higher. The supported GLSL shaders are per fragment Blinn-Phong and normal Mapping.
Both support only a single fixed directional light source shining down the OpenGL default negative z-axis.

Most of the time the per fragment Blinn-Phong shader will be used.
The normal mapping shader will be used only when the OBJ model's MTL file includes a material that has a bump map (specified using the 'map_bump' command).
This project assumes that any bump map associated with a material will be a normal map. All other bump map formats are not supported.

When the MTL file contains a material with a normal map this demo will generate smooth tangent vectors for the OBJ model.
The smooth tangent vectors are generated by summing the triangle face tangent vectors of adjacent triangle faces and then normalizing the resulting tangent vector.
The bitangent vectors are not generated here. They are calculated in the normal mapping shader's vertex shader.

A file menu is provided to enable OBJ files to be loaded at runtime.
A GDImage spinner is displayed while loading the OBJ file, please wait until full completion.

The default GLSL shaders are embedded directly into the Mobj.dll.
The zGLEXT.dll contains all the OpenGL extensions to ease call from a WINDEV project (however the current zGLEXT global procedure uses only a limited subset of those provided inside the DLL).

Left click and drag using the mouse to translate the model.
Middle click and drag using the mouse to zoom in and out of the model.
Right click and drag using the mouse to rotate the model.

The project is provided with two free wavefront OBJ files that are stored into the EXE\Model folder, each one into a specific subfolder.

ObjReader is provided in WD16 source code format, without compiled EXE and WD framework, but you can test everything from the IDE.

This version of the project mainly focuses on specular rendering (however the texture mode can also be enabled with models using it), try changing the background from the list shown on the right of the window, and see how it interacts with the model.
If you have a last generation computer enjoy the Fullscreen mode altogether with zooming to better see the details.

To limit the size of the ZIP file, i put only "IronMan" and "Dragon1" into the Model folder, but i have some more available for those interested.

Screen shot:

There is a lot of low level API code in there, but that is the price to pay when you need performance.

Illustrations, screen shots
User reviews
(To evaluate this resource, click 'Write a review')
Il existe une nouvelle version 64-bit de ObjReader (écrite en C++), ainsi qu'un nouveau site dédié qui se trouve ici:
Vous devez vous enregistrer avant de pouvoir télécharger le Reader, et les démos disponibles sur le site.

00No rating
August 07, 2012
Minimum version: WD16
7.7 MB