Screenshot from babylonjs viewer

I have just tested, it does work for me using CreateScreenshotUsingRenderTarget.

CreateScreenshotUsingRenderTarget this one is also working for me with 4.2.0 (as I mentioned before) … But I wanted to check with CreateScreenshot that was not working. something is messing up that I can’t understand :smiley:

I’m not sure I understand…

With 5.0, both CreateScreenshotUsingRenderTarget and CreateScreenshot work for me.

It seems there’s something special going on with Vue that makes the screenshot blank in 4.2. In 5.0 we now create the screenshot right at the end of the frame and it seems it fixes the issue.

I have tried again by uninstalling and installing 5.0 again. But CreateScreenshotUsingRenderTarget and CreateScreenshot both does not work for me. I have now again on 4.2.0, CreateScreenshotUsingRenderTarget works for me only.

If there is issue with Vue in that sense than how it’s working with one version and is not working with another. That’s where I’m confused.

Also, video is working fine in both 4.2.0 and 5.0 … :v:

I have used your own repo and simply did:

npm install --save @babylonjs/core@preview
npm install --save @babylonjs/inspector@preview
npm install --save @babylonjs/loaders@preview
npm install --save @babylonjs/serializers@preview
npm install --save @babylonjs/viewer@preview

Then I restarted using npm run serve and it did work for me.

As it is your repo, I don’t understand how it could not work for you(?) Are you seing Babylon.js v5.0.0-alpha.5 - WebGL2 - Parallel shader compilation in the browser console after you did the changes?

As explained above, we did a change in 5.0 compared to 4.2 for the CreateScreenshot method. It seems it’s what make the method work in 5.0.

Hi, I have tested with the given repository and 5.0 is working perfectly with both CreateScreenshotUsingRenderTarget and CreateScreenshot . Then, I looked into my project directory again that what’s the issue so basically, I was using babylonjs 4.2.0 at some place that’s why for 5.0 both were not working.

I think you guys have to update npm install babylonjs --save and corresponding pacakges as well.

Now , I’m using ES6 packages (5.0) @babylonjs/core @babylonjs/viewer and so on…

Results: For 4.2.0, Only CreateScreenshotUsingRenderTarget works
For 5.0 , both CreateScreenshotUsingRenderTarget and CreateScreenshot work

Thanks a lot for your time guys. It’s good to know that issue has been resolved in 5.0.
@Evgeni_Popov @sebavan

GIF has still issues in 5.0 , it’s not working… You guys have to see it again. But thanks for the change of screenshot functionality in 5.0 … It solved my problem.

GIF recording is not working for me in 5.0, but it does not work in 4.2 neither…

yup 4.2 and 5.0 video is working with viewer but for GIF it’s not working with viewer in both versions

@Evgeni_Popov do you mind having a look ? else I can look into it ?

Will do.

1 Like

In fact it does work but only if you move the camera/objects by code, if you use the mouse/keyboard to move the camera it is not taken into account in the animated gif…

For eg, if you create a gif from this scene it does work:

http://localhost:1338/Playground/index-local.html#533IP6

I don’t understand why as it takes some regular snapshots of the canvas every 200ms (by default), so whatever the way you interacted with the scene it should work…

Maybe @sebavan if you have an idea…

This is definitely strange and I have 0 idea on this one. Do not hesitate to assign it to me if you do not find it :slight_smile:

Sold :slight_smile:

1 Like

Fixed by Fix Gif Recording by sebavan · Pull Request #9668 · BabylonJS/Babylon.js · GitHub will be in the next nightly later tonight.

1 Like