Output RTVFX -> 32bit png seq...& pre-multiply safe :<


#1

I’m trying to test out what I think is an unproven pipeline, getting RTVFX from 3D sources into an html 5/js playable thing

it seems that no 3D particle system is capable of grabbing RGB -> png sequence and also craft a “smart” alpha of the (VFX only) destination to make pre-mult assets

and last time I checked only the FLV format had 32bit, but webM also i think…

any info anyone has to share?

currently it is more brute force, video capture, and process the backgrounds out, make duplicates, remove random, turn color BnW… etc…


#2

It’s certainly possibly. Any game that does multi resolution / off screen particles creates a proper premultiplied render texture for compositing back into the main camera. The trick is usually you need to use custom particle shaders with properly setup blend states for the alpha rather than using the same blend as color.

For example, using Unity, if you have a traditional alpha shader, you need to use this blend mode:
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha

Additive shaders should use this:
Blend One One, Zero One
or
Blend SrcAlpha One, Zero One

And premultiplied shaders don’t need anything at all as they already work properly.

The other option is you can render out the effect with a white and black background at the same time and use the difference to calculate an alpha mask. It’s not perfect, but there used to be an asset on the unity asset store that used this technique to generate flipbooks from in game effects. You just need to cameras in the same spot with the different background colors, both rendering to a render texture, and output the black background as the color and dot(1 + (black.rgb - white.rgb), float3(1/3,1/3,1/3)) as the alpha.


#3

it was the initial idea to go fo rtt, but doing x2 cam now is so obvious once you mention it
math for a (“perfect”) alpha seems to be the hardest.

1,1,1,0 on white or black is identical with 1,1,1,1
[this one kept me up an hour last night trying to think through and failed]

i tested o.a = 1 - RGB_black * RGB_white, but mediocre results

i’m in a proprietary engine at the moment, i’ll have to see if the team has some cycles to look into reading the buffers specifically because it is to assist a separate dept