2
$\begingroup$

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?

$\endgroup$
6
  • $\begingroup$ After some searching I found this: wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.62/… $\endgroup$
    – J Sargent
    Jul 8, 2015 at 0:22
  • $\begingroup$ 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) $\endgroup$
    – uhoh
    Jul 8, 2015 at 1:45
  • $\begingroup$ Not that I know of (at least for modifiers specifically), although it seems there should be. $\endgroup$
    – J Sargent
    Jul 8, 2015 at 1:51
  • $\begingroup$ 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? $\endgroup$
    – uhoh
    Jul 8, 2015 at 1:55
  • 2
    $\begingroup$ 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. $\endgroup$
    – brasshat
    Jul 8, 2015 at 4:53

2 Answers 2

6
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ 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)! $\endgroup$
    – uhoh
    Jul 8, 2015 at 7:50
  • $\begingroup$ See this question for an answer discussing making a Python substitute for a modifier coded in C. $\endgroup$
    – brasshat
    Jul 8, 2015 at 8:46
  • 1
    $\begingroup$ @uhoh I think you might be interested in Sverchok -- but you don't know it yet. $\endgroup$
    – zeffii
    Jul 8, 2015 at 16:38
  • $\begingroup$ 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! $\endgroup$
    – uhoh
    Jul 10, 2015 at 0:37
0
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .