Three.js: Feature: Unique colors for InstancedMesh

Created on 28 Jan 2020  路  8Comments  路  Source: mrdoob/three.js

Curious if unique colors for InstancedMesh is on the three.js team's radar? I've looked through the source and it's not a quick patch. I believe shaders amongst other parts would have to be updated. I'd be more than happy to take on the work. Any tips would be appreciated.

Most helpful comment

@WestLangley @donmccurdy sorry to bother you guys again but this is what you helped me out with Matrix Body Simulation. Again, thank you so much. 馃檹

All 8 comments

Closing the issue because it's possible to render what I need using InstancedBufferGeometry with custom shaders. My main concern was using the DOF post processing shader which I believe would also have to be updated to work with unique colors. So I think it would be faster to use RawShaderMaterial and then write a custom DOF post processing shader as well (plenty of examples out on the interwebz). Sorry to bother you guys.

@donmccurdy You can change the example if you want. I thought it would be nice to show how to hack the shader, though. Adding instanced color seemed to be a good option at the time. :-)

Definitely agreed it's helpful to show how to hack the shader cleanly! At some point I think it might be nice to hack the UVs instead of the color (or both?) to use different textures from an atlas texture to each instance. Since that can't be done otherwise. But I don't have a good example yet, and I don't think it's urgent.

@WestLangley @donmccurdy thank you so much for the examples!! I had tried InstancedBufferAttribute with InstancedMesh and had some issues but definitely it was on my end. It seems I did not have this this line: blossomMaterial.vertexColors = THREE.VertexColors; but will need to implement it first.
Thank you again, you have saved me so much time and trouble. Not sure where I can help three.js development, but if there are issues that you'd like to see worked on please let me know.

@donmccurdy I realize now that I overlooked that section of the webgl_instancing_scatter example. Thank you thank you

@WestLangley @donmccurdy sorry to bother you guys again but this is what you helped me out with Matrix Body Simulation. Again, thank you so much. 馃檹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

donmccurdy picture donmccurdy  路  3Comments

jack-jun picture jack-jun  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments

Horray picture Horray  路  3Comments

clawconduce picture clawconduce  路  3Comments