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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to create a custom G-Buffer ?


In an other game engine I was able to work with a great feature that allowed me to render something in a specific render "layer". This allowed me to draw some meshes only in a specific render to texture and use this texture for some special cases in my shaders.

I would like to create a similar possibility in UE4 by creating a custom Render Buffer. Unfortunately I have no idea how or even where to look. Digging in the source code is a bit hard when you don't know what you are looking for.

So how do you create a custom Render Buffer ? :)

Product Version: Not Selected
more ▼

asked Apr 18 '14 at 05:32 PM in C++ Programming

avatar image

260 22 27 37

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

1 answer: sort voted first

Start your search looking for the SceneCaptureComponent2D component and TextureRenderTarget2D.

If you look at the Blueprints example in the marketplace, there are security cameras that have SceneCaptureComponent2Ds attached that capture the scene/process it to a TextureRenderTarget2D, and then you are able to use that TextureRenderTarget2D as a texture in other shaders/post processes/etc.

Some documentation on the security camera setup is here: https://docs.unrealengine.com/latest/INT/Resources/Showcases/BlueprintExamples/SecurityDoor/index.html , although it's probably best to dive in and play with it in the editor.

This isn't exactly a 'custom G-Buffer', but a custom render target for only drawing certain items to sounds more the direction you're headed?

more ▼

answered Apr 23 '14 at 05:23 PM

avatar image

108 11 11 221

avatar image Froyok Apr 23 '14 at 05:29 PM

Hey thanks for your comment ! :)

Unfortunately a classic RTT will not work in my case as it would requires to have the meshes displayed on the screen (on the user side I mean) to be able to draw them in the texture.

What I'm looking for is a way to draw some meshes in the texture without having to draw them on the screen. (Well technically I will have to draw them, but I don't want the player to see them.)

avatar image bigzer Apr 25 '14 at 07:13 PM

I'm hoping to be able to do exactly that as well; rendering certain objects from a scene sepparately on a texture by a camera that is not the active one (active one=being shown full screen).

avatar image DanYouhon Apr 25 '14 at 09:54 PM

Could you guys clarify if you mean "meshes not on screen" or "meshes not in the scene"? The method I mentioned and in the example works for anything that is in the level. You can put a camera pointing at anything in the level, even if the camera is "off screen" and far away, and it'll render to the texture.

If you're meaning that you want to render an object that isn't placed in the scene, sort of like the thumbnails in the Editor, then that's a separate issue and my answer would not cover that.

avatar image Froyok Apr 25 '14 at 10:01 PM

Well my goal is to get/set an additional stencil buffer. A camera far away in the scene is a viable solution indeed and will work in my case. I'm not sure however it will work for everything.

You mentioned the thumbnails and I didn't thought about them, I will dig into that. Thanks. :)

avatar image bigzer May 03 '14 at 07:11 AM

In my case I need to be able to render only two objects from a complex scene in a TextureRenderTarget2D with one camera, while having another camera rendering the entire scene except the two previously mentioned objects.

(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