# Where can I find the code behind the Remesh Blocks modifier?

In this answer by @RayMairlot, I learned how to generate a mesh surface that looks like many small cubes stacked in the shape of a sphere (or other meshes). Remesh -> Blocks

Because I can't leave well-enough alone, I would like to see exactly how this algorithm works, and what an Octree is. Where can I find the C code (?) behind this modifier?

• After some searching I found this: wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.62/… – VRM Jul 8 '15 at 0:22
• Interesting link @NoviceInDisguise. Although the git repository mentioned there seems to be in limbo at this moment, another link there has lots of useful information and explanations and will make for good reading. Still, isn't there a central Blender source-code repository with everything in one place, or am I just naive? (I'm relatively new to Blender) – uhoh Jul 8 '15 at 1:45
• Not that I know of (at least for modifiers specifically), although it seems there should be. – VRM Jul 8 '15 at 1:51
• Wow! So there is code in blender for which we can not see the source? That is not open-source? That could possibly have unpleasant things in it hypothetically speaking? – uhoh Jul 8 '15 at 1:55
• It appears that the Remesh modifier might be part of the standard distribution source code. You might download that, and look to see if the modifier code has been included in the source distribution file. – brasshat Jul 8 '15 at 4:53

## 2 Answers

Blender Modifiers are not written in Python but are compiled into Blender and written mostly in C, therefore Remesh won't be found in the scripts folder. The code for Remesh can be found by searching for "MOD_remesh.c" once you've downloaded the source tree locally. Either download the entire GIT repo, or archived as a zip. Alternatively you can browse the source tree on-line figuring out the path should not be difficult, but here it is anyway: source/blender/modifiers/intern/MOD_remesh.c

Questions about the C / C++ sources of Blender are off topic for Blender.stackexchange but you can try the developers mailing list or irc freenode #blendercoders.

• Thanks @zeffii ! If I can see the algorithm and understand it, then I plan to implement something similar in a python script. While it happens to be in C at the moment, we can fix that (and keep the subject on-topic)! – uhoh Jul 8 '15 at 7:50
• See this question for an answer discussing making a Python substitute for a modifier coded in C. – brasshat Jul 8 '15 at 8:46
• @uhoh I think you might be interested in Sverchok -- but you don't know it yet. – zeffii Jul 8 '15 at 16:38
• What a difference one letter makes: "scripting nodes" becomes "script in nodes". Node eats script for lunch. Wow @zeffii , that is exactly what I didn't realize I was looking for! Thanks! – uhoh Jul 10 '15 at 0:37

It appears from the fact that a search of the "Addons" tab in user preferences using the search parameter "remesh" returns no results, that the Remesh modifier might be part of the standard distribution source code. Try downloading that file from the downloads page using the location in the Netherlands, since the link to the US server is, as I write this, not accessible. Then decompress the downloaded file, open it in a text editor, and do a search for the word "Remesh." That might not take you to the code you want on the first search, but try until you've reached the end of the file.