armory3d / armory3d/armorpaint

Emission handling seems to be broken

Open
#1,298 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
5k
Forks
553
Avg merge
3d 11h
Merged PRs (30d)
6

Description

ArmorPaint version:
ArmorPaint.org - v0.9 (2022-02-26) - https://github.com/armory3d/armorpaint/commit/4d0c3ae5f72577b71d868d69ef044a641096b5f5
Windows - Direct3D11

Issue description:
Emission parameter seems to be stored only in binary form, even through GUI indicates it's a float between 0-1. Bloom effect seems to be applied when emission != 0.0, it can be 0.01 and 1.0 and it will look the same.
Exporting emissions seems to check if alpha channel of normal map is equal to 255, which never happens, so exporting emission never works.
Similar to issue: https://github.com/armory3d/armorpaint/issues/968 but in my case exported image is all black.

Trying to fix export, I noticed there are alpha values 1, 4, 7 where emission should be. I added test function that does check if (alpha value % 3) == 1. That gave me something that looked like an emission map, but with "glitches" on borders where there are gradients. So apparently that logic is still not correct.

My guess is exporting "binary" emission introduced in:
https://github.com/armory3d/armorpaint/commit/0e9e9690175293c94b5eb94016245ed8a93e7389

was broken with this change:
https://github.com/armory3d/armorpaint/commit/9da4f074def1ee01580758f8f076612cfd092ce5

Can you please explain how emission is intended to be stored internally? Only in alpha channel of a normal map with a trick to pack intensity and material type=1 in a single float? Or alpha channel is used only to indicate this particular pixel is an emission (not normal), and real value should be stored in a different channel?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing emission storage and export behavior around commits 0e9e9690175293c94b5eb94016245ed8a93e7389 and 9da4f074def1ee01580758f8f076612cfd092ce5. Compare the alpha encoding with the normal-map export path; done means GUI emission intensity is preserved in exported maps without black output or border glitches.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.