Author Topic: ObjectReader  (Read 2604 times)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 360
    • View Profile
    • zapsolution
« on: January 15, 2016, 10:44:28 am »

This is the 64-bit version of ObjectReader, compiled with the latest Visual Studio Community 2015 edition, and Windows 10.

In its current state, this is the result of a close cooperation between:
Patrice Terrier and Michael Lobko-Lobanovsky,
In order to join the fun, send us a PM, and we will gladly share our code with you, if you want to contribute.

The ZIP file is provided with one single 3D model, you can download more from the links posted in "The 3D model collection". All material files have been tailored to use the unique features built-in ObjReader64, to achieve visual quality that comes close to real objects.

Make sure to use the latest OpenGL drivers, and to switch to the high performance nVIDIA graphic card mode, because the quality is so much better than with the default Intel graphic card.

You can select a 3D model from the menu "File", "Open..." option, or by using drag and drop of an *.obj file from the Explorer onto the ObjReader64 OpenGL section.

To install ObjReader64:

    1. Download the attached ZIP file
    2. Unlock the ZIP file to avoid any Windows UAC problem.
    3. Create a new folder, and unzip all files into it, preserving the directory tree structure.
    4. Once done, select ObjReader64.exe to run the program.
    5. The "Models" folder is the place to put all the models you download, keeping each of them into a distinct subfolder.

Note: The default model provided with the is located into the "Models\IronMan" subfolder.

For those still running a 32-bit version of Windows, there is a 32-bit version available on request.

01-14-2016 Version 1.00: forum opening.
03-20-2016 Version 1.01: bounding sphere detection (Efficient Frustum Culling)
05-03-2016 Version 1.02: to illuminate both sides of polygons in case of dark faces.
07-14-2017 Version 1.03: added simplified command line support (ProccessCommandline).
« Last Edit: July 14, 2017, 04:43:12 pm by Patrice Terrier »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 360
    • View Profile
    • zapsolution
« Reply #1 on: January 27, 2016, 02:01:32 pm »
ObjReader, displays 3D models using the wavefront OBJ format exclusively.

Because ObjReader is a GDImage/WinLIFT application it uses a specific skinned interface.

They are available from the menu "File" or from the menu "View".
Note: "View" is also the contextual menu that pops up when you press the right mouse button on the OpenGL viewport.

Display the Windows file selector to choose a model from a specific folder.
ObjReader uses a default "Models\" subfolder, that is the prefered place to put all your models, like the "Models\IronMan\" that stores the Mark17.obj file and all its related materials. Each model with all related materials must be stored into an individual subfolder.

Rather than using the "Open" command, you can also use directly the Windows explorer to select a specific .obj file, and use drag and drop onto the ObjReader's OpenGL section to display the model.

Note: Because some 3D models could be very large, ObjReader displays a spinner animation, and you have to wait for full completion before you can do anything with it.

A dialog box shows you the version number, the copyright, and informations about the active 3D model.

Shut down the program, same as the close button on the top right corner.

Switch to fullscreen mode, with just the OpenGL viewport visible. To return to the window mode, either press the space bar or the escape key.
Note: The contextual popup menu is also avaible in fullscreen mode, and you can select the "Fullscreen" command again to return to the window mode.

Restore the initial state of the camera, same than when you first display the model.

Use fixed pipeline
This command allows you to switch between the two 3D mode supported by ObjReader.
The GLSL Programmable Pipeline (PPL), and the Fixed Function Pipeline (FFP).
Most of the time you will not see much difference between PPL and FFP, however in case of bump materials we always switch to the Programmable Pipeline, while we keep using the Fixed Function Pipeline for simple material files.

This one is set automatically at the time you load a new model, and it is checked when the model uses textures.
However this command allows you to switch between textured or untextured mode to inspect the basic model.

This is very handy to better figure the polygon details used by a specific model, and it uses wire raher than solid to render the surfaces.

