What are the differences between Manim and VPython (Web VPython) for 2D or 3D animations? - vpython

What are the main differences between Manim and VPython (Web VPython) for 2D or 3D animations from a user perspective? In other words, what can be accomplished in one but not the other?
Which is most popular for math or physics?

I'm the lead developer of VPython but have never used Manim. Assuming that you do know something about Manim, I suggest that you look at the sample Web VPython programs available at webvpython.org. (Note that you can also use the vpython module with installed Python.) Another possibility is to post to the VPython (https://groups.google.com/g/vpython-users) or Web VPython (https://groups.google.com/g/glowscript-users) forums. One difference is that it looks to me from a quick view of the Manim site that one uses it with installed Python to produce math animations that likely get posted to YouTube, whereas the Web VPython version lets you write programs that others can view without installing any software, and they can zoom, rotate, and pan the 3D animation. Another possible difference is that Manim represents itself as enabling math animations, whereas the DNA of VPython is to do vector computations in domains such as physics that produce as a side effect navigable real-time 3D animations.

Related

Alternative for vpython for 3D simulations (molecular dynamics)?

In working on a simple program to simulate and visualize crystal vibrations and molecular dynamics.
I'm not a very experienced programmer so I looked for an easy-to-use tool to work with, and I found that vpython (now GlowScript apparently) is simple enough and gives good results. But it lacks some basic functions like panning the scene, which breaks the deal for me.
What other tools are there out there, with reasonable learning curves (not raw opengl), can I use to create 3D simulations? (preferably within the python environment)
Here - An example in vpython similar to what I want to achieve
Have look at
http://vispy.org
Python based module.
Also python module specifically for molecular visualization.
https://pymol.org/2/

3ds Max and Python

I know that it is possible to create 3D objects and enviroments in python via using Pygame. But I wonder, if it is somehow possible to use the objects that you've created in 3ds Max within a python program. Because it seems that it takes a lot of time to code every detail in pygame to create 3D stuff.I think it would be easier if I could just use my mouse to draw objects just like in 3ds Max then to code every detail.Sorry if there are any gramattical mistakes.
3D is a world in itself - Pygame leverages 3D by providing some bindings to OpenGL - which are themselves quite low level.
So, if you happen to findout a format that can be expoted by 3DS and canbe supported directly in a call to OpenGL, the answer to your question would be "yes".
But I doubt so - even if there are object formats directly usable by OpenGL, you'd still have a tough time configuring the remainder of the scene.
The advice for you is to use a highr level binding to OpenGL, or 3D, and then check what formats are common between your binding (like Python-Ogre) and the formats 3DS can export too.
My personal recommendation would be for you to use Blender 3D for your Python environment. Not only it embeds a full game engine 100% programable in Python, as it leverages tens of different file formats to import - and certainly will be hundreds of times (no exaggeration here - I mean more than one hundred times as easy as) to code something like a finished game scene than using the raw OpenGL provided by Pygame. Also, as you get used to Blender, you might start making part of your modeling in it as well, avoiding having to switch environments between Max and Blender.

Programming a 3d game without the use of a graphics API

As the title says, I'd like to program a 3d game (probably a BattleZone clone), but without the use of an API like OpenGL, DirectX, and the like. At the heart of the matter, I'd just like to learn how to draw basic 3d shapes to the screen and manipulate them. Don't care if it looks like crap. I've used OpenGL to achieve similar ends before, but really didn't learn about these topics.
The problem is, I have no idea where to start. I downloaded the Doom source code, but it's a bit over my head. Although I've programmed a bit, graphical matters are very much out of my depth.
I'd be very grateful if anyone could offer links or code (in any language) that would help me along in my purpose.
Sounds like an exciting project. I did something similar in the late 90's. Before OpenGL and DirectX became popular, there were a ton of great books on the subject.
Fundamentally you will have to learn how to
Represent 3D geometry
Transform that geometry (translate and rotate)
Project that geometry onto a 2D screen.
Each of those major topics has many sub-topics (for example, complex objects can be constructed from a number of polygons. You may want to limit polygons to being constructed of triangles only, or support other polygons. You may want to load common model formats e.g. .obj files so that you can create models with off the shelf tools).
The topics are way too broad for a detailed answer here. Whole books are written on the subject, including
Black Art of 3D Game Programming (Book, amazingly still available)
For a good introduction to the general topics, have a look at:
http://en.wikipedia.org/wiki/3D_projection
http://en.wikipedia.org/wiki/Orthographic_projection
http://en.wikipedia.org/wiki/Transformation_matrix#Perspective_projection
Doom, which you already looked at, used a special optimization called heightfield rendering and does not allow for rendering of arbitrary 3D shapes (e.g., you will not find a bridge in Doom that you can walk under).
I have the second edition of Computer Graphics: Principles and Practice in C and it uses SRGP (Simple Raster Graphics Programming) and SIGGRAPH which is a wrap-around SRGP, if you look up articles and papers on graphics research you'll see that both these libraries are used a lot, and they are way more direct and low level than the APIs you mentioned. I'm having a hard time locating them, so if you do, please give a link. Note that the third edition is in WPF, so I cannot guarantee much as to it's usefulness, and I don't know if the second edition is still in print, but I have found numerous references to the book, and it's got it's own page in Wikipedia.
Another solution would be the Win32 API which again does not provide much in terms of rendering, but it is trivial to draw dots and lines onto a window. I have written a few tutorials on it, but I didn't cover drawing pixels and lines, so they'll only be useful if you have trouble with the basics of setting up a window. Note that it is not intended for real-time rendering, so it may get slow.
Finally you can look at X11 programming, the foundation of most modern operating systems with a GUI. I haven't found the libraries for Windows, but again I didn't invest too much time on it. I know it is available for CIGWIN and for Linux in general though, and I believe it would be very interesting to look at the core of graphics since you're already looking under the hood of 3D graphics.

