# Is it possible to use create a screenshot using render target along with capturing FullscreenUI?

**URL:** <https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283>\
**Category:** Questions\
**Created:** [April 1, 2019, 10:13pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283 "2019-04-01T22:13:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [April 1, 2019, 10:13pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/1 "2019-04-01T22:13:06Z")

</div>

(Sorry for the long title, discourse was giving me issues with using just the function names).  
Here is the playground: [Babylon.js Playground](https://www.babylonjs-playground.com/ts.html#NFIVHM)

It looks like the standard CreateScreenShot function works for capturing the FullScreen UI, however using a render target does not. Perhaps I am missing something, but it would be nice to be able to use the anti-aliasing along with a few of the other options.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 1, 2019, 10:17pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/2 "2019-04-01T22:17:19Z")

</div>

Unfortunately the GUI does not render into rendertarget unless you use GUI for meshes and not for fullscreen ☹

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [April 1, 2019, 10:21pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/3 "2019-04-01T22:21:47Z")

</div>

Okay, that makes sense.

The CreateScreenShot function seems to produce pretty poor results for me, regardless of the image size. Is there a better way to produce an image of what is actually shown to the user?

Also, as a side note, is it possible to use the DynamicTextures for Meshes to create a text that maintains its size (like the 2D UI)?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 2, 2019, 2:27pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/4 "2019-04-02T14:27:16Z")

</div>

You can create a GUI for mesh, then make that mesh a child of the camera so it will always stays still.

CreateScreenShot is dumping the content of the canvas so it should produce pretty accurate rendering. Can you repro your issue in the playground?

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 6, 2019, 5:30pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/5 "2019-09-06T17:30:13Z")

</div>

Sorry to bring this back up, but I have started looking at this again.  
Now that I know UsingRenderTarget is better in regards to quality, I am now trying to get it to function with my gui elements.

I have taken your suggestion for adding the elements to a plane, however, I am struggling to get a close representation of the plane with gui material vs just the gui.

[https://www.babylonjs-playground.com/#NFIVHM#4](https://www.babylonjs-playground.com/#NFIVHM#4)

I found this post [Make a Perfect Plane to Fit Frustum - Questions & Answers - HTML5 Game Devs Forum](http://www.html5gamedevs.com/topic/33246-make-a-perfect-plane-to-fit-frustum/) but it’s not a perfect solution.

Any ideas on how to get this closer?

Thanks

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 6, 2019, 6:13pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/6 "2019-09-06T18:13:27Z")

</div>

On my phone but here is a suggestion:  
Why not using a Layer for that?

example: [https://www.babylonjs-playground.com/#08A2BS#12](https://www.babylonjs-playground.com/#08A2BS#12)

(this one is background but you can make it foreground)

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 6, 2019, 6:17pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/7 "2019-09-06T18:17:40Z")

</div>

It doesn’t look like layers are captured with `CreateScreenshotUsingRenderTarget`, unless I am missing something.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 6, 2019, 9:25pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/8 "2019-09-06T21:25:04Z")

</div>

Rats! you are right ☹  
Well this is where the Node Material could be super useful 🙂 You could create a vertex shader that will generate the quad in screen space directly

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 6, 2019, 9:53pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/9 "2019-09-06T21:53:09Z")

</div>

You wouldn’t happen to have a simple example that does that in a playground would you?

I watched the youtube video you just put out today, but since I am creating the gui on the fly, I am unsure how I will be able to convert it to a shader.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 6, 2019, 10:45pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/10 "2019-09-06T22:45:43Z")

</div>

On my phone right now but you could also think about doing a shadermaterial with the following vertex shader:

> <https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/layer.vertex.fx>

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 6, 2019, 11:48pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/11 "2019-09-06T23:48:48Z")

</div>

I think I am semi-close. I couldn’t get the shader material to work, so I attempted to recreate it in the nme.

[Babylon.js Node Material Editor](https://nme.babylonjs.com/#Q8T5FV) Some work needs to be done as I think the image is upside down and rotated wrong, but this shader stuff is new to me.

Anyways, I generated the code and [copy-pasted into here](https://www.babylonjs-playground.com/#M36D7F#7), but am getting an error.

`Unable to compile because Build of NodeMaterial failed: input right from block Multiply[MultiplyBlock] is not connected and is not optional.`

Odd, because both inputs are declared.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 9, 2019, 4:02pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/12 "2019-09-09T16:02:59Z")

</div>

Nope I do not see the right input connected:

```auto
    var Multiply1 = new BABYLON.MultiplyBlock("Multiply1");
    Texture.rgba.connectTo(Multiply1.left);

    var fragmentOutput = new BABYLON.FragmentOutputBlock("fragmentOutput");
    Multiply1.output.connectTo(fragmentOutput.rgba);
    nodeMaterial.addOutputNode(vertexOutput);
    nodeMaterial.addOutputNode(fragmentOutput);

```

multiply1 is only connected for left but not right

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 9, 2019, 4:03pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/13 "2019-09-09T16:03:53Z")

</div>

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/e/e0fff623ef940c5475b54a1b9cfe86b0752f7f0a.jpeg)

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 9, 2019, 4:24pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/14 "2019-09-09T16:24:20Z")

</div>

So oddly, I cannot open that [nme link](https://nme.babylonjs.com/#Q8T5FV) now, since it is failing.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 9, 2019, 4:26pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/15 "2019-09-09T16:26:00Z")

</div>

yes I saw it…a fix is on its way  
In the meantime open jsut [nme.babylonjs.com](http://nme.babylonjs.com) and when opened add the tag

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 9, 2019, 4:31pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/16 "2019-09-09T16:31:09Z")

</div>

Okay perfect. That seems to work just by removing the multiply. The NME is pretty neat, glad you pushed me to look more into it. Great work!

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 9, 2019, 4:36pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/17 "2019-09-09T16:36:00Z")

</div>

I appreciate that you like it 🙂

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 9, 2019, 5:09pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/18 "2019-09-09T17:09:59Z")

</div>

Okay, I think I am almost there, I just need to go from GUI.AdvancedDynamicTexture to BABYLON.Texture. [https://www.babylonjs-playground.com/#NFIVHM#6](https://www.babylonjs-playground.com/#NFIVHM#6)

I am not sure how to get either a valid url or the base64/ArrayBuffer of the AdvancedDynamicTexture.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 9, 2019, 8:37pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/19 "2019-09-09T20:37:13Z")

</div>

> [@Devin\_Wright](#):
>
> I am not sure how to get either a valid url or the base64/ArrayBuffer of the AdvancedDynamicTexture

What do you need here? you can use the adt like a regular texture

---

<div class="post-metadata">

**Author:** ![Devin\_Wright](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devin_wright/32/4302_2.png) [@Devin\_Wright](https://forum.babylonjs.com/u/Devin_Wright)\
**Post date:** [September 9, 2019, 8:39pm UTC](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283/20 "2019-09-09T20:39:07Z")

</div>

I am trying to add all of my gui elements to an texture, that is then used in the shader program, so that when calling UsingRenderTarget, my gui elements will also be displayed.

[Next page](https://forum.babylonjs.com/t/is-it-possible-to-use-create-a-screenshot-using-render-target-along-with-capturing-fullscreenui/2283.md?page=2)
