3D visualization - rotating cube - graphics

I have many 3D vectors. I want to plot them in a cube so that each dimension is on a particular side of the cube.
Now, I am looking for some visualization/tool or library that lets me rotate this cube in 3D and see the vectors in various different angles.
Thanks
Abhishek S

Try Processing, it is somewhat intended for data visualization and in addition to simple control over 3D drawing, it also has the full power of Java programming language. You can see numerous works, done by other people on OpenProcessing.
However, if you are into anything serious, I would suggest you to use some ohter IDE than the default one. I use Eclipse for that, importing Processing as a library into my project. It requires a tiny boilerplate to work, but then you're happy!

Related

How do CAD programs display parametric models?

Softwares like Catia, SolidWorks or the like all can visualize complex models while designing.
Exporting such models to raster triangle meshes yields huge files that later need to be greatly simplified to be imported into 3D engines like Unreal Engine or equivalent.
My question is: how do they visualize such complex geometries without rasterization? How do they do it that fast?
GPUs can only deal with triangles, therefore they tessellate geometry exactly as for STL export. Tessellation tolerance may vary from display to STL export affecting the time required to compute it.
Exporting such models to raster triangle meshes yields huge files
Not entirely correct. When you ask solidworks for the mesh you also provide quality that will influence number of triangles you receive - can be millions, can be just a dozen.
CAD packages operate with most bodies/shapes analytically - they have a formula. My guess is any other 3D engine does the same, the thing is format of the analytical data that different engines use is not the same. So you need to convert from one to another using triangles, format that everybody understands.

Emulating a perspective rectangle on 2D

So, I'm currently developing a puzzle game of sorts, and I came upon something I'm not sure how to approach.
As you can see from the screenshot below, the text on the sides next to the main square is distorted along the diagonal of the quadrilateral. This is because this is not a screenshot of a 3D environment, but rather a 2D environment where the squares have been stretched in such a way that it looks like it's 3D.
I have tried using 3D perspective and changing depths, and while it solves the issue of the distorted sides, I was wondering if it's possible to fix this issue without doing 3D perspectives. Mainly because the current mesh transformation scheme took a while to get to, and converting that to something that works on 3D space is extra effort that might be avoidable.
I have a feeling this is unavoidable, but I'm curious if anyone knows a solution. I'm currently using OpenGL ES 1.
Probably not the answer you wanted, but I'd go with the 3d transformation because it will save you not only this distortion, but will simplify many other things down the road and give you opportunities to do nice effects.
What you are lacking in this scene is "perspective-correct interpolation", which is slightly non-linear, and is done automatically when you provide coordinates with depth information.
It may be possible to emulate it another way (though your options are limited since you do not have shaders available) but they will all likely be less efficient than using the dedicated functionality of your GPU. I recommend that you switch to using 3D coordinates.
Actually, I just found the answer. Turns out there's a Q coordinate which you can use to play around with trapezoidal texture distortion:
texture mapping a trapezoid with a square texture in OpenGL
http://www.xyzw.us/~cass/qcoord/
http://hacksoflife.blogspot.com.au/2008/08/perspective-correct-texturing-in-opengl.html
Looks like it won't be as correct as doing it 3D, but I suppose it will be easier for my use right now.

What tools can I use to create 3D graphics and then export them as a 2D sprite sheet?

I've been working on 2D games for a long time now (because 2D is all I know how to do) and want to step it up a notch. I don't want to go fully 3D because I don't think I have the mathematical knowledge to work with 3D graphics, but instead want to start developing some graphics that lie somewhere inbetween.
By inbetween I mean graphics that will still render as 2D, but may have been created using 3D software and then exported at various angles. Some examples of the style could include:
Age of Empires 1.
Diablo 1 & 2.
Starcraft 1.
Is there any software used specifically for creating a 3D model and then generating a 2D sprite-sheet from it? Here is an example of such graphics that may help in making sense:
Blender is free 3D modeling tool, where you can make sprite sheet out of the model. I don't know how to do this but I know it's possible, because my friend is using it for our game (he is making 3D spaceship models and transforming them into 2D sprites)
http://www.blender.org/
I am not aware of such a specialized software, but have you considered simply using a 3d engine with a fixed camera looking at the scene from above and all objects at ground level?
That way you can use regular tools for modeling and still have the logic and (with a few settings to the physics engine) physics of a of a 2D game.
Unity engine might be able to help you.

Simulate 3D space in 2D

I'm starting to code my first game and I want to make simple 2D sprite game. However I want to simulate 3D space & physics and am searching for some tutorial/guide/algorithms that would teach me the basics... but so far without luck.
Do you have any recommendations? Books? I don't care about programming language, any language will do as I can read algorithms in most languages and for start I just want to understand exiting solutions for 3D -> 2D problem.
Thanks!
Edit: I am not so much looking into physics for now as for projecting 3D space onto 2D
This is the best article I've found on subject: http://www.create-games.com/article.asp?id=2138
Another great article: http://pixwiki.bafsoft.com/mags/5/articles/circle/sincos.htm
1980's games systems used parallax techniques to give a feeling of depth with 2D implementations.
If you're talking about the process of rendering a 3D scene as a 2D image (i.e. on a screen), then you'll want to look at perspective projections. It's quite heavy on maths, though, and involves a lot of work with transformation matrices and linear algebra.
You should make sure you're up to scratch on both linear algebra and calculus if you're planning on creating a 3D physics-based game.
If you're doing 2D, you might like to start with simple 2D physics. I'd especially recommend Box2D for that purpose! It's easy to learn and integrate, and it's tutorials will let you on the basics of physics in games.
You don't say what language you're using, but OpenGL and variants of it exist, I believe from internet search, for several common programming environments.
It provides some very powerful tools for creating 3D objects, setting viewports into the virtual 3D space, placing lights, defining textures. It might take a couple weeks of spare time to master, but it certainly spares you doing much of the perspective math you would need to roll your own 3D tools. There are good tutorials on the intenet.
Good luck

Easiest way to create and render 3D model by rotating a 2D silhouette

I have a black and white 2D drawing of a silhouette (say, a chess piece) that I would like to rotate around an axis to create a 3D object.
Then I want to render that 3D object from multiple angles using some sort of raytracing software, saving each angle into a separate file.
What would be the easiest way to automatically (repeatedly) 1. get a vector path from the 2d drawing 2. create the 3D model by rotating it 3. import it into the raytracer.
I haven't chosen a specific raytracer yet, but Sunflow has caught my eye.
Texturing/bump mapping would be nice but non-essential
The modeling feature you're looking for is a Lathe.
Sunflow can import 3ds files and blender files.
I've never used blender, but here's a tutorial for using the lathe to make a wine glass. You'd replace the silhouette of the wine glass with your shape:
http://www.blendermagz.com/2009/04/14/blender-3d-lathe-modeling-wine-glass/
Blender is FOSS, you can down load it here:
www.blender.org/download/get-blender/ (can't post more than one link, so you'll have to type this one in yourself :-)
I found a pretty cool site where you can do this online, interactively:
http://www.fi.uu.nl/toepassingen/00182/toepassing_wisweb.en.html
No great detail revolution but maybe you can find the code and extend it to your needs.

Resources