Customizable Navigation Bar

Saturday, December 28, 2013

Back To Basics: Welcome To Unity

Hey everyone, a little late, but better late than never. I'm starting with the video tutorials again, and I am starting with the very basics of Unity.

In this video I go over what each of the default windows does and how to use them.


Friday, December 13, 2013

Recommended Tools: Sfxr and Bfxr Sound Generators

While developing I like to create small temporary sound effects and implement them in code, this way all I need to do is replace the asset with the real sound effect, and I don't have to change my code at a later date. This saves me time, and also allows me to see where sound effects are needed very early on so I can add them to the asset list. Coming up with these sound effects can be somewhat of a pain if you don't know where to start. Do you find free sound effects on the internet? Do you find a sound effect generator? Do you make fart noises with your mouth?

I ended up going with the sound effect generator method (though making fart noises was a close second), and came across two programs that were closely related to each other. Sfxr, and Bfxr. Both of these programs are really good for creating short random tempory audio files, or creating 8 bit and 16 bit audio files for your games requiring that retro feel.

I came across Sfxr a few years ago while I was in school. It is actually what I used for the sound effects in my old tutorials on how to create a game in Unity. Sfxr is a free tool created by someone who goes by DrPetter, and it was created back in 2007 for the Ludum Dare challenge so people could create basic sound effects for the games they needed to complete in 48 hours. Sfxr has it's source code available for anyone to fiddle with, and you can use any sound effects you make completely free.

The interface is very basic looking, but if you are creating basic sound effects you don't need anything flashy. Here is an example of what the program looks like:


If you are looking for something extremely basic, Sfxr is the way to go. You can grab it here: http://www.drpetter.se/project_sfxr.html

Bfxr is something I just came across recently while doing my usual random internet searches. It is an extremely heavily modified version of Sfxr. It added a number of new options and values to tweak, which for some may be too much to handle at first glance. In addition Bfxr saves old mixes and sounds in a list for you to reference at any point which is a huge improvement over Sfxr, which requires you to save it to the disc if you ever want to load up the sound again. Bfxr is great if you want to have more variety and more control than what Sfxr gives you, and you aren't afraid of an interface with a large number of sliders and buttons. Here is what the interface looks like.


Bfxr is also free to use and it's source code is also hosted on GitHub so anyone can make a pull request and fiddle around with it. You can grab it here: http://www.bfxr.net/

So whether you are looking for placeholders or are looking for some retro sounding effects, either of these tools will be very useful to you. Both offer a ton of options and are free to use. Anyways, I'm off for now, and if you know anyone that is looking for sound generators, you know where to point them.

Friday, December 6, 2013

Masking In Unity

While working on a GUI system for Unity, one of the issues I came across was how to mask objects on the screen. Unity didn't have a default way of handling this, so after looking around I came across something called a "Depth Mask" shader.

Basically this depth mask works by just hiding everything behind it, so while it works great, there are still a few small issues with it. By hiding everything behind it, you need to fiddle around with render queues or different camera set ups if you only want it to use it on certain objects.

The shader for the depth mask is really really simple:

Shader "Depth Mask" {
    SubShader {
//This Queue call tells the graphics card that this should be drawn before any of the geometry. This is what give the shader its ability. It gets drawn before anything else and any thing drawn behind it gets clipped
        Tags {"Queue" = "Geometry-10" }    
        Lighting Off
        ZTest LEqual
        ZWrite On
        ColorMask 0
        Pass {}
    }
}

The easiest way to stop objects from being masked by the shader is to manipulate the render queue of the material. If you set the render queue to a lower value than the depth mask, it will show up as if the mask wasn't there at all. This allows you to have full control over which objects are masked and which aren't.

Here is an example of the depth mask at work. You can see the two construction workers getting clipped away by this depth mask shader. The construction worker in the back has a special shader that has a lower render queue than the depth mask, so it is completely unaffected by it.



























Hopefully you guys found this tutorial useful. If you want to fiddle around with the project viewed above you can find it here: https://db.tt/OcviQM5n