# SPS multimaterial picking bug

**URL:** <https://forum.babylonjs.com/t/sps-multimaterial-picking-bug/25105>\
**Category:** Bugs\
**Created:** [November 9, 2021, 10:33am UTC](https://forum.babylonjs.com/t/sps-multimaterial-picking-bug/25105 "2021-11-09T10:33:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![priyadarshi](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@priyadarshi](https://forum.babylonjs.com/u/priyadarshi)\
**Post date:** [November 9, 2021, 10:33am UTC](https://forum.babylonjs.com/t/sps-multimaterial-picking-bug/25105/1 "2021-11-09T10:33:08Z")

</div>

Hello,

While applying multi materials to SPS system, picking returning null on non 0 material elements.

Steps:

1. Create SPS with picking and multimaterial on.
2. Add 2 or more materials to SPS.  
3 Use all materials to different particles
3. Try picking each particle. Only with material 0 will return value others will return null.

Result: All should return valid particle values.

[SPS MultiMaterials | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#RCUHJA#57)

Tested on version 4.2 and last nightly build.

Please have a look at code, maybe I missed something.

Thanks

---

<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:** [November 9, 2021, 4:50pm UTC](https://forum.babylonjs.com/t/sps-multimaterial-picking-bug/25105/2 "2021-11-09T16:50:16Z")

</div>

I ll have a look ASAP.

---

<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:** [November 11, 2021, 8:00pm UTC](https://forum.babylonjs.com/t/sps-multimaterial-picking-bug/25105/3 "2021-11-11T20:00:47Z")

</div>

PR is up here: [Fix SPS picking on multi material by sebavan · Pull Request #11437 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/11437)

---

<div class="post-metadata">

**Author:** ![priyadarshi](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@priyadarshi](https://forum.babylonjs.com/u/priyadarshi)\
**Post date:** [November 14, 2021, 2:53am UTC](https://forum.babylonjs.com/t/sps-multimaterial-picking-bug/25105/4 "2021-11-14T02:53:42Z")

</div>

Thanks a lot 🙂
