secondlife / viewer

🖥️ Second Life's official client
GNU Lesser General Public License v2.1
212 stars 53 forks source link

Material Upload of GLTF silently rejecting 16 bit textures #1947

Open canny[bot] opened 4 months ago

canny[bot] commented 4 months ago

I created a gltf file with Blender for a simple Tshirt texture set. When I try to use the upload material tool the only texture it loads is the metallic-roughness

The file is created with blender 4.1.1 and I followed the notes on the SL-Wiki (https://wiki.secondlife.com/wiki/PBR_Materials#Blender). These notes are out of date with Blender version 4 as 'Sequencer: Linear ACEScg' has been renamed in Blender to only 'ACEScg' in color management.

(EDIT: I also checked Blender 3.6.11 LTS and the SL-Uploader is not picking up the textures there either)

(EDIT2: I can upload the textures as images fine. And re-importing the gltf file to Blender shows all images are correctly assigned)

https://secondlife.canny.io/admin/board/bug-reports/p/material-upload-of-gltf-does-not-recognize-diffuse-normal

canny[bot] commented 4 months ago

This issue has been linked to a Canny post: Material Upload of GLTF does not recognize Diffuse & Normal :tada:

AtlasLinden commented 4 months ago

Comments from Nyx on Canny explains why the reporter was producing this issue (although they were using a 48 bit texture): I have also seen this behaviour but came to the conclusion that when 16 bit image files are assembled into a GLTF/GLB those files will not make it to the GLTF uploader. If you have exported 16 bit PNG files from Substance Painter for instance, and then want to make them into a GLTF through Blender, it will by default just pass those files on. The ORM file is assembled by Blender and so will be exported as 8 bit, but the others are passed on as-is. You can either have the original files exported by your original program as 8 bit, or you can in Blender force at least PNG:s to be converted into JPEG and in so doing have them exported as 8 bit. In short - SL does not like 16 bit. If on the other hand you upload the files manually (bulk or single) any 16 bit will be converted on the fly.

Would it be possible to make the GLTF uploader do on-the-fly conversion to 8 bit instead of silently rejecting the image files? Also, it would be great if it warned that continuing the upload it will do this. In the meantime, can we have the Wiki page https://wiki.secondlife.com/wiki/PBR_Materials updated to inform of the current behaviour and it being because of 16 bit image files in the GLTF/GLB file and that these need to be converted to 8 bit for the uploader to accept them? Thank you! Would of course prefer having 16 bit support for at least Normal maps...