Do Wavefront .obj files support animation? - animated

How does one export a 3D Studio animated model to OBJ format (if possible)? What will be the resulting file like? How would I read that?

No, .obj files do not support animation.
You can check the .obj specification for details of what it does support.
You could potentially export one .obj per frame, but that would be cumbersome. Depending on the tools, it may be possible to export one .obj per keyframe.

Blender 2.63 can export animations in .obj, with each keyframe (as hypothesized above)
being a complete .obj of it's own. Blender can handle this export func relatively quickly and efficiently. So 1, Blender is an excellent working proof of concept, and two, Blender may actually help you out code wise (it's open source and you can redistribute any edited code source), allowing you to completely bypass writing your own efficient, quick support for this operation.

Although the .obj specification doesnt support animations natively, by simply augmenting it with a seperate .anm file you can get brilliant albeit boneless animations.
Have a look at:-
http://public.sanguinelabs.co.uk/expose/product.php?id=wastudio
This provides a very easy to use "animation maker" as well as the open-source model library (for OpenGL).
Note: I am the developer of Wavefront Animation Studio but also use it heavily in my own projects. Feel free to email me if you have any improvements or bugs to report :)

In fact you can animate wavefront format objects, you have to use groups within your model and transform them seperately in your code.

.obj files do not support storing animations by default.
However, you can export an animated mesh as a sequence of .obj files using Blender 3D. (The .obj exporter contains a relevant option...)
If you want to view an animation sequence as .obj files, you can use the following program that is written OpenGL and python:
https://github.com/csmailis/ObjSequenceViewer
If you use it, make sure you specify the directory containing all the .obj files stored with sequential filenames.

Related

How to convert mbtiles to .osm.pbf

