PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → 3D Wavefront OBJ reader
3D Wavefront OBJ reader
Débuté par guest, 06 aoû. 2012 14:23 - 2 réponses
Posté le 06 août 2012 - 14:23
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).

Usage:
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:


<span style="font-size:large">You can download the project here</span>

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

...
Posté le 06 août 2012 - 16:21
@Patrice,

Sorry I cannot see the image nor the download link.

Please post the download link.
Posté le 06 août 2012 - 17:22
Sorry, but the original post has been made on this URL
http://forum.mysnip.de/list.php…

Anyway here are the missing links

Sreen shot:




Download link:
http://www.zapsolution.com/preview/ObjReaderWD16.zip