Instancing Suggestion

I successfully created a ground foliage system using instanced buffer geometry. Setting up the instancing wasn’t nearly as bad as I though it would be, however one aspect was just downright tedious.

What I’m referring to is recreating the Lambert shader manually and then adding in the custom orientation / position adjustments. This was necessary for the foliage material to respect scene lighting / shadows etc. Rebuilding the Lambert Material into a ShaderMaterial was not fun.

Would it not be easier to have a few for example: ShaderChunks[‘Instancing’]? If I’m not overlooking anything, it would just require a few chunks, an instancing_pars chunk which could contain the instancing attributes and applyQuaternionToVector function (from three.js instancing examples), and one right after the ‘begin_vertex’ chunk to alter the vec3 transformed variable using the function.

Would this not be much more user friendly?

I’d be more than happy to make a PR, if this is desirable.

3 Likes