"Attribute wrangle" for Geometry Nodes
I love Geometry Nodes but I keep wanting to have something like an attribute wrangle node (VEX) like they have in Houdini. It sounds like a complicated feature to add but I think it doesn't have to be:
The node is just a text block that you can add code to. Whenever the code changes it is wrapped in an exported function that is called with an object representing the geometry and compiled with GCC to a DLL (Windows) or SO (Linux) and loaded into the process. Whenever this node is resolved it calls the exported function using an new thread and exception handler so faulty code doesn't crash all of Blender (and give a nice alert in the node UI itself). The object passed to the external function represents the geometry and would need a method that can read and set attributes (like Named Attribute and Store Named Attribute). Any problems during compilation should also be shown in the node UI.
The user could use this to do any computation on the geometry using their own algorithms. This would make complex simulations far more managable or even possible (things like collision detection for example). It would also open up the design and implementation of new nodes to the users of Blender. The best of these could be imported to become native nodes (much like how Geometry Nodes originated from the Animation Nodes plugin).
The biggest drawback to implementing this would be having to either supply a GCC distribution with Blender (much like it's Python environment) or requiring the user to have one installed and available to Blender. Since this seems like a power-user feature maybe the latter would be most suitable.
It was explicitly noted that adding support for new scripting languages etc is not desirable but technically this would not be a new language. It's just C++ which Blender is already written in.
1 Comment
I like this idea. In shader editor you can already use script node for Cycles to write OSL shaders. Having this in GN would be great. Script node for GLSL shaders in EEVEE too.