# Stalight Starbright

**URL:** https://forum.babylonjs.com/t/stalight-starbright/123
**Category:** Demos and projects
**Tags:** particles
**Created:** [December 10, 2018, 6:23pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123 "2018-12-10T18:23:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)
#### Post date: [December 10, 2018, 6:23pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123/1 "2018-12-10T18:23:54Z")

</div>

In this [topic](http://www.html5gamedevs.com/topic/37487-text-as-polygon-mesh/?do=findComment&comment=236768) @Wingnut asked

> But… WHAT IF… ANY mesh shape can be an emitter

Here is a step to step approach to trying to answer that question.

1. Create a complex mesh shape [Babylon.js Playground](https://www.babylonjs-playground.com/#2K3T61)

2. Add a function that calculates interior points of the mesh and then fill it with spheres for example, [https://www.babylonjs-playground.com/#2K3T61#1](https://www.babylonjs-playground.com/#2K3T61#1)

3. Make the spheres with SPS, add color and wobble them about a bit [https://www.babylonjs-playground.com/#2K3T61#2](https://www.babylonjs-playground.com/#2K3T61#2)

4. Return to the original question and emit particles based on the mesh shape [https://www.babylonjs-playground.com/#2K3T61#4](https://www.babylonjs-playground.com/#2K3T61#4). BEWARE there is something wrong in my code. To rerun you MUST refresh the BROWSER. Clicking on RUN seems to add particles and so points[particle.id] tries to find an entry in the array larger than the number in the array. Perhaps someone can find my error!

EDIT  
4 PG corrected [https://www.babylonjs-playground.com/#2K3T61#7](https://www.babylonjs-playground.com/#2K3T61#7).

---

<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: [December 10, 2018, 6:26pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123/2 "2018-12-10T18:26:49Z")

</div>

Woot! This is really cool! I love it

---

<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: [December 10, 2018, 6:27pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123/3 "2018-12-10T18:27:15Z")

</div>

Wondering if this should be mentioned in the doc actually

---

<div class="post-metadata">

### Author: ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)
#### Post date: [December 10, 2018, 6:32pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123/4 "2018-12-10T18:32:26Z")

</div>

It is my intention to add the createInnerPoints function to the utilities sub-section of the snippets section probably just with the first PG. Any insight into the not being able to use the RUN would be welcomed.

---

<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: [December 10, 2018, 6:53pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123/5 "2018-12-10T18:53:49Z")

</div>

This is probably because you cannot reuse particle.id as the value will keep incrementing (It is not the particle index in the array unfortunately but a unique number: [Babylon.js/babylon.particle.ts at master · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.particle.ts#L143))

---

<div class="post-metadata">

### Author: ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)
#### Post date: [December 10, 2018, 6:55pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123/6 "2018-12-10T18:55:45Z")

</div>

Note to self - stop making assumptions 🥴

---

<div class="post-metadata">

### Author: ![nasimiasl](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nasimiasl/32/34_2.png) [@nasimiasl](https://forum.babylonjs.com/u/nasimiasl)
#### Post date: [December 10, 2018, 8:42pm UTC](https://forum.babylonjs.com/t/stalight-starbright/123/7 "2018-12-10T20:42:16Z")

</div>

that is so nice

---

<div class="post-metadata">

### Author: ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)
#### Post date: [December 11, 2018, 9:44am UTC](https://forum.babylonjs.com/t/stalight-starbright/123/8 "2018-12-11T09:44:00Z")

</div>

Hey @Dad72… here I needed the “agree” button, so I could agree with Naz. So, thats:

Like (old forum)  
Thanks (old)  
Laugh (old)  
Confused (old)  
Sad (old) (rarely used)  
Agree (new button)

That’s a lot of data to store. 🙂

But yeah, johnK… fabulous demos, THANK YOU! That’s VERY kind of you to remember, and follow-up-on one of my future-hopes. Well done! (hug) You have opened some very large and pretty doors.
