GafferCycles icon indicating copy to clipboard operation
GafferCycles copied to clipboard

Per-instance attributes support

Open kubo-von opened this issue 5 years ago • 3 comments

Hi @boberfly not sure if Cycles can do this atm, but here's and example scene. Screenshot from 2020-01-28 14-59-50 (arnold render) Cube is being instances onto points which float attribute, that attribute is then passed as per-instance attribute by the instancer. arnold and cycles scenes + source usd with the points is here: https://drive.google.com/drive/folders/1_7KhFIbD1h2ZWoOSPuKeCQgC-xPUuYYX?usp=sharing Hope that helps

Cheers!

kubo-von avatar Jan 28 '20 14:01 kubo-von

Hi @kubo-von

This is partially supported, however it is a limitation of Cycles only having a few available constant values to use. I briefly mentioned them in the second post of this ticket: https://github.com/boberfly/GafferCycles/issues/6

The other one for colour tint is "Cs", so if you promote these primvars from a pointcloud to the instancer as an attribute with those exact names, they should come up but using I think the object_info shader node for color, and particle_info for the other ones.

I believe the Cycles devs have talked and prototyped a patch but I think it's not exact to what I would imagine to be a more robust solution, they work with the constraints of Blender most likely which only has a handful of needs for constant values per-instance without reverting to copies. You're free to commandeer the ones supplied by particle_info and work a solution from it. There's also the potential to figure out what dupli-verts is (I believe it's a vec2 offset into a UV atlas, which could potentially give you more constant values via that maybe with a ramp). Hope this helps for now.

boberfly avatar Jan 28 '20 18:01 boberfly

Hey @boberfly ! Using particle_info values works and it should give enough values to work with. Thanks for the tips ! Maybe if "Everything nodes" project continues well they will have to remove this limitation from cycles eventually.

kubo-von avatar Jan 28 '20 18:01 kubo-von

You might get a crash if you go crazy with edits in IPR mode and setting those attributes in particle_info, I think Cycles isn't too thread-friendly when modifying these (I could be wrong and it's perfectly fine now as I am making sure to set the mutex lock in the right spot).

boberfly avatar Jan 28 '20 20:01 boberfly