how to draw in bigger depth than 8 bits... and fast?

Alexandre's icon

Hi,
In the picture bellow you see some circles drawn* with jit.gl.mesh, with the transparency value in the @erase_color inside jit.gl.render set to 0.01 (very deep transparency) : This result in an alteration of the colors and the smoothness of the transparency. This is because of the limited 8bits depth (only 256 levels) that cannot be precise enough.

What would be the best way to draw circles or lines in a bigger depth than 8 bits... and FAST ?
I suppose it can't be possible using openGL ?
Can this depend about the graphic card ?

Thanks,

1830.deeptransparencycoloralteration.png
png
Rob Ramirez's icon

hi alexandre, cool patch.
i'm not sure what you think is 8 bits. color in opengl is handled by floating point numbers.
i'm also not sure what you think is wrong in the attached image.

you may want to look at capturing the mesh to a texture and performing some post-processing slab effects (such as a bloom effect).

Alexandre's icon

> "color in opengl is handled by floating point numbers"

??
It really doesn't look like. You mean 3 floats? R,G,B ?
I still feel like a beginner in openGL and also jitter sometimes, but i know what low resolution means :
Again, look carefully at the following patch attached bellow, where the alpha goes up and down every four seconds : Every four seconds you see few strange things while the alpha goes deeply down :
- Some kind of 'quantization-effect' while the alpha is always moved smoothy by the [metro 20]
- Alteration of the color
(And the 'maximum-concentration-zone' of the circles shouldn't go that darker, but should keep at least some little part in light-yellow...)

This looks clearly to me like an consequence of a low depth, something like standard 24bit image...

Do you see now 'what is wrong' for me ?

1834.41Verletsblendedmatquantizationeffe.maxpat
Max Patch
Alexandre's icon

>"i'm not sure what you think is 8 bits."
Like many jitter object that are only using 4-plane char matrixes ( 4 * 8 bits ) , here, through the color&alpha data input are floats, the alpha value seems also to be limited to 8 bits :
1/256 = 0,0039 :
When you put that special value for alpha, you exactly get the last darker possible value, before it suddenly gets black...
Uncheck the big toggle on the left in the patch attached bellow to see this.

Even if I'm still not sure than the color alteration (that you see better in this last patch) have also to do with an "8 bits limit" or an other kind of limit, i do want to draw transparent circles in bigger depth... How ?

1835.41Verletsblendedmat8bitsquantize.maxpat
Max Patch
Rob Ramirez's icon

ahh yes, you are correct, my apologies. i believe this is a consequence of the opengl pixel format used for the render buffer.

i'm not really sure there is a solution for this, however wes or jkc may have a better answer.

Alexandre's icon

In fact, to be clear, theses 'quantization-effects' are appearing in two different places :

- With [jit.gl.mesh @blend_enable 1 @color 1. 1. 1. 0.0038] (...in the patches above.)
or either :
- With [jit.gl.render @erase_color 1. 1. 1. 0.0038] ... in the patch attached bellow, where, if the depth would be more than 8 bits, then the grey trace should disappear instead of staying... (And which shouldn't go grey in fact but decrease in dark yellows..)

Thanks,

1838.41Verletsblendedmatalphaquantizatio.maxpat
Max Patch
Andrew Benson's icon
Max Patch
Copy patch and select New From Clipboard in Max.

If your GPU supports floating-point textures, you can @capture into a @type float32 texture and run that through some sort of temporal filter to get the type of long trails you are looking for. I believe Wes posted a "accum" shader somewhere on the forum that mimics the erase_color with low alpha look. Using this technique should eliminate the quantization accumulation artifacts that you are seeing with the default rendering context.

Alexandre's icon

Hey, two months after,
I just forgot to thank you, Andrew, for your apparently working solution!
Even if my level in openGL make me a bit confuse with all this...
( Anyway, I was looking for a developer to help me in my project who could help me also a bit on openGL i hope : https://cycling74.com/forums/job-opportunity-3-month-anywhere-javamax-developers-needed )

1985.41Verletsglmeshandrewexampleworking.maxpat
Max Patch