How can I solve this task using Blender and Python: needs automaticly create video of titles having text,video and timing (list of time cutoffs) at input. I mean we do script which gives Blender input data (text,timing,etc) and Blender render a video with a template which he has.
The question is can I do it with Blender API and if yes, how?
This is a pretty vague question. Do you have an example of what you're trying to do?
Conceptually, the simple answer is yes. Consider the following problem:
I need to create a small video that circles around a single object
To accomplish this, you would create a script that would:
Create an cube at 0,0,0
Add a camera to the scene and zoom to the selected object (the cube)
Change the location / rotation of the camera
Create a keyframe on location / rotation of the object on a frame in the future
Repeat 3 & 4 until camera goes full circle (this can be done through looping)
Set render parameters on the camera
Render the scene
All of the above can be done via python scripting. You can learn how to invoke all the methods above by reading the api documentation Here. There is also a lot of resources available at the Blender Stack Exchange.
I hope this helps. This is the best I can do with the limited information provided.
Related
Good evening,
I have a series of vtk files.
I wrote a script that performs a specific rotation of those files and then using
animationScene1.GoToNext()
goes to the next scene, a new rotation is performed e.t.c.
How can i also add the newly created scene to an video format output?
In short, i want every time the script jumps to a new scene and rotation to save the old one and in the end have a video with the correct rotation per scene
Thank you very much for your time
Since you are moving the camera to specific position using a python script, the easiest way will be to save the images yourself in your script using
SaveScreenshot("path/to/your/imageN.png")
And then reconstruct a video from all the images.
I am not really sure where to start on a project. I designed a channel for the Roku using Brightscript over the past several months. I now need to design a similar project for a different device but using Python. I don't know a lot about Python, but from what I have read it looks fairly easy to learn. My question is in Brightscript I had to draw a canvas passing certain parameters like size, location and color. This essentially was the video player. In Python to create a video player, do you have to draw a canvas or the like? Brightscript comes with components like roVideoPlayer where the code passes needed information into this object. Are there modules for Python that can be imported that create the components?
Thanks for advice
I want to develop a 3D file viewer in kivy and python that reads and displays .asc mesh files of the format:
x1,y1,z1
x2,y2,z2
........
xi,yi,zi
What I have thought so far is to use a method similar to beginShape() of Processing so as to begin drawing a 3D shape then use a for-loop to append each point respectively.
I have also found that kivy example which parses .obj files and then displays them. Do you have any ideas on how can I make a similar ascparser and try to display my files?
Any help is greatly appreciated
I have also found that kivy example which parses .obj files and then displays them. Do you have any ideas on how can I make a similar ascparser and try to display my files?
Your best strategy at the moment is probably to read the objparser and try to understand what it is doing. The important thing is building a list of points and normals, which are passed to opengl via a Mesh with a custom vertex_format and custom shaders. In principle it wouldn't be very hard to do the same thing for your own filetype just by comparison with the .obj code, though you will need some understanding of what's going on (you can read about opengl and read the kivy source, if you haven't already) to make significant changes.
This is really an advanced topic right now, Kivy has very few pre-built wrappers to 3d opengl rendering. The backend is fully capable (so the 3d rendering example isn't that complex, for instance), but you probably do need some understanding of what's going on to accomplish things like your own task.
There are also a few other examples of 3d rendering in Kivy, which you might find helpful. nskrypnik has several repositories doing just this (see kivy-trackball, kivy-3dpicking, kivy-rotation3d), and seems to have begun implementing a proper 3d api in the kivy3 repo, though this is not complete and I suggest it as something you can learn about by reading, not something that can necessarily do what you want right now. The other nice example I've seen is a 3d inspector POC by tito, though it's just a proof of concept and not a polished product.
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...
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)