Migrating code from rendering SVG to Canvas/WebGL - what are my options?

I'm looking at some older code which is rendering some images, animations, etc... for a website by generating a web page containing significant SVG elements. The result is a fairly complicated, interactive, interface. I've been tasked with migrating the application to instead generate WebGL calls.
This is a non-trivial task, considering all of the niceties that come with SVG, which are not directly available if going straight to a WebGL implementation. I've been debating whether I should pitch migrating to using something like Three.js instead, but don't know enough about the available options to make a good decision.
What are some reasonable options I should consider when trying to build my battle plan here?
I would suggest you look at http://code.google.com/p/canvg/ as an option.
I assume it is using getContext("2d") not getContext("experimental-webgl") or getContext("webgl").
WebGL provides a 3d interface and I am not sure if there is any advantage to using it for 2d graphics, since you don't have any 3d transforms for the GPU to work on. If they are interested in Canvas not specifically webgl ... Canvg would bring over some of the niceties of SVG which would be the source content.
If the issue is lack of support for SVG in browsers http://code.google.com/p/svgweb/ goes a long way to solving that problem.

Fast, Pixel Precision 2D Drawing API for Graphics App?

I woud like to create a cross-platform drawing program. The one requirement for writing my app is that I have pixel level precision over the canvas. For instance, I want to write my own line drawing algorithm rather than rely on someone elses. I do not want any form of anti-aliasing (again, pixel level control is required.) I would like the users interactions on the screen to be quick and responsive (pending my ability to write fast algorithms.)
Ideally, I would like to write this in Python, or perhaps Java as a second choice. The ability to easily make the final app cross-platform is a must. I will submit to different API's on different OS'es if necessary as long as I can write an abstraction layer around them. Any ideas?
addendum: I need the ability to draw on-screen. Drawing out to a file I've got figured out.
I just this week put together some slides and demo code for doing 2d graphics using OpenGL from python using the library pyglet. Here's a representative post: Pyglet week 2, better vertex throughput (or 3D stuff using the same basic ideas)
It is very fast (relatively speaking, for python) I have managed to get around 1,000 independently positioned and oriented objects moving around the screen, each with about 50 vertices.
It is very portable, all the code I have written in this environment works on windows and Linux and mac (and even obscure environments like Pypy) without me ever having to think about it.
Some of these posts are very old, with broken links between them. You should be able to find all the relevant posts using the 'graphics' tag.
The Pyglet library for Python might suit your needs. It lets you use OpenGL, a cross-platform graphics API. You can disable anti-aliasing and capture regions of the screen to a buffer or a file. In addition, you can use its event handling, resource loading, and image manipulation systems. You can probably also tie it into PIL (Python Image Library), and definitely Cairo, a popular cross-platform vector graphics library.
I mention Pyglet instead of pure PyOpenGL because Pyglet handles a lot of ugly OpenGL stuff transparently with no effort on your part.
A friend and I are currently working on a drawing program using Pyglet. There are a few quirks - for example, OpenGL is always double buffered on OS X, so we have to draw everything twice, once for the current frame and again for the other frame, since they are flipped whenever the display refreshes. You can look at our current progress in this subversion repository. (Splatterboard.py in trunk is the file you'll want to run.) If you're not up on using svn, I would be happy to email you a .zip of the latest source. Feel free to steal code if you look into it.
If language choice is open, a Flash file created with Haxe might have a place. Haxe is free, and a full, dynamic programming language. Then there's the related Neko, a virtual machine (like Java's, Ruby's, Parrot...) to run on Mac, Windows and Linux. Being in some ways a new improved form of Flash, naturally it can draw stuff. http://haxe.org/
QT's Canvas an QPainter are very good for this job if you'd like to use C++. and it is cross platform.
There is a python binding for QT but I've never used it.
As for Java, using SWT, pixel level manipulation of a canvas is somewhat difficult and slow so I would not recommend it. On the other hand Swing's Canvas is pretty good and responsive. I've never used the AWT option but you probably don't want to go there.
I would recommend wxPython
It's beautifully cross platform and you can get per pixel control and if you change your mind about that you can use it with libraries such as pyglet or agg.
You can find some useful examples for just what you are trying to do in the docs and demos download.

Resources