GafferHQ / gaffer

Gaffer is a node-based application for lookdev, lighting and automation
http://www.gafferhq.org
BSD 3-Clause "New" or "Revised" License
962 stars 207 forks source link

MeshMerge node #956

Open johnhaddon opened 10 years ago

johnhaddon commented 10 years ago

We would like the ability to instance meshes on to a point cloud as the Instancer does, but merging all the meshes into a single object ideal for raytracing (think leaves on a tree or banknotes on the wind). One approach would be to have an instancer style node (or an extension to the existing node) which simply outputs a single mesh. Another would be to use the instancer as-is, and have a subsequent MeshMerge node which collapses a hierarchy of meshes into a single object.

carstenkolve commented 10 years ago

I principle I do like the idea of the merging node (because of its flexibility - one might not want to do any raytracing etc); however with gaffer expanding all bounding boxes, this approach would still lead to a very slow graph in the ui?

johnhaddon commented 10 years ago

I like the idea of the merging node too. I would expect it to be a bit slower but I think it'd be worth prototyping it to see rather than first writing the more specialised solution first.

carstenkolve commented 10 years ago

agreed, especially if the instancer does get an option to create an approximate bbox based on the incoming point data as per #957 the speed issue might not be so bad

johnhaddon commented 10 years ago

Cool - that sounds like a plan then. Adding an approximate bound is easy - much easier than doing the accurate bound, so we can get that in quickly whenever it gets prioritised.

johnhaddon commented 9 years ago

I've updated the title on this one to be a MeshMerge node, as discussed previously. I'd propose that it works as follows :

In terms of implementation, I think we can derive from BranchCreator to do the work of making the merged mesh, and use a Prune node to do the pruning work. Those would be child implementation nodes of the main MeshMerge node.

There's code for merging two meshes in Cortex, which I think would provide a useful reference. But since we want to merge an arbitrary number of meshes, I think it's important that we do that in one step for speed. We might still want to put the "merge multiple meshes" code in Cortex somewhere anyway, perhaps in a new MeshAlgo.h file, since we've been discussing making Cortex functionality available directly in functions as well as via the higher level Ops.

How does that sound?