mmerchante / instanceAlongCurve

Maya API Node for interactive instancing of shapes along curves.
MIT License
123 stars 26 forks source link

Instancing without attribute callbacks #3

Open BigRoy opened 8 years ago

BigRoy commented 8 years ago

Goal

Implement a way to perform the instancing in a way that doesn't require attribute callbacks

Description

Currently the instancer relies heavily on Attribute callbacks to update the instancers. In ROADMAP.md it is mentioned that removing this behavior would be optimal and describes three possible solutions with their possible downsides.

To discuss the possible options I'm starting this issue to see if we can get to a good solution.

BigRoy commented 8 years ago

The Maya instancer can be connected without using particles by connecting the correct data to its instancer.inputPoints attribute. By outputting the correct type you get the full instancing support for position, rotations, scales, object indices.

Using this instancer works very well since it's often also renderable with third party renderers (like built-in geometry). Also from an instancer many scripts are already written or available to bake those to actual geometry if needed.

By simplifying the main along curve plug-in to output that data it doesn't rely at all on attribute callbacks. From there on out we can define an additional plug-in that only takes that data to do the attribute callbacks to preserve the backwards compatible behavior. Basically separating that behavior onto itself. Theoretically once could then also use that exact same "custom plug-in" to work with regular particles.

This might also make the main along curve implementation a lot simpler.

mmerchante commented 8 years ago

Hi BigRoy!

Yeah, I've been thinking about this a little bit more, and I think that reimplementing the plugin with the instancer should get nice results. I did some tests when writing the roadmap text, and got to something semi-usable (had some problems with object pivots); I'll see if I can begin working on it in a few days. But overall it should make the code more robust and compatible with renderers as you say.

It would also help optimize the compute logic, as a lot of computations can be reused because there would be one big loop only instead of three (pos, rot, scale).

I think that the tools to bake to geometry should be well thought out, however: not just returning a big chunk of geometry, but a well defined hierarchy of objects with their animation curves, etc. I feel that offering the flexibility to use the tool as an animator or a modeler adds value.