Paper2D: Drawing primitives into a render texture

Hi Eric. Thanks for the reply. The second method is exactly what I mean. I implemented a very similar lighting in the Cocos2d engine a while back (using [this article][1] from gamedev.net). My problem is not about calculating the shadow geometry, but porting this solution to UE4. Mainly because it’s a huge code base and I don’t even know where to look first.

The way I did it in Cocos2d was to first let the engine render the unlit scene, like this ugly example:

Then I added a final step, where I rendered all the lights (and shadows) into a render texture. This texture was then multiplied into the framebuffer (with the already rendered scene) to get the final result:

Since I posted this question I learned about the [UTextureRenderTarget2D][4] class. I didn’t have much time to look into it yet and I found very little information on how to use it. Can I use this class to render some 2D shapes into a texture which I then multiply into the scene as a post processing effect?

In my Cocos2d implementation I simply used some OpenGL draw calls to render the lights and shadows into the render texture. I think we are not supposed to do that in UE4 for portability reasons (right?). What would I use instead? What is a low level drawing API that would allow me to efficiently draw some colored and/or textured triangles?

Thanks!