# Console3 - logging to the rendering canvas

**URL:** <https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806>\
**Category:** Demos and projects\
**Created:** [September 14, 2021, 12:12am UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806 "2021-09-14T00:12:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [September 14, 2021, 12:12am UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/1 "2021-09-14T00:12:28Z")

</div>

Hello guys!  
The little visual tool prototype I’ve create to help me visualize values on the render canvas is evolving. Maybe you will find a good usage for it as well!

**If you get a white screen just smash the Play button!** There is something wrong with the init code ☹

Here is the PG with a demo

> **[Babylon.js Playground](https://playground.babylonjs.com/#39CH06)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/5/05990a35d570b1a0d183249085848a0caff5031b.png)

I have added a console at the bottom. C, O buttons hides the bottom console or the whole thing, P pauses logging. Mostly I need help to visualize some positions or direction vectors so I started to add some sort of Vector3 visualization.

And this all works in the Playground:

You just have to change the `createScene` function to `async` and add some init code.

```auto
var createScene = async function () {

    await new Promise(r => {
        var s = document.createElement("script");
        s.src = "https://console3.babylonjs.xyz/console3-playground.js";
        document.head.appendChild(s);
        s.onload = r()
    })

    var scene = new BABYLON.Scene(engine);

    var c3 = window.console3 // or whatever you want to name it
    c3.create(engine, scene)
    c3.log("Scene created")

... your code follows

```

and that’s it!

You can tweak some values:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/7/d76fa2cd05835d894f24b0ff7e987f66f81bf692.png)

GitHub:

> **[GitHub - RolandCsibrei/babylonjs-console3](https://github.com/RolandCsibrei/babylonjs-console3)**
>
> Contribute to RolandCsibrei/babylonjs-console3 development by creating an account on GitHub.

Part 1:

> [@Helper to debug BabylonJS code](https://forum.babylonjs.com/t/helper-to-debug-babylonjs-code/23728):
>
> Hi there! I don’t know guys how you are debugging your realtime code but I believe sooner or later everyone will get sick of console.log smiley I think everyone had an idea to display debugging information directly onto the canvas using BabylonJS GUI and so I did. This is a small utitlity class which allows you to easily display multiple information on any object you provide directly on the rendering canvas. This is how it looks in action: The Playground: [https://playground.babyl…](https://playground.babylonjs.com/#UNL3H0#4)

R.

---

<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 14, 2021, 12:59am UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/2 "2021-09-14T00:59:00Z")

</div>

This is rad!!

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [September 14, 2021, 1:42am UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/3 "2021-09-14T01:42:29Z")

</div>

I had to google the meaning of this sentence 😃 😃  
Thank you! 🖖

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [September 14, 2021, 1:57pm UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/4 "2021-09-14T13:57:23Z")

</div>

I love it !!!

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [November 26, 2021, 9:08am UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/5 "2021-11-26T09:08:24Z")

</div>

This is very useful and the idea could be developed further.  
Probably there should be an option to cut the values toFixed(2) to save your eyes 🙂

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [November 26, 2021, 12:36pm UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/6 "2021-11-26T12:36:21Z")

</div>

Yes, there is still lot to do but no time 😃

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [November 26, 2021, 4:18pm UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/7 "2021-11-26T16:18:46Z")

</div>

It looks like the promise was resolving early on line 9, but once those errant parenthesis are removed it wont resolve until the script is done loading, fixing the error that caused the first run to fail. 🙂 And this could def come in handy - I’ll have to try it out soon. 🍻  
[https://playground.babylonjs.com/#39CH06#4](https://playground.babylonjs.com/#39CH06#4)

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [November 26, 2021, 6:17pm UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/8 "2021-11-26T18:17:39Z")

</div>

Thanks for fixing this issue.🕶 I will add the PG page to the repo as well.  
R.

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [December 9, 2021, 3:24pm UTC](https://forum.babylonjs.com/t/console3-logging-to-the-rendering-canvas/23806/10 "2021-12-09T15:24:24Z")

</div>

This is a Hulk Level thank you! 💪 🖖
