Rendering to custom GBuffer or rendertarget from material
I've been playing around with creating outline effects in post process using the material editor, and I have it working for a single-color pass. The problem is I want to be able to color the outline differently depending on some parameter on the objects I add to the custom depth draw. I have a few running theories, but I don't know enough about the rendering system yet to complete any of them.
My first idea was to do an outline at all was to do it in the normal rendering procedure (instead of post process) by first rendering my actor with my base material, and then render the object a second time using a different material. I can't seem to figure out how to force a second render of a particular actor though. I'm guessing I can make this work by creating a material function and then adding that to every single material I want this support for. But I'm not very interested in this solution as it is not post process, and that's what I'm interested to learn more about this time around :)
My inital idea on how to achieve this using the post processing system was to create an additional GBuffer with a relatively low bit depth (4bbp or so) where I could render my objects with a key color, and then use this key color as input for the outline color. I could even skip the edge detection I do now with the depth buffer and use a sobel operator on the key color buffer. There doesn't seem to be any obvious way to create a custom GBuffer though. I've looked a bit at the rendering code, but from what I can tell, there seems to be quite a few steps to create a custom buffer, and that's not even taking into account exposing it in GUI.
So I started looking at another way, and thought I might be able to do the same idea but instead of using a GBuffer I'd use a render target instead and set it to a texture parameter on my post process material. The obvious problem here though is similar to my initial problem. I've looked at SceneCaptureComponent2D which is close to what would be needed, but it only seems to render a complete scene, and I couldn't find a way to only render select materials, or render stages to that texture.
Has anyone else tackled this problem and has some insight they would be willing to share?
I'm going to spend this week playing around with the rendering system, and hopefully create a tutorial for the wiki if I find out something interesting :)
Best regards, Temaran
asked Aug 05 '14 at 12:08 AM in Rendering
I'm currently trying to solve this problem myself, and I think I'm almost there... I have a chronicle on the forum for anyone interested or for anyone who would like to help me out :)
answered Aug 11 '14 at 03:59 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here