Re: [css-transforms] CSS3D breaks with opacity flattening

> It's been a while since I have done 3d graphics programming, but isn't this
> solvable as a 'render to texture' - a simple technique that dates back to
> very early 3d game graphics? This should preserve-3d on the car frame for
> the internal 3d perspective, no? You could even use a simple pixel shader
> of you fancied having depth still working.

Indeed, rendering to a texture is what would happen under-the-hood to create the "imposter" effect.  Rather than expressing this implementation detail directly in the spec; however, it should happen automatically when the opacity is set on the group, as used in Matt Woodrow’s approach.  It is also very important that the transforms are not affected during the “imposter” texture generation.  The UA would simply render the sub-set of the scene that is within the opacity group to the texture at full opacity separately than the rest of the scene.  When this imposter texture is composited with the rest of the scene in a later render pass, the opacity would be applied.  This preserves the occlusion of elements within the group.

Of course, there could be other fast-paths that could be applied when very few layers are grouped together that avoid the extra render pass.  For example, multiple elements could be composited together by the fragment shader within a single draw call.  The choice of optimal rendering path is an implementation detail, while the CSS spec should allow expression of intended blending behavior.
- Kip

Received on Wednesday, 21 September 2016 00:30:56 UTC