Libgdx: G3D models mostly white because of wrong emissive color

Created on 22 Jan 2019  Â·  14Comments  Â·  Source: libgdx/libgdx

Issue details

Since #5077 emissive is now implemented (which is good) but there is a serious drawback. Several devs have an issue with their 3D model rendering looking brighter than before because of emissive information in their model files.

First of all, this change breaks in some way and i think it would be great to add something like this in CHANGES.MD (kind of migration guide) :

[1.9.9]
- Emissive texture and color are now implemented in the default 3D shader. 3D models files(g3d, gdb, obj)
  may have unwanted emissive information and have to be migrated in order to look as before. In Blender, any material 
  with "shadeless" option, non-zero "Emit." value or "emit texture" will look brighter or totally white. If so, you
  have to export them again without these emissive information. A workaround is to remove all emissive information
  programmatically in your game : material.remove(ColorAttribute.Emissive).

I investigated and it appears that migration guide above is not enough. I'm pretty sure this is a bug related to fbx-conv. I'm posting here to centralize information and make it easily available to libgdx users. Here is what i found :

  • Blender FBX plugin exports both Emissive color and Emissive factor. As you can see here Emissive color is just a copy of Diffuse color and Emissive factor is the "Emit." factor from Blender.
  • FBX-CONV only use Emissive color which is wrong IMO, see here.
  • I think it should be multiplied by Emissive factor. For reference, FBX SDK provides both values.

If fbx-conv has to be fixed, it would be great to add a note about it in changes.md or another appropriate place to inform users about fbx-conv / libgdx version compatibility.

Reproduction steps/code

  • open Blender with its default template (a box with a white material)
  • add a dark diffuse texture (optional step to easily see the issue)
  • export as FBX
  • convert it with fbx-conv (json or binary)
  • render that model in libgdx
  • model will be mostly white

Version of LibGDX and/or relevant dependencies

  • libgdx 1.9.9+
  • fbx-conv 0.01.0055 x64 , FBXSDK 2014.02
  • blender 2.79b

Stacktrace

N/A

Please select the affected platforms

  • [x] Android
  • [x] iOS (robovm)
  • [x] iOS (MOE)
  • [x] HTML/GWT
  • [x] Windows
  • [x] Linux
  • [x] MacOS
3D maintainer needed

Most helpful comment

Can confirm - I'm having this issue as well. I downloaded sources for FBX-conv, and changed the "emissive" property to always write to [0,0,0], which fixes the issue and makes models appear as they do in LibGDX v1.9.8. I can provide this .exe and will also try to see if multiplying the "emissive" property by the "emissive" factor before writing the .g3db/.g3dj file fixes the problem as well. I will submit a pull request with the corrected version over at the FBX-CONV repo when finished.

All 14 comments

Can confirm - I'm having this issue as well. I downloaded sources for FBX-conv, and changed the "emissive" property to always write to [0,0,0], which fixes the issue and makes models appear as they do in LibGDX v1.9.8. I can provide this .exe and will also try to see if multiplying the "emissive" property by the "emissive" factor before writing the .g3db/.g3dj file fixes the problem as well. I will submit a pull request with the corrected version over at the FBX-CONV repo when finished.

Nice issue, can confirm. Fbx-conv fix very welcome!

Thanks for issue! I was looking for solution for a few days. It would be nice if fbx-conv could ignore emissive values eg. with some parameter. In one of my models it even duplicates DIFFUSE texture as EMISSIVE texture.

@mgsx-dev @Tom-Ski @wajrou
Pull request with fix & option to disable here: https://github.com/libgdx/fbx-conv/pull/110
Fixed binary available here if desired: https://github.com/wdavies973/fbx-conv/releases

Anyone know why this is inadequate to solve it? I have a model for which I've lost the original Blender file. I only have the g3db.

for (Material material : myModel.materials){
    material.remove(ColorAttribute.Emissive); 
}

I ran this and inspected the model in the debugger and it no longer has an emissive color attribute.

I mean it would technically fix it, but then you can't use the emissive
property. So I guess it depends on if you want to use the emissive property
or not.

On Wed, Jun 19, 2019, 6:41 AM cypherdare notifications@github.com wrote:

Anyone know why this is inadequate to solve it? I have a model for which
I've lost the original Blender file. I only have the g3db.

for (Material material : myModel.materials){
material.remove(ColorAttribute.Emissive);
}

I ran this and inspected the model in the debugger and it no longer has an
emissive color attribute.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/libgdx/libgdx/issues/5529?email_source=notifications&email_token=ACZBMS4A4XXPMBIBXO4G7FLP3ILNJA5CNFSM4GRPTQIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYBSY4Y#issuecomment-503524467,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACZBMS6LTDPD2R7PHSFMA43P3ILNJANCNFSM4GRPTQIA
.

Correct. Problem was resolved via fbx-conv PR.

Well they haven't actually merged it yet for some reason, but I do have a
fork running with the fix.

On Wed, Jun 19, 2019, 6:50 AM Tomski notifications@github.com wrote:

Correct. Problem was resolved via fbx-conv PR.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/libgdx/libgdx/issues/5529?email_source=notifications&email_token=ACZBMSYPSQZTUC7IIG26QMDP3IMRRA5CNFSM4GRPTQIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYBTP4Q#issuecomment-503527410,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACZBMS2OHNXWOXTWJD3X2VLP3IMRRANCNFSM4GRPTQIA
.

I merged this PR (similar cleaner PR) a few weeks ago.

Got it, thanks.

On Wed, Jun 19, 2019, 6:55 AM Tomski notifications@github.com wrote:

I merged this PR (similar cleaner PR) a few weeks ago.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/libgdx/libgdx/issues/5529?email_source=notifications&email_token=ACZBMS2MMDBWL6R6I77WCEDP3INCBA5CNFSM4GRPTQIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYBT2NA#issuecomment-503528756,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACZBMS57KUQRNA4BCMV32OTP3INCBANCNFSM4GRPTQIA
.

What I mean is, I ran that code and my model is still white. I tried your fbx-conv.exe but it can't find the dlls it needs even though I have VC++ Redist installed (2010 among several other later versions). Maybe I don't have the version corresponding to what you built with? I don't know if that matters--don't use VS hardly at all. Thanks.

as discussed elsewhere, this issue require a new fbx-conv release in order to be closed, @Tom-Ski i think it's in your hands :-) (no pressure).

Can discuss on that repo.

The binaries should all be built, so no release should be required as its on snapshot.

Oh OK, i didn't see that, thing is https://libgdx.badlogicgames.com/tools.html still link to the old one but that's surely something that will be addressed in the new website.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

badlogic picture badlogic  Â·  104Comments

alexdriedger picture alexdriedger  Â·  18Comments

jrenner picture jrenner  Â·  24Comments

mars3142 picture mars3142  Â·  15Comments

davebaol picture davebaol  Â·  37Comments