Dplug icon indicating copy to clipboard operation
Dplug copied to clipboard

New image formats for UIImageKnob

Open p0nce opened this issue 5 years ago • 6 comments

We really want separate alpha planes. Use PNG transparency to have a separate alpha for :

  • diffuse
  • material
  • depth
  • emissive
  • emissive hovered
  • emissive dragged

This would be a separate image format for UIImageKnob, and would still support the older one.

p0nce avatar Apr 16 '20 11:04 p0nce

Would be cool to have completely different images for hovered and dragged though ^^

p0nce avatar Sep 05 '21 12:09 p0nce

knob-attack This Renegate UIImageKnob is quite large already, at 76kb.

p0nce avatar Sep 05 '21 12:09 p0nce

The annoying thing is how expensive it is in binary size. The most practical would be: Diffuse / Material / Emissive / Depth in RGBA16 PNG, but that is 200kb in a realistic case. If you separate the 16-bit depth, you can get it down to around 90kb but quite complicated. Using separate data for hovered and dragged gets even more expensive unfortunately.

p0nce avatar Sep 09 '21 07:09 p0nce

Possibly a .glb mesh addition would be useful (but that would require a rasterizer that can rasterize to depth also).

p0nce avatar Sep 30 '21 01:09 p0nce

Binary size will be fixed once we integrate gamut, with its QOIX codec supporting 10-bit images.

p0nce avatar Aug 19 '22 13:08 p0nce

Future ImageKnob format: One row with Diffuse Depth Material Emissive, all with transparency channel. One row with Diffuse Depth Material Emissive, all with transparency channel but not rotated, in order to mix and match rotated and fixed elements. The fixed elements are above the rotating ones. knob

Saves 60% with QOI-10b vs PNG 16-bit.

p0nce avatar Aug 19 '22 15:08 p0nce

As described in the Dplug Tutorial, the new gamut library introduce a "QOIX" format that does 10-bit knobs efficiently

p0nce avatar Oct 13 '22 18:10 p0nce

Gamut v1.0.0 minimally usable for loading images (though it will belikely be slower at first, because of conversions)

p0nce avatar Oct 19 '22 14:10 p0nce

#724 was completed so this is unblocked

p0nce avatar Jan 06 '23 13:01 p0nce

Preliminary work leads to another format, however the reason why the edges are bad are because we resize alpha separately from RGB. In the future, a 16-bit image shall be provided, this images is first aoclpha-premultiplied, then resized in reflow as a single 4HxH block, and then sampled in a single 16-bit RGBA Mipmap of 1-level. Hence, we need RGBA16 linear sampling, and RGBA16 resize, and RGBA16 mipmap, and alpha premul (this one in gamut eventually).

p0nce avatar Jun 21 '23 02:06 p0nce

Done! The new format looks like this: image

It's called "BADAMA_16" since the content is:

  • One square of basecolor+alpha (emissive is given programmatically)
  • One square of Depth + alpha (depth occupies green channel)
  • One square of Material + alpha

The former "ABDME_8" format is still supported, the bit depth give what format the input image is. UIImageKnob support both.

p0nce avatar Jun 21 '23 13:06 p0nce

Available in v13.7.0

p0nce avatar Jun 21 '23 13:06 p0nce