OBJ/MTL export: problems with map_d imfchan, d #97642

Open
opened 2022-04-27 07:07:43 +02:00 by Scurest · 2 comments
Contributor

System Information
Operating system: Linux
Graphics card:

Blender Version
Broken: 3.2.0-alpha+master.bf80dc2bd4ac

Short description of error
When exporting an alpha texture to OBJ/MTL, a wrong imfchan is written. Also a wrong d value may be written

I'm using "Wavefront OBJ (experimental)" (but the old exporter is the same). Recall that MTL calls alpha "dissolve" and specifies it with a factor (d) and a texture (map_d) that are multiplied together. The MTL spec is http://paulbourke.net/dataformats/mtl/.

Problem 1: wrong imfchan
Use a texture's Color for Base Color and its Alpha for Alpha.

ImfchanExample.png

Expected                    Actual
--------                    ------
map_d -imfchan m Tex.png    d 1.000000
                            map_d Tex.png

The -imfchan option specifies "the channel used to create a scalar or bump texture", ie. it tells you how to make a scalar texture from a color texture. For example -imfchan r means to make a scalar by taking the red component. The expected MTL uses -imfchan m to take the alpha component (m=matte). The actual MTL omits imfchan and therefore uses the default which "for bump and scalar textures is 'l' (luminance)". This is what I'd expect from plugging the image's Color socket into the Alpha.

Problem 2: socket value being written when unused
In the graph above, unplug the Alpha socket, change its default_value to 0.5, then change your mind and plug it back in. The graph is identical.

Expected                    Actual
--------                    ------
(same as above)             d 0.500000
                            map_d Tex.png

It seems the default_value is written as d. The actual MTL file incorrectly says the dissolve from the texture should be halved before being used.

**System Information** Operating system: Linux Graphics card: **Blender Version** Broken: 3.2.0-alpha+master.bf80dc2bd4ac **Short description of error** When exporting an alpha texture to OBJ/MTL, a wrong imfchan is written. Also a wrong d value may be written I'm using "Wavefront OBJ (experimental)" (but the old exporter is the same). Recall that MTL calls alpha "dissolve" and specifies it with a factor (d) and a texture (map_d) that are multiplied together. The MTL spec is http://paulbourke.net/dataformats/mtl/. **Problem 1: wrong imfchan** Use a texture's Color for Base Color and its Alpha for Alpha. ![ImfchanExample.png](https://archive.blender.org/developer/F13031343/ImfchanExample.png) ``` Expected Actual -------- ------ map_d -imfchan m Tex.png d 1.000000 map_d Tex.png ``` The -imfchan option specifies "the channel used to create a scalar or bump texture", ie. it tells you how to make a scalar texture from a color texture. For example -imfchan r means to make a scalar by taking the red component. The expected MTL uses -imfchan m to take the alpha component (m=matte). The actual MTL omits imfchan and therefore uses the default which "for bump and scalar textures is 'l' (luminance)". This is what I'd expect from plugging the image's Color socket into the Alpha. **Problem 2: socket value being written when unused** In the graph above, unplug the Alpha socket, change its default_value to 0.5, then change your mind and plug it back in. The graph is identical. ``` Expected Actual -------- ------ (same as above) d 0.500000 map_d Tex.png ``` It seems the default_value is written as d. The actual MTL file incorrectly says the dissolve from the texture should be halved before being used.
Author
Contributor

Added subscriber: @scurest

Added subscriber: @scurest
Aras Pranckevicius self-assigned this 2022-04-27 08:46:12 +02:00

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Bastien Montagne added this to the Pipeline, Assets & IO project 2023-02-09 15:40:38 +01:00
Philipp Oeser removed the
Interest
Pipeline, Assets & IO
label 2023-02-10 08:54:04 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#97642
No description provided.