<p dir="auto">Since my question is lost in stackoverflow, I decided to post it here as a bug, as I think it is.</p>
<p dir="auto"><a href="http://stackoverflow.com/questions/38342266/shadowmap-cant-detect-all-instances-on-three-instancedbuffergeometry" rel="nofollow">http://stackoverflow.com/questions/38342266/shadowmap-cant-detect-all-instances-on-three-instancedbuffergeometry</a></p>
<p dir="auto">Basically the idea is having one bufferGeometry duplicated and having an attribute array with the offsets of my objects (like they have in the above example).</p>
<p dir="auto">If I try to add shadows, I only get shadows on 1 object, which I assume is because we only have 1 geometry.</p>
<p dir="auto">Is there a way of adding shadows to all my objects?</p>
<h5 dir="auto">Description of the problem</h5>
<p dir="auto">It is possible for one object/group to have multiple materials, e.g. to have 12 faces of material A and next 12 faces of material B. Current implementation does not handle it properly.</p>
<p dir="auto">I changed OBJLoader.js, now it creates not one mesh per object, but one mesh per tuple (object name, group name, material name, material smoothness), named 'o:foo,g:bar,usemtl:baz,s:[01]'. This way there is still one material per mesh, but more than one mesh per object/group, albeit with somewhat convoluted names.</p>
<p dir="auto">I don't know how to make an attachment in this issue tracker (I'm new to github), so I share that externally and provide links:</p>
<p dir="auto"><a href="http://gnu.univ.gda.pl/~grzes/three.js/OBJLoader.js" rel="nofollow">http://gnu.univ.gda.pl/~grzes/three.js/OBJLoader.js</a><br>
<a href="http://gnu.univ.gda.pl/~grzes/three.js/OBJLoader.js.diff" rel="nofollow">http://gnu.univ.gda.pl/~grzes/three.js/OBJLoader.js.diff</a></p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> r75</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> ...</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Chrome</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Firefox</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Internet Explorer</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Windows</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Linux</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Android</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> IOS</li>
</ul>
<h5 dir="auto">Hardware Requirements (graphics card, VR Device, ...)</h5>