Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Things I've learned trying to draw grass.

Sign in to follow this  
Norman Barrows


1. you can draw a million animated plants with no culling using instancing with static instance data. dynamic data is another story ( 60 vs 23 FPS i7 6700K 4Ghz single thread, GTX1080 10-20% overclocked, vsync on at 60Hz, DX9 hardware instancing, single static vs single dynamic buffer, LOCK_WRITEONLY). Note: I have yet to test LOCK_DISCARD and round robin use of dynamic buffers.


2. Good looking plants are usually high poly. No duh!


3. Low poly plants usually don't look good. No duh!


I'll upload a shot from Skyrim SE on Ultra when I can. believe it or not its even a bit more basic than this!

4. A good high resolution ground texture works just as well if not better than detail mapping. unless you're short on texture ram.

5. Double sampling a ground texture at two different scales and blending the results can be used to hide repeating patterns in tiled seamless ground textures. But this only works with some image textures, like small rocks and dirt, not textures with images that should be a specific size (such as leaves on the ground). It also results in two super-imposed images, like a double exposure on a photo. adjusting the sample scaling can lead to some decent (or even better) results. Double sampling does not work well with textures that contain a very high degree of detail, such as individual grains of sand or individual blades of grass.

6. sets of seamless ground textures, with textures assigned at random to ground quads can really help break up repeating tiled ground texture patterns.

< Images: single tile and tile set ground textures - dirt or scrub - 3pv - long range >

7. one problem with low poly plant meshes that use invisible quads is that often the bottom reveals that its just a clear quad with an image on it. This is especially true when the bottom of the image is wide. a trick i discovered to hide this is to lay a quad almost flat, say 20 degrees from horizontal, then place a bunch of then sticking out around the bottom of the plant. This hides the bottom edges of the quads that stand more upright.

< images: quad plant with wide image at bottom, quad based plant with low quads to hide the base >

8. another problem with quad based plant meshes is the tops can give away the fact its just a quad - especially when viewed from above. When testing meshes, i noticed some textures looked great from above, while with others you could tell it was a quad. Turns out its the amount of background you can see though the image. if the image is too solid, it gives away the quads. to test this, i loaded a texture that didn't look good into paint.net, and did a global floodfill with the background color, and then adjusted the tolerance slider, which make the image more or less "see-through". I reduced the amount of foreground by about 50%. and it worked! What this does is make the image more "see-though" - IE fewer pixels pass alpha test and get drawn. This makes the qauds less noticeable or totally unnoticeable - with no twisting, bending, muti-quad sections, etc. just a bunch of flat squares. Needless to say thinning out the image makes the plant look thinner, so you may want to add some more quads to the mesh to thicken things back up. I'm currently getting very good results with a 112 vertex mesh. But i plan to redo it using the golden ratio.

< images: quad based plant with full texture near top. quad based image with see-thorough texture. Quad based image - "Golden Ratio" >

9. not all textures look good on all meshes. Some textures just don't look good no matter what mesh you try. Just give up and go try the next texture.

< image: any plant or grass texture except 105 or 126 on mesh #4 >

10. generally speaking, textures with long thin spindly stuff works better with quads. This is because its more "see-though".

< image - any thin scrub plant - they rock! >

11. by hiding the bottom with nearly horizontal quads, and using sufficiently see-though textures, quad based low poly meshes looks to be a viable method for rendering good looking plants en mass very quickly.



< image: plant1x.x with just about any grass or plant texture >

12. different textures look good with different meshes. they look great on some, and just plain weird on others. You really need to try all the combos to discover the best ones.

< images: mesh 4, texture 458. mesh 567, texture 458 >

13. "massaging" textures by adjusting hue, saturation, brightness, contrast, and input and output levels can make a BIG difference. Reducing brightness and increasing contrast slightly accentuates shadows, making the texture appear more "3D", similar to bump mapping. Reducing saturation can result in more realistic texture colors. As always - it depends on the image you start with. But these types of adjustments can turn "just another" texture into a texture that really "pops".

< images: grass22x source, un-retouched. grass22x.bmp >

14: color palette

It seems that a uniform color palette is necessary for the correct overall feel of the scene. for example, right now in testing i'm drawing ~10,000 non-instanced temperate savanna grass plants around the camera, but they are just 22 kinds of plants at random, just what i came up with as meshes and textures that happened to look good together ( i excluded the day-glow green tropical textures ). there'e everything from weeds that look like dead corn to bushes made from branches of acacia trees (not bad looking actually ). redone with a more uniform look for both the ground texture and the plant textures (all long de-saturated light green wild grass) i suspect the results will be impressive. Note the use of uniform ground cover colors in this series of videos:

15: multiple mesh layers and alpha blending can be used to get a "3D" look:



more screenshots to follow....

Sign in to follow this  


Recommended Comments

Some great tips here Norman. Glad to hear it is progressing so well. Can you repost a link to download your game if it is free? I'd like to take a look.

Share this comment

Link to comment

Maybe i should put the beta demo back up. From time to time i do get the occasional request. But last time i got pretty much zero feedback,  "doesn't run with a corrupt User Account Controls file", that was about it.  Like that's my fault! <g>

Its getting close to done, but all the graphics are still not in there, which means its changing daily - makes it harder to post something that's decent. I'll see what i can do.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!