I use WebGL.
Is there a way to modify a .obj file (or another 3D file) for example on photoshop? When I do some change on such a file, I would like it to keep the changes I made when I load it on a website.
I know it is not possible with .obj, so is there another format to do this?
I think you can load some 3d files into photoshop these days, but I'm pretty sure you will not be able to modify them.
To modify .obj files you can use 3d software such as 3DS Max or Maya, or you could use an online tools such as the three.js editor or claria.io
There are probably various ways to achieve what you want.
If I understood you correctly, you actually have multiple questions, here are some answers:
Which 3D editing software could I use?
If you want to perform some modification with a powerful 3D modeling tool, I would recommend to download and try blender. It is completely free, but in fact a very advanced 3D modeling software.
In case you just want to smooth your mesh, simplify it, or apply some other generic operation like this, then MeshLab might be sufficient (also available for free).
Which 3D model format should I use for delivering my 3D asset on the Web?
If you use X3DOM for displaying your 3D file, you can use the standardized X3D format (like OBJ, X3D content can be imported / exported in both, blender and meshlab). This has the advantage that you can use X3DOM's inline tag and directly import an X3D file, which means you can edit the 3D content without needing to re-convert your data for the Web.
However, using OBJ, X3D or whatever text-based delivery format might not be the wisest choice if your 3D asset is large, since this will introduce long download times. Therefore, if you have complex assets / scenes, you should also consider to convert your 3D assets to a compact, optimized delivery format for the Web, such as glTF or SRC.
Related
I used a threejs to write a game and used a lot of gltf files. I don't want to expose these gltf files directly.
For the record, this cannot be done. Obfuscation can get you really far and deter a casual hacker, but all graphics data can be intercepted and extracted since it has to be made available and formatted properly for drawing.
I can make gltf files with the collada to gltf converter.
But is there a way to reverse this?
UPDATE - October 2019 - Blender 2.80 has shipped with full glTF 2.0 import/export capability. It also has COLLADA import/export capability, so can be used to convert one to the other.
UPDATE - November 2018 rewrote answer for glTF version 2.0, which has almost completely replaced 1.0 in the time since this question was originally asked.
glTF 2.0 can be processed by a variety of tools, many of which are listed on the glTF Tools section of the official Khronos glTF README.
Older glTF 1.0
While there are numerous command-line utilities for converting to glTF, the options are much more limited going the other way, from glTF to COLLADA or anything else. One thing to understand about this is that glTF is intended to be a runtime delivery format, not an interchange format like COLLADA. glTF strives to store its internal data in as close to GPU-ready form as possible, with mesh data organized into data structures that can be used as vertex attributes, and so on. Khronos has a tagline that glTF is "the JPG of 3D" meaning that it has wide distribution to rendering engines of all kinds.
So, importing a glTF into a 3D editing package is something like loading a JPG into a paint program. You can do it, but after the import you want to avoid any unnecessary round-trips to and from the delivery format. So you would use the paint program's native save format (.psd or .xcf etc), or the 3D modeler's native save format, to keep your own editable copy of your work, and ship the exported JPG or PNG or glTF for wide distribution.
Even so, I do expect more importers to become available as time goes on. glTF version 1.0 had an internal structure that made this quite difficult (its vertex shaders would use swaths of attribute data without explicitly marking them as positions or normals, etc.) glTF 2.0 replaced those custom shaders with modern pbr pipeline assets, with clearly marked mesh position, normal, and other data, opening the door for future import tools and utilities of all kinds.
I'm trying to convert this model to the three.js model format:
http://tf3dm.com/3d-model/ninja-48864.html
Here's what i've tried so far:
I've imported the ms3d file in blender using the default addon. In blender, animations and mesh look correct; however, bones are only rendered as lines. Then I exported it to js using the three.js exporter. This results in a correct mesh, but the animation is not correctly exported. Only bone positions are exported (which are only rarely used in this specific model), NO rotations at all (except for a few identity quaternions).
It seems I have to modify the model in blender somehow, but since I'm a complete novice in 3d modelling, I'm kind of lost. I've also looked at other questions regarding blender+three.js but none of the tips (apply location/rotation/scale etc.) made a difference. It might also be a bug in the three.js exporter.
Can anybody help me do the conversion, one way or the other?
A nice Python utility is available for converting ms3d format to JSON format.
The link is: https://github.com/pyalot/parse-3d-files/blob/master/ms3d/convert.py
You can easily render this JSON model using THREE.JSONLoader() in three.js
Thanks.
I want to dynamically generate videos.
My program needs to query a database to get certain information (height, width, color, speed, ...).
Based on this information it will generate a video of several simple 2D objects moving in certain ways.
This needs to be saved in some sort of videoformat, preferably usable in HTML5.
There will need to be several 1000s of videos like this created on a daily basis.
What is the best technology to develop this in ?
I am looking for ease of use but also the speed of generation.
I am familiar with java, flex, perl but I am definately willing to adept to another language if necessary.
If you're open to using Mac, Apple's Quartz Composer (included free with the Developer Tools) might be useful for this purpose.
With Quartz Composer, you can easily create graphic animations, and make them parametric (so you can set input values for the animation).
Kineme's QuartzCrystal provides a way (both via GUI and command line) to render these animations to QuickTime movies and image sequences.
I am trying to do animations on iPhone using OpenGL ES. I am able to do the animation in Blender 3D software. I can export as a .obj file from Blender to OpenGL and it works on iPhone.
But I am not able to export my animation work from Blender 3D to OpenGL. Can anyone please help me to solve this?
If you have a look at this article by Jeff LaMarche, you'll find a blender script that will output a 3D model to a C header file. There's also a followup article that improves upon the aforementioned script.
After you've run the script, it's as simple as including the header in your source, and passing the array of vertices through your drawing function. Ideally you'd want a method of loading arbitrary model files at runtime, but for prototyping this method is the simplest to implement.
Seeing as you already have a method of importing models (obj) then the above may not apply. However, the advantage of using a blender script is that you can then modify the script to suit your own needs, perhaps also exporting bone information or model keyframes.
Well first off, I wouldn't recommend .obj for this purpose since the obj file format doesn't support animation, only static 3D models. So you'll need to export the animation data as a separate file that you load at the same time as the obj.
Which file format I would recommend depends on what exactly your animations are. I don't remember off the top of my head what file formats Blender supports, but as I recall it does not export Collada files with animation, which would be the most general recommendation. Other options would be md2 for character animations, or 3ds for simple "rigid objects moving around" animations. I think Blender's FBX exporter will work, although that file format may be too complicated for your needs.
That said, and assuming you only need simple rigid object movements, you could use .obj for the 3D model shapes and then write a simple Python script to export a file from Blender that has at the keyframes listed, with the frame, position, and rotation for each keyframe. Then load that data in your code and play back those keyframes on the 3D model.
This is an old question and since then some new iOS frameworks have been released such as GLKit. I recommend relying on them as much as possible when you can, since they take care of many inherent conversions like this, though I haven't researched the specifics. Also, while not on iOS, the new Scene Graph technology for OS X (which will likely arrive on iOS) in the future, take all this quite a bit further and a crafty individual could do some conversions with that tool and then take the output to iOS.
Also have a look at SIO2.
I haven't used recent versions of Blender, but my understanding is that it supports exporting mesh animation as a sequence of .obj files. If you can already display a single .obj in your app, then displaying several of them one after another will achieve what you want.
Now, note that this is not the most efficient form to export this type of animation, since each .obj file will have a lot of duplicated info. If your mesh stays fixed over time (i.e. only the vertices move with the polygon structure, uv coords, etc. all fixed) then you can just import the entire first .obj and from the rest just read the vertex array.
If you wanted to optimize this even more, you could compress the vertex arrays so that you only store the differences from the previous frame of the animation.
Edit: I see that Blender 2.59 has export to COLLADA. According to the Blender manual, you can export object transformations, and you can also export baked animation for rigged objects. The benefit for you in supporting the COLLADA format in your iPhone app is that you are free to switch between animation tools, since most of them export this format.