# Screenshot and ParticleSystem

**URL:** <https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508>\
**Category:** Bugs\
**Created:** [October 22, 2019, 12:52pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508 "2019-10-22T12:52:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![PichouPichou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pichoupichou/32/316_2.png) [@PichouPichou](https://forum.babylonjs.com/u/PichouPichou)\
**Post date:** [October 22, 2019, 12:52pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/1 "2019-10-22T12:52:23Z")

</div>

It seems that the CreateScreenshotUsingRenderTarget function stop working with ParticleSystem if the emitter is only a vector.

See line 28-29: [https://www.babylonjs-playground.com/#WBQ8EM#146](https://www.babylonjs-playground.com/#WBQ8EM#146)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [October 22, 2019, 5:49pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/2 "2019-10-22T17:49:17Z")

</div>

I think that whatever the emitter is, you won’t see the particles in a screenshot by using `CreateScreenshotUsingRenderTarget`.

After some source digging, it seems `RenderTargetTexture` deals only with meshes: the `_renderList` property used internally to render objects in the texture is an `Array<AbstractMesh>`, and particle systems are not `AbstrachMesh`: the list of objects is retrieved through a call to `Scene.getActiveMeshes()` whereas particle systems are found in `Scene.particleSystems[]`.

Don’t know if it’s a bug or if it is expected… Looks like a bug to me, however. Maybe @Deltakosh will have some insight about this?

You should use `CreateScreenshot` instead, which will work as expected.

---

<div class="post-metadata">

**Author:** ![Drigax](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/drigax/32/16585_2.png) [@Drigax](https://forum.babylonjs.com/u/Drigax)\
**Post date:** [October 22, 2019, 6:13pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/3 "2019-10-22T18:13:00Z")

</div>

Unfortunately, @Deltakosh is out for the next week. @sebavan, does this sound like a bug to you?

---

<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:** [October 22, 2019, 6:26pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/4 "2019-10-22T18:26:39Z")

</div>

As @Evgeni_Popov mentioned this is not a bug but the expected behavior.  
This is why we also have CreateScreenshot function

---

<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:** [October 22, 2019, 6:27pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/5 "2019-10-22T18:27:46Z")

</div>

Other option is just to create a dummy mesh and use it instead of a vector3 so you can add it to the render list of the rendertarget

---

<div class="post-metadata">

**Author:** ![PichouPichou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pichoupichou/32/316_2.png) [@PichouPichou](https://forum.babylonjs.com/u/PichouPichou)\
**Post date:** [October 22, 2019, 7:55pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/6 "2019-10-22T19:55:03Z")

</div>

Ok thank you.

Yep I noticed I could make it work with a dummy Mesh as you can see in the playground.  
I just also expect it to work with a simple Vector3 that is why I wanted to tell you about the issue.

But if this is expected then it is all good! 😉

> [@Evgeni\_Popov](#):
>
> the list of objects is retrieved through a call to `Scene.getActiveMeshes()` whereas particle systems are found in `Scene.particleSystems[]` .

About that I recently tried to improve our scene performance in our tool [Naker.Back](https://app.naker.io/back)  
In those scenes, there is only one static sphere and one ParticleSystem  
Despite that `evaluateActiveMeshes` function still count for 15% of the scripting time.

 ![particleevaluate](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/7/7af0c0fcbbde20b5d0f19d94e9675f43c7db38e2.png)  
This test is made with a lot of optimization on the only sphere present like  
`mesh.freezeWorldMatrix();`  
`mesh.convertToUnIndexedMesh();`  
`mesh.doNotSyncBoundingInfo = true;`

Plus if I do `this.scene.freezeActiveMeshes();`, the Particles stop moving.

So I wonder why I have still that much scripting time with `evaluateActiveMeshes` if this not used by ParticleSystem?  
If you could explain to me why or lead to a solution to avoid that, it would be awesome! 😉

Cheers

---

<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:** [October 22, 2019, 8:52pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/7 "2019-10-22T20:52:09Z")

</div>

Well it is 15% of a big one? Because if a frame is just 5ms then 15% of it is negligible

Can you show the length of a frame?

---

<div class="post-metadata">

**Author:** ![PichouPichou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pichoupichou/32/316_2.png) [@PichouPichou](https://forum.babylonjs.com/u/PichouPichou)\
**Post date:** [October 22, 2019, 9:25pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/8 "2019-10-22T21:25:40Z")

</div>

The scripting time represent 10% of my test time.

And from the log in chrome, the frame is in average around 2ms?  
 ![frameparticle](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/3/32a2f07c87da45911501b2d00459ffb5922e0638.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [October 22, 2019, 9:52pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/9 "2019-10-22T21:52:19Z")

</div>

Note that what you quoted is related to what the `render` method of `TextureRenderTarget` is doing.

When rendering a scene, `_evaluateActiveMeshes` is called at each frame (inside `_renderForCamera`).

I think it’s expected that you spend most of your time in this function in your case because it’s where the particle system is updated: the function `ParticleSystem.animate` is called inside `_evaluateActiveMeshes`.

---

<div class="post-metadata">

**Author:** ![PichouPichou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pichoupichou/32/316_2.png) [@PichouPichou](https://forum.babylonjs.com/u/PichouPichou)\
**Post date:** [October 22, 2019, 9:59pm UTC](https://forum.babylonjs.com/t/screenshot-and-particlesystem/6508/10 "2019-10-22T21:59:53Z")

</div>

Ok thanks for the explanation @Evgeni_Popov!

This is clear now! 👍

No need to worry about `_evaluateActiveMeshes` 🤙
