x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Rendering to custom GBuffer or rendertarget from material

Hello!

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

Product Version: Not Selected
Tags:
more ▼

asked Aug 05 '14 at 12:08 AM in Rendering

avatar image

Temaran
83 5 5 12

avatar image Temaran Aug 05 '14 at 11:58 PM

Something that I found curious was the SceneTexture:PostProcessInputN nodes that are available. It seems that SceneTexture:PostProcessInput0 represents the compelete renderer output (the complete composite), but there is nothing whatsoever documenting the other SceneTexture:PostProcessInput1 to SceneTexture:PostProcessInput6 variables. Grep:ing the source, I found some references to the other targets however, interestingly enough, in the PostProcessSelectionOutline.cpp global shader. I'm guessing this is the shader that the editor uses for its outlines. The problem is, there does not seem to be an easy way to leverage the 1-6 targets even from here. Looking at that code, it is basically setting up binds (I guess these are the same as DX11 resource views kind of?) like so: PostprocessInput1MS.Bind(Initializer.ParameterMap, TEXT("PostprocessInput1MS"));

I'm assuming this means that I would have to create my own global shader to make use of this, and that there is no real way to write to these targets just from client code.

I of course might be wrong... In any case, this is the best lead I have right now so I guess I'll poke around a bit more. :)

/Temaran

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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 :)

https://forums.unrealengine.com/showthread.php?27766-Odessey-Creating-my-own-G-Buffer-in-UE4

/Temaran

more ▼

answered Aug 11 '14 at 03:59 PM

avatar image

Temaran
83 5 5 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question