keskiviikko 17. helmikuuta 2016

Magiclantern Installation

I have Canon 550D camera and sometimes when I shoot videos I have noticed that the audio is just too noisy. This is because the camera uses AGC, Audio Gain Control which automatically adjusts the microphone. If you are shooting in quiet place the camera will turn up digital gain of the microphone which will add horrible hiss to the noise. So the only solutions are either install a double wired cable and play some audio constantly to the camera via mobile phone or ipod but I wanted to install MagicLantern which is a firmware hack for Canon cameras. It will also add a huge amount of features to the camera. The actual files will be stored to the memory card and the software will be run from the memory card, so if you remove your SD card the magiclantern is gone. The only downside is that you if you ever format your SD card the magiclantern is gone, but on the other hand it is very easy and quick to install.

Step 1.

Open up your Canon camera and set it to manual (M). Go to the settings and format your SD card.

Step 2.

Go to http://www.magiclantern.fm/ and select nightly build because they don't have stable releases anymore. I have had no issues with the nightly so far.

Step 3.

Select your camera model from the dropdown. The number after your camera version is the firmware version you have to install before running magiclantern.

Step 4. 

Make sure your camera firmware is the same as in magiclantern tells. If not head to Canon website and install latest firmware to your camera according to the magiclantern selection.

Step 5. 

Unzip magiclantern and upload all files from the zip to the root of your SD card.

Step 6.

Open your camera and go to the firmware version settings page. Press OK to update. Pray. When you see green text saying restart your camera, turn it off and wait 10 seconds. Then turn it on.

Congrats

Now you should have working magiclantern on your Canon DSLR. However remember that the magiclantern runs from the memory card so if you turn off the camera wait 5 seconds before removing the SD card or as long as it keeps blinking red light. Otherwise you may break your camera.



To access magiclantern settings press trashcan button.

maanantai 15. helmikuuta 2016

Blender Baked Objects

I had to create baked 3D objects, which means that shadows are baked in the image. So if this kind of model would be used in for example Unity where it is possible to cast light, the object would have its own baked shadow no matter how lamps are moved. I am using Blender so shortly about the file formats:

OBJ

The OBJ file format is a model format for static meshes. It supports multiple meshes with different textures and materials. Meshes can also have different materials assigned to their polygons.
Thereby the OBJ format provides more flexibility with respect to textures than the MD2 format which can only use one texture. However the OBJ format does not support animations. Thus, it is recommended to use the OBJ format for high quality static objects and rely on the MD2 or the FBX format for animated models.
obj file needs .mtl which contains the material info and .obj which is the actual 3D object.

MD2
The MD2 file format is an ancient but efficient 3D file format which nicely supports vertex animations. MD2 models cannot have different colours but only one texture. Therefore, textures have to be baked in case for instance "vertex colours" shall be shown. Also the filename of the texture must be the same as the model's.(e.g. modelFile.md2 + modelFile.png)
Note for animations: please use 25 fps when exporting animations.
MD2 converter is deleted from metaio git repository since apple bought it. The converter can be found from Blender forums if looked carefully.

From Image to SVG and exporting to Blender

Any image can be opened with Inkscape and then converted to SVG which can be imported to blender. 
  1. Select image by clicking it
  2. Click Path --> Trace bitmap
  3. Select "Remove background"
  4. Click OK and close window. Before closing window, you can tick "Live Preview" to see if your image works. 

Then fire blender and click File -> Import -> Scalable Vector
Then you can select your imported SVG and extrude it from the path settings.
Here is a tutorial for this task: https://www.youtube.com/watch?v=ows2QTiMRPg

Baking textures to object
To bake textures to object, first define the color of your object and create basic lights for the environment. If you don't want only direct light, you can tick "Ambient Occlusion" from the world tab. If this is unset, some parts of your object will be completely black if there is no light cast to them.
Then it may be a good idea to convert your curve to mesh file, so press ALT + C and convert to mesh from curve. This may do some weird transformations, so it is possible your UV mapping fails because of this and you may need to create the 3D object manually. Then the SVG export is not a solution (sad)
Open UV image editor, select your object in edit mode and press U and select "smart UV project"

Then from the UV editor, click new either "blank" or "UV grid" and ok. Your UV map turns black or UV grid.

Then head to camera render section and from the "Bake" hit bake. Blender will then bake the lightning into the material.

Then we need to apply the baked material to the object. Save the baked image from UV editor save button. 
From the texture settings, check that your object has the saved image set as texture and UV map is set to UV



Blender .obj export settings
  • To export objects properly from Blender the object should: back face follow green (Y) arrow, UP follow (Z) blue arrow, and right side red (X) arrow.
  • Object origin should be in the center of the object and origin should be in the middle of the editor.
  • When exporting to .obj file format Forward and UP values can be default. Scale should be at least 10. Everything else as default is fine.



Finally check that the exported object has mtl file and it points to correct material file if material is used. To test your objects, techie persons can try this canvas loader: https://github.com/xxv/jsc3d/tree/master/jsc3d