Forums > Jitter

Bug in jit.gl.render ? colored alpha channel

March 14, 2014 | 8:01 am

Hello List,

I am trying to send my render output with alpha channel with syphon to another application.
It works well, if i set the erase_mode of my jit.gl.render to clearcolor.

But if i blend my content, it has always the background color of my jit.gl.render object inside.

Here is a patch, which simulates the problem.
I woud expect, that the shape at the copy_context window is not colored.

Perhaps someone had the same problem and solved it.

<pre><code>

– Pasted Max Patch, click to expand. –

</code></pre>


March 14, 2014 | 10:41 am

use jit.gl.node and set the node’s @erase_color to 0 0 0 0:

– Pasted Max Patch, click to expand. –

March 14, 2014 | 11:04 am

Hello Rob,

Thanks for the nice trick, but my patch is a bit more complex.
I have many (hundreds) gl elements capsulated inside different poly~ objects.

I found no way connecting them to jit.gl.node …
Perhaps there is also a little trick to connect them without wires ;-)

Greetings,
abs11


March 14, 2014 | 11:33 am

Ahhhh …
Got it now.
@name attribute of jit.gl.node is my friend :-)
Sorry for the noise …


March 14, 2014 | 12:15 pm

Hey Rob,

Get strange results, using jit.gl.node @capture 1, if I bang my gl objects manually. (@automatic 0)
Everythin is fine @automatic 1 …

Here is an example based on the jit.gl.node helpfile.
- no texture output
- the videoplane still 3 dimensional @capture 1

Btw is there no chance to get it working without jit.gl.node ?

<code>

– Pasted Max Patch, click to expand. –

</code>


March 17, 2014 | 4:47 am

Hello All,

I am a bit lost. I did not found a solution to grab a texture of my render context with the correct alpha channel, if i trigger my open gl objects manualy. (@automatic 0)

1) The to_texture method of gl.render outputs a wrong alpha
2) There is no texture output, if i use jit.gl.node. gl object @automatic is set to 0

I dont think, that it a very advanced setup ;-)
Perhaps someone has found a solution or workaround.

Or will these bugs fixed ???
Greetings,
abs11


March 17, 2014 | 2:28 pm

capturing with jit.gl.node only supports automatic mode drawing.

maybe try setting your gl.render @erase_color to 0 0 0 0


March 17, 2014 | 5:55 pm

Hello Rob,

gl.render @erase_color to 0 0 0 0 always copies black into the alpha channel.

Is there any hope, that we get a fix or workaround to get a proper alpha out of a render context ?

Greetings,
abs11

Here is a patch:

<code>

– Pasted Max Patch, click to expand. –

</code>


March 18, 2014 | 11:33 am

the texture you capture to must be float32 instead of the default of char.
send the message "type float32" to the texture, after your init rendering.

for some reason, setting the type only works after the render context is initialized, so setting it in the max box with @type float32 doesn’t work.


March 18, 2014 | 12:12 pm

Hello Rob,

Thanks for the tip, but sadly the "type float32" message changes nothing here.
The alpha channel still has black inside. Check the difference between the "original_context" and the "copy_context" while blending the gridshape.

Btw. i am working on max 6.1.6 and 10.8.5 in 32bit mode

Here is my patch, after 4 sec. the texture should be float32.

Greetings,
abs11

<code>

– Pasted Max Patch, click to expand. –

</code>


March 18, 2014 | 1:10 pm

the difference is because you have blend_enable 1 on you jit.gl.videoplane:
<code>

– Pasted Max Patch, click to expand. –

</code>


March 19, 2014 | 11:42 am

Hey Rob,

First i want to thank you for your patience !

But "blend_enable 0" is not an option, because then the alpha channel is gone.
(I need it in the receiving application)
It is difficult to describe with a single gridshape, so i made a new patcher.

It has a white plane with a gradient as an alpha channel.
There are only white pixels in the original_context.
I see a lot af grey pixel here.

Perhaps i am wrong, but for my understanding the copy_context should be white.
If you change to blue (erase_color 0. 0. 1. 0.), the pixel gets blue.

Greetings abs11

<code>

– Pasted Max Patch, click to expand. –

</code>


March 20, 2014 | 9:43 am

sorry, i’m not seeing any unexpected results over here.
below is what i’m seeing when i open your patch, change the orginal-context erase color to blue, and the copy context erase color to pink.

it looks exactly like i would expect.

Attachments:
  1. Screen-Shot-2014-03-20-at-12.41.44-PM

March 20, 2014 | 10:05 am

Hello Rob,

Perhaps this behaviour depends on the gpu.
Mine is an "AMD Radeon HD 6750M"

I have also added a single white line.
At the copy_context there you always see the erase_color of the original_context.

The output looks like this.
scrennshot_blue.png
screenshot_black.png

<code>

– Pasted Max Patch, click to expand. –

</code>

Attachments:
  1. scrennshot_blue
  2. screenshot_black

March 20, 2014 | 10:54 am

BTW
The output is exactly the same on a mac mini (gpu: NVIDIA GeForce 9400)
The expectation is that the copy_contex is white ;-)


Viewing 15 posts - 1 through 15 (of 15 total)