Background
I have been asked by a client to create a picture of the world which has animated arrows/rays that come from one part of the world to another.
The rays will be randomized, will represent a transaction, will fade out after they happen and will increase in frequency as time goes on. The rays will start in one country's boundary and end in another's. As each animated transaction happens a continuously updating sum of the amounts of all the transactions will be shown at the bottom of the image. The amounts of the individual transactions will be randomized. There will also be a year showing on the image that will increment every n seconds.
The randomization, summation and incrementing are not a problem for me, but I am at a loss as to how to approach the animation of the arrows/rays.
My question is what is the best way to do this? What frameworks/libraries are best suited for this job?
I am most fluent in python so python suggestions are most easy for me, but I am open to any elegant way to do this.
The client will present this as a slide in a presentation in a windows machine.
The client will present this as a slide in a presentation in a windows machine
I think this is the key to your answer. Before going to a 3d implementation and writing all the code in the world to create this feature, you need to look at the presentation software. Chances are, your options will boil down to two things:
Animated Gif
Custom Presentation Scripts
Obviously, an animated gif is not ideal due to the fact that it repeats when it is done rendering, and to make it last a long time would make a large gif.
Custom Presentation Scripts would probably be the other way to allow him to bring it up in a presentation without running any side-programs, or doing anything strange. I'm not sure which presentation application is the target, but this could be valuable information.
He sounds like he's more non-technical and requesting something he doesn't realize will be difficult. I think you should come up with some options, explain the difficulty in implementing them, and suggest another solution that falls into the 'bang for your buck' range.
If you are adventurous use OpenGL :)
You can draw bezier curves in 3d space on top of a textured plane (earth map), you can specify a thickness for them and you can draw a point (small cone) at the end. It's easy and it looks nice, problem is learning the basics of OpenGL if you haven't used it before but that would be fun and probably useful if your in to programing graphics.
You can use OpenGL from python either with pyopengl or pyglet.
If you make the animation this way you can capture it to an avi file (using camtasia or something similar) that can be put onto a presentation slide.
It depends largely on the effort you want to expend on this, but the basic outline of an easy way. Would be to load an image of an arrow, and use a drawing library to color and rotate it in the direction you want to point(or draw it using shapes/curves).
Finally to actually animate it interpolate between the coordinates based on time.
If its just for a presentation though, I would use Macromedia Flash, or a similar animation program.(would do the same as above but you don't need to program anything)
Related
Im not sure if this is the correct place to ask this but as its more programming related than electronics I am posting here.
I have recently purchased a small LCD to experiment with. Its just one colour. Im using python to control it over serial.
My question is when it comes to the actual drawing. This whole area is completely new to me so I don't know if I am thinking the right way / going down the right path.
I want to be able to draw things on the LCD such as progress bars, animations (such as volume meters etc) and other simple - non text - based things. Just anything really.
In my mind the way I imagine doing this is by using python to draw a complete image of what I want on the LCD. Using PIL / Pillow for example and constantly redrawing and resending to the LCD.
So in the case of the progress bar, everything that's static is the same but then the progress bar rectangle for example would have its width altered each redraw.
I dont know if this it the correct way or if there are better ways or even if there are specific tools / modules for this kind of thing.
I want to use Blender and Python to create simplified 2D animations of theories on how the computation of the human brain create consciousness. I have spent hours studying the Python-Blender API, and as of yet it is not clear how to do what I want to do. Before I spend the much larger amount of time necessary to learn both Blender and its Python API, I would like to know if, and how, it is possible to use Blender-Python to:
Create thousands of lines under program control, in the form of long thin parallelograms, and place the two parallel narrow edges of each such line on selected locations on a selected pair of parallel lines in the image,
change the color and z-level of nets of connectioned lines formed
out of such lines under python control, and
create, place, and change the coloring and z-level of some more
complicated lines, such as ones having one or more bends in them.
I want to do these things to represent various synchronized activations of neural sub-networks. I will be able to spend about a month or so learning and using the Blender and its Python API before the conference at which I want to display these animations, but before I start, I want to know if that is something that is realistically doable for a newbie in that time frame.
Thank you for any help you can give me. And if anybody would like to help me create such animations, I would happy to share the credit when they are placed on YouTube. You can contact me at ewporter#gmail.com
I want to write a tool in Python that will help me create isometric tiles from 3D-models. You see, I'm not a very proficient artist and free 3D-models are plentisome, and creating something like a table or chair is much easer in 3D than in painting.
This script will load a 3D model in orthographic projection and take pictures from four directions so it can be used in a game. I've tried this in Blender, but the results are inconsistent, very difficult to control and take very long time to create simple sprites.
Rolling my own script will probably let me do neat things too, especially batch-genetration, maybe on texture changes, shading, etc. The game itself will probably be made in Python tpp, so maybe I could generate on the fly. (Edit: and automatically creat cut out see-through walls for when they face camera)
Now my question, what Python libraries can do something like this? I've checked both Pyglet and Panda3D, but I haven't even been able to load a model, let alone set it to orthographic projection.
I found this code:
www.pygame.org/wiki/OBJFileLoader
It let me load and display an .obj file of a cube from Blender with ease. It runs PyOpenGL so it should let me do everything OpenGL can. Never knew OpenGL was so low-level, didn't realize I'd have to write my own loaders and everything.
Anyway, I'm pretty sure I can modify this to project isometrically, rotate the object and grab shots and combine them into sprites. Thanks you guys!
Since you looked at Panda3D - if you can convert your model to the 'egg' format (which blender/maya may do), then you could be able to import it.
https://www.panda3d.org/manual/index.php/Loading_Models
https://www.panda3d.org/manual/index.php/Models_and_Actors
http://www.panda3d.org/manual/index.php/Converting_from_Blender
Note: sources of this was 'python 3d mesh loader' in a popular search engine - this looks viable to me. I now need to try installing it and some code...
I'm giving a presentation on Fractal Antennas (take a look at my previous threads) in November and I wanted to incorporate some animation to make my presentation easier to visualize the content I am referring to. Most of these animations would be relatively short, probably a minute long at the most. There are a few animations that would be fantastic to have:
Fractal Mountains - The animation continues to add new iterations that depict the complex features of a mountain range.
Fractal Koch Curve - The animation begins with an initiator (triangle) and adds new iterations. Either I slowly bring in the new fractal that has the next iteration, or I use the same model and users can see the iterations branching outward. I would prefer the latter technique.
Show a fractal. Increase the iteration, while keeping a constant length, to vindicate the fractal shrinking in size.
Show a fractal. Increase the iteration, while keeping a constant size, to vindicate the fractal is increasing it's total perimeter length.
Cell phone animation - show a cell phone that has multiple antennas popping out (they can be simple sketches of lines).
The trouble is, I've never done ANY animation before. In the programs I have already, they generate the coordinates of the fractals, if that can be of some use?
What is the best way to render those animations in the shortest time possible? The presentation is almost 6 weeks away! Blender might be an option, but I have no idea of how to go about this.
There are some great animations in this NOVA video that might give you an idea of what I'm after.
Thanks,
Austin
Personally, I've used VPython to create simple 3D graphics and animations. It's an easy to learn library that's freely available at http://vpython.org/. Since you have the coordinates already, it should be fairly easy to for you to incorporate that into the drawing.
Blender is a bit more complicated, but also incorporates python scripting if you want to spend the time to learn it.
Lastly, referencing some of the YouTube comments: if you use the video just cite it, or email and get permission. If you're not making money on this presentation, then odds are you're going to just fine using the videos.
The easiest would be to use matplotlib.mplot3d. The principle is the same as in the 2D animation described at http://www.scipy.org/Cookbook/Matplotlib/Animations but you will be using the 3D methods described in http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html.
I teach computer methods in physics and one of the activities is to create a Koch snowflake using Python and matplotlib. I also had a group of students create 3D fractals as their project using Python and Chaco (for interactivity) but using matplotlib instead is pretty straightforward. You can also try mayavi2 which is another 3D plotting library in Python.
If you want to create a movie then you need to save each frame as a graphics file then convert the files into movie using convert (ImageMagick), mencoder, ffmpeg or some other software.
I can probably provide some pseudocode/sample code but I'm too sleepy at the moment (it's 11:30pm from where I am).
I want to automate playing a video game with Python. I want to write a script that can grab the screen image, diff it with the next frame and track an object to click on. What libraries would be useful for this other than PIL?
There are a few options here. The brute force diff'ing approach will lead to a lot of frustration unless what you're tracking is very consistent. For this you could use any number of genetic approaches to train your program what to follow. After enough generations it would do the right thing reliably. If the thing you want to track is visually obvious (like a red ball on a white screen) then you could detect it yourself through simple brute force scanning of the bitmap.
Another approach would be just looking at the memory of the running app, and figuring out what area is controlling the position of your object. For some more info and ideas on this, see how mumble got 3D positional audio working in various games.
http://mumble.sourceforge.net/HackPositionalAudio
Answer would depend on the platform and game too.
e.g. I did once similar things for helicopter flash game, as it was very simple 2d game with well defined colored maze
It was on widows with copy to clipboard and win32 key events using win32api bindings for python.