Hi!
I am into debugging nowadays and had an idea. Can we render the Scene Explorer and the Inspector into a texture and use it in 3D and can we establish a two way event binding?
It seems we can! Please watch this 1 minute long introductory video
Green cursor - my windows desktop cursor
Gray cursor - virtual cursor (when you hover over a 3d panel)
Glows - every element selected on the scene in the 3d panel have it’s bro in the HTML version and it gets highlited
You can see it chaning how I move between the HTML part and the scene just right over a panel.
And you can see my tiny debugger in the right upper corner doing it’s job very well
Guys, is this something cool or was I just wasting my time again? I’ve learned new stuff though. Is/was someone trying to render and two way bind HTML into the scene? I usually found out that someone did the stuff I try to do 5 years ago…
Totally unrelated btw.
You use vue right? I noticed this GitHub - troisjs/trois: ✨ ThreeJS + VueJS 3 + ViteJS ⚡ . I have only played around with vue, but could we port that logic over to babylon? The trois scenes hot update like with react-babylon and r3f and code is way way simpler
Edit:
I did some sleuthing, i was wrong about createApp being the reconciler equivalent, its actually createRenderer , and the hot updates in trois come from defining an hmr key here:
.trois/Scene.ts at master · troisjs/trois · GitHub
Maximize your browser. It is even better to go full screen. You can switch to full screen anytime later. When asked choose the screen with your browser:
Being a prototype only the click events are propagated to the HTML page. The screen offsets are hardcoded so they expect the exact setup you can see on the screen (no embeded mode) and should be run on a FULL HD screen. It runs on 4k as well but the texures are set to 1080px height so they will be cropped.
The textures in BabylonJS are grabbed from the media source and stored as RawTextures so cool stuff can be made. This way we can easily dispaly even the Developer tool windows and watch the console.log in realtime. Or you can transfer your Visual Studio code window and debug with your VR headset put on! Theoretically!
EDIT:
The Baboon forgot to tell you that he had to put the whole /src folder into .eslintignore because of one missing type and he refused to find a better solution.
EDIT2: I tried to do the same using html2canvas so no permissions are required because it doesn’t capture the thing but it renders and it worked very good but it would need a PWA with aggressive caching because it downloads all the Scene Explorer and Inspector assets at every render.
Only to find all the @types was black magic but I’m still missing one so I did something unforgivable, I put /src into .eslintignore… Game over!
However it can be compiled.
@sebavan, thanks for the tip with the VideoTexture, it is working! Actually all the frame grabbing code was trashed by this change But I can’t get rid of this
This is the with the original frame capturing code:
Any idea? Changing the sampling mode doesn’t help.
Thanks!
R.