The stuff I like to make…

I have noticed a pattern in my work over the past five years.  The stuff I enjoy creating is the stuff that is the most difficult to create.  More specifically, I enjoy finding clever ways to create things that generally require ridiculous amounts of polygons.  Grass, for instance.  How do you make grass?  Millions of blades, millions of polygons.  The current level of hardware that most studios are using can handle more polygons than ever before.  However, even with the powerful machines we are running these days, once you start counting your polygons in millions, you have a problem.  So then, are there ways of creating grass that don’t require every blade to be rendered as individual objects.  If this is possible, the benefits will translate into shorter rendering times.  Even if you are using a supercomputer that can handle 10 million polygons, you may grow old waiting for it to render.  The fewer polygons, the better.  How many polygons should be considered too much?  That depends on your hardware.

I had to determine the maximum number of polygons my computer could handle.  Art of Illusion natively deals in triangles, so that is what I used.  I started with a cube.  A cube is made up of 12 triangles.  Applying a smooth operation to the cube adds more triangles in an attempt to round the edges.  After one smooth operation, the cube had 48 triangles.  After another operation, the cube had 192 triangles.  The poly count quadruples each time.  In fact, the smooth operation simply splits each triangle into four triangles.  Continuing the pattern, it is possible to have unlimited polygons on screen while still knowing exactly how many there are.

12 > 48 > 192 > 768 > 3 072 > 12 288 > 49 152 > 196 608 > 786 432 > 3 145 728

Nine smooth operation will net over 3 million polygons.  Upon trying this, I found that 3 million polygons was too much.  My interactive display was sluggish after the eighth smooth.  I would still say the scene was “workable”, but I wouldn’t want to deal with anything more 700 000 triangles.  That’s what I will call the “maximum poly count”.

With a budget of 700 000 triangles, if we were to use 150 000 of them for the grass, there would be plenty of computer resources left for the rest of the scene.  A field of grass is nice, but I want to create a scene around the grass.  Therefore, the grass in not allowed to consume all of my maximum poly count.  150 000 triangles is my budget.  That sounds like a lot.  Technically you can use a single triangle for each blade.  Is 150 000 blades of grass enough?  No, it’s not.  I’ve tried it.

If one triangle per blade isn’t feasible, we need to increase the blade to triangle ratio.  The secret lies in this image:

This picture contains more than 40 blades of grass.  The mesh I will apply it to looks like this:

40 blades of grass with just two triangles.  Now we’re talking.  Even if we needed a million blades of grass, we would only need 25 000 of these rectangles!  I tried 10 000 to start, but the grass coverage wasn’t too good.  20 000 objects produced much better result.  This is the top view as seen in Art of Illusion:

It took about ten minutes for the script to randomly place all the grass, but the result it amazing:

As you can see, the quality is very high.  You can’t tell that this is a texture trick.  And better yet, the texture we used was high enough quality that we can zoom the camera in without the grass appearing stretched.

You may find a few oddities in the above image. Each rectangle was rotated randomly.  Zoom in close enough and you will see some of the rectangles appearing at extreme angles.  This causes odd lines or shadows to appear if you zoom in this close.  Honestly though, if you needed the grass this close, you would use a different technique.  Overall, the grass looks amazing.

Remember, I used 20 000 rectangles.  That’s 40 000 triangles.  With my maximum poly count at 700 000, this grass is practically free.  However, having 20 000 textured objects in your scene WILL slow it down a bit.  Since grass is basically just eye candy, you can hide all the grass until you are ready to render.

Cheap, realistic grass that can be viewed from any angle.  Mission accomplished.

One thought on “The stuff I like to make…

  1. Pingback: Cat Project for a friend - Chris Chaney

Leave a Reply

Your email address will not be published. Required fields are marked *