Moongate Games UK

"Changing worlds, one line of code at a time"

Tutorial: Grass using Particle Extender.

Subject: Particle Extender

Language: N/A (No scripting needed)

 What is Particle Extender? At the point of writing this, Particle Extender is a single script that you attach to a particle system. This script enables pretty basic things to be done, like spawning a line of particles or spawning some in a rectangular area.

 In this tutorial, we're going to cover how to make grass using this script. There is an example in the asset pack so feel free to have a look at that as well.

 First things first (assuming you've imported the asset package) you'll need to add a new particle system to your scene and make sure that it's set up like in the following image.

 Next, you need to add the ParticleExtender component to the Particle System by clicking the Add Component button and typing ParticleExtender into the search bar like so:

 Once you've added it you'll need to change the settings to the following.

 This will set you up with a basic spawning rectangle that spawns white particles. If we run that now we should get something like this:

 It's a start but it doesn't really look like grass...

 To make it look more like grass we're going to need to change the material in the Renderer to use the GrassMaterial in the Grass example.

 Now if you re-run the scene it looks a bit like grass, but it still needs work.

 So, if you click on the Particle Colours option in the Particle Extender script you'll be presented with the Unity gradient editor window. For this, I already had a preset gradient made up, from the grass example, but feel free to make the gradient how you want.  

 Next you should increase the Particle count to about 500 and if you run it you should get something like this:

 As you can see it looks better but still doesn't look right.

 First things first, I've added a cube and scaled it to cover the bottom parts. I've also noticed that we need to change the Sort mode which by default is set to none. You'll be able to change this by going into the particle system, under the Renderer module and set the Sort Mode to By Distance.

Now that looks much better. Obviously it's not the best looking but put into the right hands, well you get the idea.

I've also been testing this out with my other project A Way Home and plan on using it within the game especially since it'll go really well with the new visual style.

I hope this tutorial helped you out and any feedback or comments are very much appreciated.