assimp / assimp/assimp

OBJ + MTL Loaders - work with PBR materials

Open
#5,254 5 comments 0 reactions 0 assignees View on GitHub
Feature-Request Materials Wavefront-Obj
Dominant language
C++
Stars
13.2k
Forks
3.2k
Avg merge
2d 8h
Merged PRs (30d)
21

Description

**Is your feature request related to a problem? Please describe.**
This is a suggestion with possible solution on how to improve OBJ + MTL loading with PBR materials

**Describe the solution you'd like**
Try to utilize all PBR material properties

**Describe alternatives you've considered**
I have improved this on my end and all my changes are included in the attached zip file

**Additional context**
This topic is mainly intended for those ASSIMP developers who might be maintaining the OBJ files and also for any other users who might be interested in this subject. If any of my changes might serve the purpose of improving the ASSIMP library then feel free to use them.

Try to keep in mind that I normally don't do any C++ programming and that on my end I use a combination of ASSIMP, ASSIMPJS and three.js with lots of customized code. My [ASSIMP Viewer](https://githubdragonfly.github.io/viewers/templates/ASSIMP%20Viewer.html) is using ASSIMP(JS) to load OBJ + MTL files and then convert the model to GLB2 format and pass it on to three.js for displaying it in the browser. The viewer currently does not support drag-and-drop or zipped files so you would have to load all files from a folder.

Some of the changes I made to the attached OBJ files also include some custom names used in MTL file, like `map_Px` for textureRMA (its original `map_Ps` name needed to be changed just so it's distinguishable from sheen texture) or `Pac` for attenuationColor or `Pad` for attenuationDistance ... etc. One also might notice that MTL files exported by my OBJ + MTL exporter could have certain lines starting with `Pbr_` which are intended for my custom MTLLoader and should normally be skipped by the ASSIMP library.

What seems to be working properly or to a high degree (new PBR additions):
- Sheen, sheen roughness, sheenColorMap (`map_Psc`) / sheenRoughnessMap (`map_Psr`), clearcoat, clearcoatMap (`map_Pcc`) / clearcoatNormalMap (`map_Pcn`) / clearcoatRoughnessMap (`map_Pcr`), transmission, transmissionMap (`map_Ptr`), thickness, thicknessMap (`map_Pth`), attenuationColor, attenuationDistance

What didn't work for me:
- map_Pm and map_Pr textures were never set so I used textureRMA instead

EDIT: The attached zip file was updated since my initial post, including some map names, resolving clearcoat textures issue I was having

All can be tested with my viewers and the attached pictures show the [Anisotropy Barn Lamp](https://github.com/mrdoob/three.js/blob/dev/examples/models/gltf/AnisotropyBarnLamp.glb) example file, from the three.js repository, as it looks in my GLTF Viewer and after it was exported to OBJ + MTL format and then loaded in my ASSIMP Viewer.

![Barn Lamp - GLTF](https://github.com/assimp/assimp/assets/69928501/b7ada78c-9f5b-47e0-a371-411f06763d11)

![Barn Lamp - ASSIMP OBJ MTL](https://github.com/assimp/assimp/assets/69928501/f3818d50-de10-483d-b42a-12f5181936bc)

[OBJ & MTL - PBR Modifications 2.zip](https://github.com/assimp/assimp/files/12734708/OBJ.MTL.-.PBR.Modifications.2.zip)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the attached “OBJ & MTL - PBR Modifications 2.zip” and compare its MTL properties and map names with the listed working and failing cases. Trace how Assimp’s OBJ and MTL loaders handle those properties, then define completion as consistent support for the agreed PBR fields and correct handling of unsupported custom Pbr_ lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, three.js
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.