I’ll look into those modules you suggested. However, I haven’t yet had time to examine the blender source very carefully yet, so the final decision has yet to be firmly made. does python provide shared memory for two separate processes?) If I can directly link into blender via python that would be very convenient (i.e. This would involve a lot of string to/from float conversions, which would cripple any possible speed gained from compiled calculations. What the python intermediary would be spending a lot of time and structure doing would just be sending mesh data back and forth between the executable and blender. no porting into blender needed when done.softbody calculations may provide most of the routines needed (so I don’t have to build a new wheel).data structure is already provided (so I can think less about it and more about what I’m doing).The main reasons for going straight to blender source are: Hence in Python you can consider more what it is that you are doing, and less how you organize the encumbant data. The only real difficulty using C introduces is data structure, which environments like Python simplify for you. That’s what I actually was initially considering. There are other 3rd party tools like SciPy and so on, but I don’t think you’d be needing those for your project (I confess to knowing nothing about how clothing simulation is done, but I think it must be pretty math intensive and presumeably highly parallel). (all of the above are free-licensed, GPL or Python License, IIRC). If you are okay with writing C code, you may find this superior to C-library-automatic-wrapper solutions like SWIG, but of course, those exist too. Pyrex – Python/C bridge language which is essentially a compiled subset of Python (all it omits is some very advanced dynamic techniques which you probably shouldn’t use anyway - like defining classes and functions within functions), and of course speaks C as well. Maybe python’s interpreter speed won’t be an issue. Psyco – Optimizing Just-In-Time compiler for Python. Numarry – rewrite of Numeric which is gaining popularity for a better (clearer) internal design, but is poorer than Numeric for SMALL arrays (it gains on larger arrays faster than Numeric does, IIRC). Numeric – Old standby for doing array mathematics and image processing. What I most want to call your attention to, however, is that there are already very good optimized math modules for Python (which are written in native C, so they run very fast, I mean): I use Python almost to the exclusion of C now, and I’m a lot more productive. I used to program almost exclusively in C, and I didn’t get that much done. Premature optimization is usually a bad idea. However, there are good reasons to steer clear of diving into writing C source for such a thing (mainly that you will waste a lot of time - C is probably too low level for what you really want to do). I would highly recommend this approach (I’m a python programmer, although I’m brand new to Blender). Another approach could be to write it in C and use python to bridge the gap between the ‘library’ and blender, to keep it ‘independant’ from blender(i.e easier to maintain imho).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |