# Decal geometry with child geometries

**URL:** <https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [November 5, 2018, 9:57am UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798 "2018-11-05T09:57:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![guybou](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@guybou](https://discourse.threejs.org/u/guybou)\
**Post date:** [November 5, 2018, 9:57am UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/1 "2018-11-05T09:57:22Z")

</div>

I’m loading a model using objloader and my model include several child geometries.  
I would like to project an image on the model same as demonstrated in the decal example ([https://threejs.org/examples/webgl\_decals.html](https://threejs.org/examples/webgl_decals.html))

however when I’m trying to add the decal on the model, the decal object expect to get a mesh with geometry, and my model object contains several child geometrie and this is not working. if I’m using only one of the child geometries it is working - but then the projection is not correct as it should be projected on all.

how can I support the child geometries when using decal?

---

<div class="post-metadata">

**Author:** ![guybou](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@guybou](https://discourse.threejs.org/u/guybou)\
**Post date:** [November 5, 2018, 10:44am UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/3 "2018-11-05T10:44:25Z")

</div>

I updated the post with more details

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 5, 2018, 10:51am UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/4 "2018-11-05T10:51:00Z")

</div>

You would have to enhance the implementation of `DecalGeometry` to support meshes with children. Instead of doing this, have you tried to merge your object hierarchy into a single mesh?

---

<div class="post-metadata">

**Author:** ![guybou](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@guybou](https://discourse.threejs.org/u/guybou)\
**Post date:** [November 5, 2018, 11:59am UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/5 "2018-11-05T11:59:45Z")

</div>

merging may be good idea, what would be the best way to do it?  
assuming each geometry has it’s own textures

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 5, 2018, 2:43pm UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/6 "2018-11-05T14:43:44Z")

</div>

> [@guybou](#):
>
> assuming each geometry has it’s own textures

Would it be possible to merge the objects in a content creation tool? What kind of objects are we actually talking about^^?

---

<div class="post-metadata">

**Author:** ![guybou](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@guybou](https://discourse.threejs.org/u/guybou)\
**Post date:** [November 5, 2018, 2:52pm UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/7 "2018-11-05T14:52:31Z")

</div>

not really an option…  
I’ve got an obj model with textures (mtl).  
I’m using the ObjLoader to load it - it’s output is an object which don’t have geometry property - but child objects. each child object has geometry (BufferGeometry)  
I found the web samples for merging geometries but non of them handle the materials.  
any idea how to do it properly?

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 5, 2018, 2:56pm UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/8 "2018-11-05T14:56:27Z")

</div>

You might want to check out [BufferGeometryUtils.mergeBufferGeometries()](https://github.com/mrdoob/three.js/blob/771b015e471ded9a9ce9656e6814c74c33c0904f/examples/js/utils/BufferGeometryUtils.js#L191). The second parameter `useGroups` can be used to generate [groups](https://threejs.org/docs/index.html#api/en/core/BufferGeometry.groups) for the merged geometry. Groups enable the usage of multiple materials per object.

---

<div class="post-metadata">

**Author:** ![guybou](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@guybou](https://discourse.threejs.org/u/guybou)\
**Post date:** [November 5, 2018, 3:10pm UTC](https://discourse.threejs.org/t/decal-geometry-with-child-geometries/4798/9 "2018-11-05T15:10:12Z")

</div>

Thanks, I’ll try
