armory3d / armortools

3D Content Creation Tools
https://armorpaint.org
Other
3.28k stars 336 forks source link

32 bit tiff format is loading strange #503

Closed AlexKiryanov closed 3 years ago

AlexKiryanov commented 4 years ago

win 10 64 bit v0.8 (2020-07-11) - e3be018 When loading a 32 bit tiff into the library, it displays very strangely. 1 2

AlexKiryanov commented 4 years ago

when you load the .psd 32-bit format into the program, the program crashes

MathemanFlo commented 3 years ago

Hi AlexKiryanov, this is a very interessting observation. Initially I thought you mean 32 bit per pixel, which ArmorPaint can read. These TIFFs would be CMYK or RGBA Tiffs. Both of them are supported. Example: 32bit.zip

But I think you mean 32bit per channel, right? In this case it is not ArmorPaint's fault but it is simply a limitation of the UTIF.js library which is used by the tiff plugin. I think in the function UTIF.toRGBA8 starting in line 959 (https://github.com/photopea/UTIF.js/blob/master/UTIF.js) you can see that it does only expect bits per channel values up to 16 bits. And indeed these files can be imported by ArmorPaint. Example: 16and32bitTifs.zip

As the import plugin has let rgba = UTIF.toRGBA8(ifds[0]); in line 11 there is also no point in importing images with a bigger depth per channel as 8 or TIFFs containing floating point values. Finally in my experience it is almost impossible to completely conform with the TIFF specificatio as its complexity is just insane. But none the less UTIF.js should maybe refuse to load files it can not load.

AlexKiryanov commented 3 years ago

Good evening! Yes, 32 bits per channel. More precisely, I needed to be able to work with linear space. This was necessary for the creation of the bump. When using 8 be per channel, the line is no longer flat. test

MathemanFlo commented 3 years ago

Hi, I think you did not fully upload your png file. I tried to load a 16 bit png with ArmorPaint and this did work but I can not really test whether it works or not because directly exporting the imported texture gives me a 8 bit image and the exported exr files seem to be corrupted (or at least my gimp can not handle them)

AlexKiryanov commented 3 years ago

test16 Good evening again! Thanks for your correspondence) yes 16 bit format per channel is supported. But even with 16 bits per channel, it's still the same picture. streaks when creating a bump map. Exporting textures in 16 bit format gives strange results.

MathemanFlo commented 3 years ago

Good morning, I thought about your issue. I did a very simple experiment to check whether ArmorPaint properly imports heigher bit depths. To this end I created a 16bit png with just two grey scale colors: 0 and 0.001 on a scale from 0 to 1. If the importer converts the image to 8 bits the whole picture will become black as 0.001 is too small to be distinguished from 0. 16bitdepth Then I imported it in Blender and in ArmorPaint to see what happens when I multiply the value by something big. Screenshot 2020-11-18 100316 You see: ArmorPaint remains completely black whereas Blender shows to colors. Thus ArmorPaint does not support this. Further more I tried whether it works internally: To this end I created a gradient texture and applied it as height and base color map for 8,16,32 bit: 32bit 16bit 8bit It looks exactly as expected. To summarize I draw the following conclusions:

  1. There is no way to import high bit depth images -> This could be a feature request
  2. It can compute internally with these values
  3. The exr exporter as the only high bit depth exporter is broken, png (which supports 16 bit per pixel is not supported) -> This is bug and could be a feature request.

How do you see that? I will definitely report the exr bug.

Finally I also have one question: Do you know why I can not view emission, height and subsurface in texture view but only base, normal, occlusion, roughness, metallic, opacity? I never realized that.

AlexKiryanov commented 3 years ago

"Finally I also have one question: Do you know why I can not view emission, height and subsurface in texture view but only base, normal, occlusion, roughness, metallic, opacity? I never realized that." That's a good question! I honestly know. But I'll tell you more, I recently marked up a new post with errors, there is a mention of the display mode in the port. The magic first layer is called.) Read if interested ...) Thank you again for your hard work)

MathemanFlo commented 3 years ago

Thank you for your answer @AlexKiryanov. To be honest I meant something different. I meant in this drop down. I'm sure there is a reason for not adding the possibility to view the other pbr texture parts like emission, ... Screenshot 2020-11-18 153011 But none the less thank you very much for drawing my attention to this issue. It is very interesting.

AlexKiryanov commented 3 years ago

Ahh, well, this is also strange ... well, one thing I can say for sure, the subsurface simply does not work, so it's not so scary that engo is not on the list) One Lubos knows the answer to this question)

luboslenco commented 3 years ago

Only 8bit tiff for now, sorry. Exr export should be fixed, will eventually add exr import for 16/32 bits support, and more height paint improvements coming in opened issues. 🙂