# How to create a custom G-Buffer ?

**URL:** <https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989>\
**Category:** Rendering\
**Tags:** unreal-engine, render-target, Rendering, question, CPP\
**Created:** [April 18, 2014, 5:32pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989 "2014-04-18T17:32:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9fdc589](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9fdc589](https://forums.unrealengine.com/u/anonymous_user_b9fdc589)\
**Post date:** [April 18, 2014, 5:32pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/1 "2014-04-18T17:32:02Z")

</div>

Hello,

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 ? 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6cdbb7bb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6cdbb7bb](https://forums.unrealengine.com/u/anonymous_user_6cdbb7bb)\
**Post date:** [April 23, 2014, 5:23pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/2 "2014-04-23T17:23:22Z")

</div>

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: [Engine Feature Examples for Unreal Engine | Unreal Engine 5.1 Documentation](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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9fdc589](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9fdc589](https://forums.unrealengine.com/u/anonymous_user_b9fdc589)\
**Post date:** [April 23, 2014, 5:29pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/3 "2014-04-23T17:29:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bigzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bigzer](https://forums.unrealengine.com/u/bigzer)\
**Post date:** [April 25, 2014, 7:13pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/4 "2014-04-25T19:13:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6cdbb7bb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6cdbb7bb](https://forums.unrealengine.com/u/anonymous_user_6cdbb7bb)\
**Post date:** [April 25, 2014, 9:54pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/5 "2014-04-25T21:54:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9fdc589](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9fdc589](https://forums.unrealengine.com/u/anonymous_user_b9fdc589)\
**Post date:** [April 25, 2014, 10:01pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/6 "2014-04-25T22:01:25Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![bigzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bigzer](https://forums.unrealengine.com/u/bigzer)\
**Post date:** [May 3, 2014, 7:11am UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/7 "2014-05-03T07:11:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![frostyden](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@frostyden](https://forums.unrealengine.com/u/frostyden)\
**Post date:** [September 6, 2017, 4:23pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/8 "2017-09-06T16:23:46Z")

</div>

Can look at this [[Odessey] Creating my own G-Buffer in UE4 - C++ Programming - Unreal Engine Forums](https://forums.unrealengine.com/development-discussion/c-gameplay-programming/13022-odessey-creating-my-own-g-buffer-in-ue4?27766-Odessey-Creating-my-own-G-Buffer-in-UE4=)

---

<div class="post-metadata">

**Author:** ![Matias\_Mahler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Matias\_Mahler](https://forums.unrealengine.com/u/Matias_Mahler)\
**Post date:** [May 27, 2026, 8:30pm UTC](https://forums.unrealengine.com/t/how-to-create-a-custom-g-buffer/280989/9 "2026-05-27T20:30:51Z")

</div>

Hi!  
12 years later but…  
There is a checkbox on your object in the scene under rendering advanced options called “Visible in Scene Capture Only”  
Also you can define a list of meshes to render on the scene render capture.  
Let me know if that solves the issue.  
Good luck
