engine icon indicating copy to clipboard operation
engine copied to clipboard

envAtlas problems with StandMaterial

Open Casval111 opened this issue 3 years ago • 1 comments

In class StandMaterial, property "prefilteredCubemaps" is defined with setter, witch generating envAtlas from prefilteredCubemaps. The result of generated Texture is just stored in the material instance, not shared with others. If there are multiple material instances, with save prefilteredCubemaps asset, same number of envAtlas texture (512 * 512) will be generated at runtime. That makes our projects crash on mobile device, such as iPhone.

The envAtlas texture, generated by generatePrefilteredAtlas, cannot be restored by uploading source, when context restore.

Casval111 avatar Sep 07 '22 06:09 Casval111

Hi @Casval111 ,

Just generate the envAtlas yourself from the cubemap and set it directly on StandardMaterial.envAtlas on all materials that need it?

The envAtlas texture, generated by generatePrefilteredAtlas, cannot be restored by uploading source, when context restore.

You are correct, this is a known issue. Ultimately the envAtlas should be pre-generated and stored in a PNG so reloading after restore would just work.

Thanks!

slimbuck avatar Sep 07 '22 07:09 slimbuck

@Casval111 Just a note that the Texture Tool has been updated to allow you to generate the envAtlas texture.

willeastcott avatar Oct 15 '22 21:10 willeastcott

The envAtlas texture, generated by generatePrefilteredAtlas, cannot be restored by uploading source, when context restore.

You could also hook up to 'devicerestored' event on the device, and regenerate atlas from the cubemap at that point.

mvaligursky avatar Nov 18 '22 15:11 mvaligursky

We can close this as done, new prefiltering lighting in the Editor is stored as png.

mvaligursky avatar Oct 10 '23 18:10 mvaligursky