GSoC 2024: Geometry Nodes: File Import Nodes

Hi everyone,

My name is Devashish Lal (also go by CodeBlaze) and I’ll be working on File Import Nodes for Geometry Nodes this summer. I am currently pursuing my masters and my research is focused on 3D Computer Vision, Neural Field Rendering and Gaussian Splatting. I have been using blender on and off since Blender 2.6 and for me it’s a relaxing hobby. Love hard surface and environmental design. When geometry nodes came out it enabled me as a programmer to create fun things and I see it’s potential use in my field of research also but that requires importing point cloud data. When I saw this project on the proposal page I knew I had to try and submit a proposal.

I started with exploring the code base around existing bf_io_* importer projects and documented what changes would be required to integrate them with Geometry Nodes

Next I tried doing a proof of concept with a simple STL file import node, changes can be found here. with this I had enough information to formulate my proposal, at least for simple 3D data formats like OBJ and STL.

For CSV import, since there is no existing importer project a new bf_io_csv project would need to be created and after a discussion with @jacqueslucke , I formalised how CSV data would be handled in Geometry Node. you can read upon that in my finale proposal here

I aim to implement file import nodes for 3D data formats (OBJ, STL, etc), CSV and Point Clouds (PLY) over the coming summer and maybe after I am done with GSoC I’ll try to create a file import node along with a geometry node system for gaussian splatting and use it in my research work.

Looking forward to sharing these features with everyone.


Week 1

For this week:

  • I have raised a pull request for the STL import node (for now it uses string path as input, will be changed to file selector)
  • Went over the error reporting for geometry nodes and handled multiple error cases w.r.t to the STL importer
  • Refactored the STL importer ensuring zero code duplicacy
  • Python side changes for add menu layout (discussed where the STL import node should go)

At the beginning of the week Hans and I discussed that delivering the STL node first would be the most straight forward thing as it’s the simplest format. I still have some reviews to go through for the pull request and then most probably will start with the file selector dialog followed by refactoring of the OBJ importer.


Week 2

I merged the STL import node to main and it is available behind the experimental feature flag “New File Import Nodes”. I am excited to get this in early and collect feedback.

This week I will be working on some usability improvements i.e, adding a proper file selector

While adding the experimental feature flag I also learnt about the DNA and RNA system.


Week 3

This week was pretty hectic, tried my best to wrap my head around RNA still feel like a ways to go. anyway I raised a PR which adds a file selector to the Import STL node.

As a side effect PROP_FILEPATH can be added as a socket subtype to any string socket which means any string socket can be changed to file selector easily with a single line of code, this could be helpful at other places.

Getting file selector out of the way early makes it easy to integrate it into the upcoming import nodes.

As always these changes will be available behind the experimental feature flag “New File Import Nodes”, looking for feedback.


Week 4

This week was a bit slow for me but I have started looking into caching, also doing the OBJ refactoring on the side. Getting back to caching, this is going be built completely from ground up. While my dream is to create a completely generic cache for geometry nodes, after discussing with @HooglyBoogly we agreed to keep the scope simple and just focus on caching for file imports for now.

I started looking at some existing caching mechanisms like the Shader cache and will try to come up with a more detailed proposal for caching next week


Week 5

Have been all over the place this week trying to come up with a caching mechanism. In the meantime I decided to knock out the OBJ import node which seemed simple. here is the work in progress PR.

An OBJ file can contain multiple meshes and curves which makes it a bit challenging to output the data from the node, but geometry instances and geometry sets can be used for this.

As for caching I’ll do the simplest thing I can and then go from there based on reviews.


Week 6

This week, Curves threw me a curve ball :joy: (I had no idea that OBJ files can contain Curves) handling imports for multiple meshes and curves while refactoring the importer took a while but it’s working now. Changes can be seen here, as always once merged the node will be available behind the new importer node’s experimental toggle.

This week I’ll start with the most basic implementation to caching, which is more essential now as I can see blender freeze up while importing OBJ files


Week 7

Work on caching finally began you can check it out here. I will be developing this incrementally as there are still some un-answered questions but for the coming week I will be focusing on a manual cache clear button and start with a LRU Cache implementation.

Un-answered Questions

  • Cache invalidation - should we hook into dependency graph ? or use a LRU based caching.
  • Cache keys - for now file path is the cachekey but what if the file is modified ?
  • Cache cleanup on exit - for now I have added the cleanup call in window manager exit, but is there a better place to do it ?

You can add you feed back on the blender chat thread.


Week 8

Added an operation to the geometry nodes editor to manually clear the cache and experimented with a LRU cache using Boost’s implementation this week.

Since boost is an optional dependency we can’t use so will be implemented LRU cache using blender’s containers next.