Point cloud
Same than wireframe, except that point are used rather than wire. The point size vary slightly with the zooming factor, because we have to accomodate to always show you something.

Ambient reflection
In order to see this effect, you must switch first to untextured mode, then this command uses the wallpaper to create GLSL spherical/specular reflection. To better see the effect, try with different wallpapers, you can select them from the listbox shown on the right.

Mipmap textures
When turned on (default), this command enables GPU computation of intermediate textures to better render the model when zooming in or out.

Multiple light sources
Three different light sources are used simultaneously to enhance the global illumination of the model.
(see also, the #ambient meta command)

Alpha to coverage
When using low polygon models with alpha transparency, this command help to produce better rendering of the transparent part of a texture. This is also very useful when dense foliage, grass, or hair must be rendered. It uses the alpha channel of the texture as a coverage mask for anti-aliasing.

Cull back faces
When this command is enabled, it doesn't render the hidden polygons.

Swap Y,Z axes
To change the orientation of a misaligned model.

Swap polygon winding order
The default OpenGL orientation is to use GL_CCW, but some models are using GL_CW causing elimination of back facing polygons, in that case GL_CW must be specified to change the default OpenGL setting, especially when using the menu "Cull back faces" command.
(see also, the #GL_CW meta command)

Smooth zooming
This is mostly to be used with high polygon models, to produce smooth zooming transition while performing video screen capture.

Illuminate both sides
To illuminate both sides of polygons with models using inverted normals (black faces).

Save to image
Save the current OpenGL viewport into a .png file (works also in full screen mode).

Print image
Send the current OpenGL viewport to the default printer.

Material files
Each of the .mtl, material file, must be tailored to use the exclusive features provided by the software.

This is done by using meta commands prefixed by the hashtag symbol: #.

In version 1.00 (command menu "About" to check the version) they are:

To use a specific image stored into the resource\ subfolder, as wallpaper background (same than in the listbox).
Syntax: #wallpaper abstract02.png

The default OpenGL orientation is to use GL_CCW, but some models are using GL_CW causing elimination of back facing polygons, in that case GL_CW must be specified to change the default OpenGL setting, especially when using the menu "Cull back faces" command.
Syntax: #GL_CW

This is the same than using the menu command "Multiple light sources", in that case a total of 3 light sources are used from multiple angles to enhance the global illumination.
Syntax: #ambient

This is the same than using the rotary button to adjust the alpha threshold with transparent materials. It is a decimal value ranging from 0.0 to 0.99. The default value is 0.10, the higher the value the larger the threshold to full transparency.
Syntax: #threshold 0.10

Enable the GL_LIGHT_MODEL_TWO_SIDE parameter, to illuminate both sides of polygons. By default, only the front of polygons is illuminated.
Syntax: #bothsides

Note: the meta commands are not case sensitive.

Specific material features
In order to produce nice rendering, ObjReader is able to use reflection files, they are spherical .png textures stored in each model's subfolder.

These spherical textures are meant to be used in conjunction with the refl and illum reserved mtl keywords, like this:

illum 3
refl texture.png

This one could be used altogether with, or without, alpha transparency, and the d 0.75 (percentage parameter), to produce raytracing reflection using the texture file specified as the refl parameter.

illum 4
refl fake_texture_name.png

In that case, while the refl instruction is still needed, the texture parameter name is not meaningful, because illum 4 instructs ObjReader to use the active wallpaper background to produce spherical reflection.
Most of the time, the best looking result is achieved by using it altogether with the specular value Ns 512, and a Ks 0.75 0.75 0.75 parameter.

« Last Edit: May 03, 2016, 10:15:59 am by Patrice Terrier »

Patrice Terrier

  • Administrator
  • *****
  • Posts: 360
    • View Profile
    • zapsolution
Version 1.03
« Reply #2 on: July 14, 2017, 04:36:56 pm »
The first post of this thread has been updated with version 1.03 (see HISTORY for further details).

« Last Edit: July 15, 2017, 06:51:35 am by Patrice Terrier »