Understanding sculpting code

I have a real interest in working to add functionality, performance, and scale, to Blender’s sculpting functionality. However, I’m relatively new to the Blender codebase. What would help me would be if more experienced Blender devs could help out with the following:

  • What would be the minimal set of packages (directories?) that I should become intimately familiar with first in order to fully wrap my head around the existing sculpting functionality? I assume I would minimally need to look at source/blender/bmesh, source/blender/editors/sculpt_paint, and maybe extern/rangetree (based on https://wiki.blender.org/wiki/Source/File_Structure). But I’m sure someone can anticipate other things I would need. Since I am specifically thinking of some GPU tricks for some improvements I expect I’ll need to understand end-to-end flow. I’m willing to do my homework.
  • A bunch of the Blender code I’ve looked at before provided fairly minimal documentation within the source. Is there someplace to look at designs, technical decision making processes, algorithm explanations, etc… that somehow aligns with the source code? Any pointers to areas I can focus on towards the sculpting improvements goal?
  • In the years I’ve been doing graphics programming I’ve relied on papers, books, etc. since there’s always someone smarter than me solving problems before I get to them and add my own incremental improvements. Is there, in addition to the documentation mentioned above, any list of publications that Blender implementations draw heavily from? E.g. I see use of spherical harmonics for irradiance maps in the code but don’t see any references to papers by Ramamurthi, Green, etc…

Anyway, I’ve been using Blender for years and am eager to contribute back.


It’s difficult to point to modules to understand the whole thing, since sculpting also ties in areas like modifiers, undo systems, drawing code, dependency graph, etc. It’s not necessary to understand everything to start though, it’s usually easier to learn as you go.

For sculpt drawing, in Blender 2.8 much of the code is shared with general mesh drawing in draw/, and there is some sculpt specific code in gpu/intern/gpu_buffers.c.

There is some code documentation here, but it’s pretty sparse and often outdated:

There is no central place that links to papers, some code docs and source code does it, but others not. For sculpting I can’t really think of papers that it would be based on though, I think it’s almost all own algorithms.

1 Like