I'm writing a Qt application that is supposed to show a geo-map of a specific geographical region in one of its views on top of which I need to be able to draw various other graphical elements.
The requirements are that all the map-tiles must be pre-downloaded for off-line use as during the use of the application there will be no internet connection.
After lengthy search for a suitable library that I could link into my Qt project that would support my needs (off-line tile loading, rendering and painting the map in Qt framework, non-QML only C++ integration) I thought libOsmScout would do the job.
However, I have managed to download .mbtiles files for my region from OpenMapTiles just to realise that libOsmScout cannot natively work with .mbtiles.
The library can only work (indirectly after "import") with .osm.pbf files.
(http://libosmscout.sourceforge.net/tutorials/importing/)
I've searched extensively the web but all the results were pointing to conversion procedures in the opposite direction, i.e. into the .mbtiles.
So my question is: is it possible to convert .mbtiles files to .osm.pbf format so I can then import it into libOsmScout compatible internal set of files?
If it is possible, what the process?
Any help or guidance would be much appreciated.
Thanks.
Easiest way is to use ogr2ogr to convert to pbf format.
ogr2ogr -f MVT output_dir_name input.mbtiles -dsco MAXZOOM=2
This will create a directory structure with each zoom level having a directory and pbf file named according to the tile position.
Or
using this tool called MBUtil.
There are some steps which you can follow from the github repo.
After that, you can then use the following command to convert to directory structure with each tile in pbf format.
mb-util input.mbtiles output_dir_name image_format=pbf
where tiles is the directory name you want

Display a .dot file inside a Qt application

I am new to Qt and C++... Now, I am writing an application in Qt, in which I have to display an already generated .dot file inside my application. I tried the render function but did not work for me.. Can anyone out there help me in this regard..
Thanks
Had the same problem using Python. I came up with this solution:
svg_string = dot_graph.create_svg(prog='dot')
svgWidget = QtSvg.QSvgWidget()
svgWidget.load(QtCore.QByteArray(svg_string))
Guess you can do something similar in C++
Plotting directly a dot file requires to be able to display the nodes in the correct positions, and link them properly. This is done by very complicated engines and is not included in the dot file, which is simply a description of the graph. Maybe there are C++/Qt libraries that take dot files as an input, but I don't know them.
According to this topic (Graphviz: How to go from .dot to a graph?), you can easily transform a dot file into a png or svg file. If you want to display the rendered graph into your application, the easiest thing to do is to generate that png picture (from the shell or from your code) and to manipulate it from your program.
Take a look to QGraph. You will need much more work to make your graphs interactive.
Anyway, if you are new to Qt, even the simple display it's a steep introduction to graphics.
I have my own implementation, but I'm sorry it's not yet ready for publishing - I will do in a SWI-Prolog context...

Displaying vector files in QT using GDAL/OGR

I am writing an application to load vector maps/shape files using gdal/ogr and display them onto a gui designed using Qt. I am new to dealing with vector files, I am not able to decide how to render them on GUI. Few approaches that come to my mind are:
- To convert vector files to raster and display them as raster..
- To draw each shape in vector file one by one (i dont know how to do this, I dont even know whether it would be even possible this using GDAL/OGR, or how complex this would be because in my case vector files can be very complex)
The decision how to render vector files is very important for me, because after displaying vector files i need to support some advanced features like projection change, interactive selection, Geo-referencing etc.
Can any one who has worked on vector/gis stuff, tell me how this is usually done and what Qt widget is used for displaying such data.
Displaying vectors is a tricky task since it requires rendering of geometries.
I would consider Quantum GIS (QGIS). It's actually also based on QT but comes with a sophisticated rendering engine. A custom QGIS application can even be run standalone.
I solved the problem of drawing vector files by writing rendering functions for each type of shape files. Qt's QPainter was really handy for drawing shapes like Polygon, Multipolygon, Line, Multiline and then displaying the output as QImage.

saving a movieClip to disk as swf in air, then reading it again

i have seen almost all relevant threads on almost whole internet. and i m still confused..
i m working on a drawing app ( flex / air ),
1- where user loads image file,(bitmapdata > bitmap > movieclip base layer)
2- add layer ( new sprite > movieclip "second object in display list")
3- draw on this sprite ( graphics.draw circle / etc, lot of other details etc)
4- usr can add more layers etc, name layers etc ... all sprites are of same size as bitmap
Q1. now i wanted to save this main movieClip (part of UIComponent ) as swf file. so user can read again and continue work. almost like i do with photoshop.
comment: i know it sounds too generic, to ask such detailed thing. so please be patient..
i have been fiddling around with byteArray. and Air File Object, flash.net.fileReference etc...
Q2. (main question), i don't want to convert drawn sprites to bitmapdata and then do bytearray. ( in my mind) it will convert everything to pixels, which i don't want.
Q3. is there some auto magical line which will do everything..(save drawn vectors / shapes) in sprites as is?? (less chances). if i can read swf as movieClip, i can check sprites for layers and everything else... problem is writing this to disk as swf file.
please share your thoughts and feel free to guide,in all possible directions..
thanks in advance for your valuable time..
In an ideal world you would just write
YourByteArray.writeObject(YourCanvasSprite);
That doesn't work however since serialize only works with data that is readable and writeable (and public). So you need to make it possible to recreate the graphic. You might be able to simplify that by using IGraphics (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/IGraphicsData.html) as these should be possible to serialize. So if you subclass Sprite and store "drawing commands" and the parameters, and let the object have a restore function, it should be possible to save it to a byteArray. It's far from a one-liner though, but probably a little bit easier than making and reading SVG.
i'm thinking the cleanest solution to this problem would be to use SVG (maybe EPS). i'm unfamiliar with any library that will convert drawn vector objects into SVG, but since SVG is simply an XML file you could study the SVG architecture and create your own: W3C - Scalable Vector Graphics (SVG) 1.1 (Second Edition). the following open source project may help you write one and can also be used to read SVG into Flash: New Flex and Flash SVGWeb Components
a less clean, and perhaps more complicated way to solve this problem could be to write your own SWFs, as you mentioned. in order to do so you would have to generate .swf file at runtime, which you could accomplish by using NativeProcess to pass arguments (namely an ActionScript file containing your drawing information, child layers with names, etc.) to MXMLC from the Flex SDK.
i find both answers useful. and with time,i have realized that in both cases it might be more work than i can handle. meanwhile, i was testing other pixels bases approaches as well. so i finally took decision of going through pixel way. user can save layers as png files with transparency.
if some person (other readers) come to this post, i wanted to conclude quickly, i have found really valuable drawing library named "graffiti" for as3. it almost does 80% of things, which i was hoping to do. so i am using that and tweaking it for my needs. huge thanks and respect to all great ppl who replied from their valuable time..

Flex unzip/uncompress huge files

I am having an AIR applicaiton which is supposed to uncompress the file of huge size (>1GB)
I tried commonly discussed utilities i.e. FZip nochump and few more
I face the same problem with all of them,
They tyr to unzip the entire file in the memory (using ByteArray.defalte method)
This works well with the files of small size howevre they just hang the applicaiton if the size of the file is big (>1GB)
Any suggestions?
Is there not a way you could use file spanning similar to the RAR formats. I think 7-Zip's 7Z supports it also. Depending on how to the decompression library is implemented, file spanning could reduce the memory usage theoretically.
Try looking into using the LZMA SDK a la 7-Zip:
http://www.7-zip.org/sdk.html
Maybe there's Flex bindings.
I agree with sammy, Air it's not the best solution for a task like that, IMHO it's better to include in your distribution a native utility to expand your files (remember that you need an utility for each platform that you want to support) then use the new Air2 API to invoke them. Doing this way the expansion of the archive is done in a separate process without freezing your app.
Maybe you can boundle just one utility if you are sure that every platform has a common runtime (ex. java).

Resources