jnsmalm / pixi3d

The 3D renderer for PixiJS. Seamless integration with 2D applications.
https://pixi3d.org
MIT License
752 stars 43 forks source link

3d Model and ImageBasedLighting visibility issue #174

Closed StelyanBaltov closed 1 year ago

StelyanBaltov commented 1 year ago

Hello again :) I've noticed a glitch in the ImageBasedLighting or LightingEnvironment class. When you change model visibility to false and turn it back on in for example 3-4 minutes (that value is random, just turn visibility off for a long period of time), the image based lighting is gone. By gone I mean it's just not rendering anymore. The cubemap texture seem to stay in the LightingEnvironment.main object, but they are not applying on the 3d model anymore.

Cheers!

StelyanBaltov commented 1 year ago

By the way, the issue can be tested with either model.visible = false or model.alpha = 0. Also I have tested the demo projects that are linked in the 3d library official page as well.

jnsmalm commented 1 year ago

Hello! Which version of PixiJS did you use when testing this?

StelyanBaltov commented 1 year ago

Hi, I did some more debugging. The issue happens in all version between 5.0.0 and 6.5.0. My game is using pixi version 5.3.10.

jnsmalm commented 1 year ago

Unfortunately this is a bug in PixiJS versions < 6.5.0. The fix in PixiJS was provided in https://github.com/pixijs/pixijs/pull/8479.

The bug happens on automatic gc inside PixiJS. If you can turn it off it should not happen. Try this in your app and see if it helps (depending on your app you might need to destroy your assets yourself if automatic gc won't do it):

PIXI.settings.GC_MODE = PIXI.GC_MODES.MANUAL

StelyanBaltov commented 1 year ago

Thank you! I'll look up the fix commit.