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

Games look better with weed

Sign in to follow this  
Dr. Lexus


I've been working on putting in some weeds, sorry for the gratuitous low brow title of this entry.

Weeds are kind of hard to do, cause you gotta do a lot of them.

This is all OpenGL tech talk from here out

Hard lesson #1 was ... draw elements is limited to 65k thing a majigs because your have to specify a type that only goes up to 65k.

I was wondering why I could draw 299 plants, but If I drew 300 I only got one, the problem was 65k.

The solution was to use draw arrays, dropped that in, wasted a lot of double vertex definitions, but it works fabulous.

Next comes distribution pattern, I did a lot of research of fractals, using the golden mean (fibonacci stuff) but, I only needed a distribution pattern that was pseudo random enough to look non rectal linear within a rectal linear domain. I ended up just generating evenly space coordinates with a progressively rotating displacement from its source position, worked out well enough for me.

Next will be, to make sure I don't place grass on asphalt and inside buildings, but that should be a simple collision test.

Enough talk! first screen shot.


My pseudo fractal convolution of a 15x15 regular array over a 1024x1024 grid (my unit space) in 3rd person


Same deal here but in first person view, also I use fbo shadows mapping @2048 and these are in fixed function pipeline.

I am taking the screen shots from one of the more active levels and getting a nice 60fps on my MacBookPro (2012-ish)

But I figure I'll actually need to draw about 9Xs as much grass over a larger area so I decide to bump up the plant count,


I decided to turn on the shaders (glsl) for this one. And I like the plant density, but this is supposed to be over 3x the area, that's problem #1.

Next issue, I want good performance so I crudely just stop drawing the grass if the frame rate gets too slow, and it looks like i've definitely got to many plants to be also be including them in the shadow pass. this is what happened.



I will have to be more clever, and improve the glsl shaders I guess. to be continued....

Sign in to follow this  


Recommended Comments

There are no comments to display.

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!