paulmelis / blender-julia-test Goto Github PK
View Code? Open in Web Editor NEWExperiment of using Julia to do mesh processing in Blender
Experiment of using Julia to do mesh processing in Blender
Comparing the returned values of the subdivide()
in catmull-clark.jl
call under Blender and from regular Python I noticed the following. This is based on the code in test/subdiv.py
, which is also stored in test.blend
under (text)
in the Blender Text Editor.
Python 3.8.5 (command-line)
melis@juggle 20:46:~/concepts/blender-julia-test/test$ python subdiv.py
/usr/lib/python3.8/site-packages/numpy/__init__.py
1.19.1
/home/melis/.local/lib/python3.8/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 1.533ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 21.688ms
<class 'numpy.ndarray'>
[-0.5555556 -0.5555556 -0.5555556 -0.50617284 -0.50617284 0.6049383
-0.50617284 0.6049383 -0.50617284 -0.4458162 0.5665295 0.5665295
0.6049383 -0.50617284 -0.50617284 0.5665295 -0.4458162 0.5665295
0.5665295 0.5665295 -0.4458162 0.5208048 0.52080476 0.52080476
-1. 0. 0. 0. 1. 0.
1. 0. 0. 0. -1. 0.
0. 0. -1. 0. 0. 1.
-0.75 -0.75 0. -0.75 0. 0.75
-0.75 0.75 0. -0.75 0. -0.75
0. 0.75 0.75 0.75 0.75 0.
0. 0.75 -0.75 0.75 0. 0.75
0.75 -0.75 0. 0.75 0. -0.75
0. -0.75 0.75 0. -0.75 -0.75 ]
<class 'numpy.ndarray'>
[ 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 85 89 93]
<class 'numpy.ndarray'>
[4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4]
<class 'numpy.ndarray'>
[15 2 16 9 16 4 17 9 17 3 18 9 18 1 15 9 17 4 19 10 19 8 20 10
20 7 21 10 21 3 17 10 20 8 22 11 22 6 23 11 23 5 24 11 24 7 20 11
23 6 25 12 25 2 15 12 15 1 26 12 26 5 23 12 21 7 24 13 24 5 26 13
26 1 18 13 18 3 21 13 19 4 16 14 16 2 25 14 25 6 22 14 22 8 19 14]
Blender 2.90 (Run script from UI)
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/numpy/__init__.py
1.17.5
/home/melis/software/blender-2.90.0-linux64/2.90/python/lib/python3.7/site-packages/julia/__init__.py
0.5.4
Initializing Julia (this might take a moment the first time)...
Done!
(Julia) Building half edges done in 0.018ms
(Julia) Input: 8 vertices, 6 polygons, 12 polygon edges
(Julia) Output: 26 vertices, 24 quads
(Julia) Subdivision done in 0.127ms
<class 'list'>
[-0.5555555820465088, -0.5555555820465088, -0.5555555820465088, -0.5061728358268738, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, 0.6049383282661438, -0.5061728358268738, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.6049383282661438, -0.5061728358268738, -0.5061728358268738, 0.5665295124053955, -0.44581618905067444, 0.5665295124053955, 0.5665295124053955, 0.5665295124053955, -0.44581618905067444, 0.5208048224449158, 0.520804762840271, 0.520804762840271, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, -0.75, -0.75, 0.0, -0.75, 0.0, 0.75, -0.75, 0.75, 0.0, -0.75, 0.0, -0.75, 0.0, 0.75, 0.75, 0.75, 0.75, 0.0, 0.0, 0.75, -0.75, 0.75, 0.0, 0.75, 0.75, -0.75, 0.0, 0.75, 0.0, -0.75, 0.0, -0.75, 0.75, 0.0, -0.75, -0.75]
<class 'list'>
[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93]
<class 'list'>
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
<class 'list'>
[15, 2, 16, 9, 16, 4, 17, 9, 17, 3, 18, 9, 18, 1, 15, 9, 17, 4, 19, 10, 19, 8, 20, 10, 20, 7, 21, 10, 21, 3, 17, 10, 20, 8, 22, 11, 22, 6, 23, 11, 23, 5, 24, 11, 24, 7, 20, 11, 23, 6, 25, 12, 25, 2, 15, 12, 15, 1, 26, 12, 26, 5, 23, 12, 21, 7, 24, 13, 24, 5, 26, 13, 26, 1, 18, 13, 18, 3, 21, 13, 19, 4, 16, 14, 16, 2, 25, 14, 25, 6, 22, 14, 22, 8, 19, 14]
Summary
Python 3.8.5 (command-line):
subdivide()
returns a tuple of 4 numpy.ndarray
values, as expectedBlender 2.90 (UI):
subdivide()
returns a tuple of 4 listsSo the differences are probably caused by a different version for Python and/or NumPy.
Rebuilding PyCall
from within Blender ((rebuild pycall)
text tab) makes no difference.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.