How to get global opacity on mesh group

Hello !

I’m facing a major problem and I’m having hard time finding a better way than what I did.

I’m working on a drawing application. I’m drawing with the “stamp” method. Basically I’m creating a vertice for each pixel between 2 points to create a line. This vertice is rendered as a gl_Point and a custom shader to add textures, color & effects. I’m also setting the opacity here of each point, this is creating an accumulation of opacity due to the high amount of overdraw. This is fine, it’s creating a flow :
But I also needed to have a proper opacity. So I did the only solution I could think of : Rendering each stroke individually when finished on a plane (via a RenderTarget) and set the alpha of this plane. This is working nicely. But doing this had a huge performance impact when recreating the drawing (with stored data). I need to call a render for each stroke of the drawing…

Any ideas ?

Hey this is a bit tough without a repro but why do you need to do a render per stroke. Can’t you merge them into one single vertex buffer a do one render for all strokes?

Hey ! Each stroke is one vertex buffer already. But I can’t manipulate the global alpha / opacity of the mesh, only per vertex opacity. Or I’m missing something.

Sorry what I meant was to have one vb for ALL strokes. Only one VB (As I assume this is the culprit but I would prefer discussing over a real repro)

Hey hi ! Sorry for the late replay, happy new year !

I see. Even if there is only one Vertex Buffer, it does not solve the render issue. Alpha for each vertice is different from alpha of each stroke. If I’m rendering all at once, it will only apply alpha of vertices. So no opacity of stroke is handled.