Sunday, March 29, 2015

SVG to PNG via Command-Line (Inkscape)



SVGs are awesome, but not everything supports them. Unity especially. For SVGs stored on your Linux server, this is a quick Command-Line solution.

____________________________________________________________

Get To Your Files

Whether you're running this one file at a time or in batches with a script, you'll want to start in the folder your svgs are in.
If you don't want to...
I think you can indicate the path within filename, but I'm not sure.

____________________________________________________________

Install Inkscape

Inkscape has to be installed on your server for this to work. This should be totally easy, but if you might want to check the docs.
Essentially, you enter this as root.
apt-get update
apt-get install inkscape
____________________________________________________________

Run the Command

This will call inkscape to read the svg file and export it as a png. If you want to branch out, here's a good reference
Run this code on all the svgs This will make a png copy in the same directory. :D
inkscape filename.svg --export-png=filename.png

If you want to define what the 'empty' background color is, try it this way
inkscape filename.svg  --export-background=ffffffff --export-png=filename.png

____________________________________________________________

Enjoy your PNGs :D

____________________________________________________________


All blog posts by UnityGirl are inspired by my work with Brunelleschi: Age of Architects on the Aesop Games team. Download the current Unity client On IndieDB

Tuesday, March 3, 2015

Unity Tips: Combined Mesh into Highlight (part 2)

This is Part 2 of making a single-mesh highlight for a several-mesh object. In the Previous Post we discussed how to combine the meshes into a single mesh. Now all we have to do is use that new mesh as a highlight.

____________________________________________________________


____________________________________________________________

Shaders
Because Shaders are connected to Materials that effect 1 mesh at a time, we had to combine all those meshes into one outline-able mesh. Now we just need the outline.

Though shaders are a fairly deep hole to jump into, the Unity Community is there for us with a few commonly desired shaders. I found several useful resources Here. Select Silhouette-Outlined Diffuse and copy the variant that's right for you. There's Standard, Bumped, and Outline Only. I like Outline Only but you may have other needs.


____________________________________________________________

New Shader
Copy the Shader script. In Unity, make yourself a new Shader, open, and paste shader script.


____________________________________________________________


Now The Outline
This part's super simple


  • Make yourself a new Material.
  • Assign the new Outline Shader
  • Adjust color to preference. I like bright greens and blues.


____________________________________________________________

The Outline-Object
Finally, we combine these two techniques into a complex outline.


  • Take your original multi-mesh object, with it's "empty" parent-object
  • From there make an empty game-object child with scaled about 1 to 1.
  • Assign the Mesh you made earlier
  • Assign your new Outline Material
  • Adjust to preference


____________________________________________________________

Tadaa!
With these steps we've completed the Multi-Mesh Object Outline path. I hope you enjoy your outlines derived from this method. 


____________________________________________________________


All blog posts by UnityGirl are inspired by my work with Brunelleschi: Age of Architects on the Aesop Games team. Download the current Unity client On IndieDB