dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [TECH] Dynamic Grass

  1. #1
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913

    [TECH] Dynamic Grass

    Hey guys

    So in the name of getting some activity in this place, I'll just share a little tech demo/concept I made one day while procrastinating on my school work.

    It's dynamic grass, basically a bunch of lines controlled by a cubic plane (A plane created by 2 cubic curves to control the movement offset of the lines). By rotating the values of the cubic curves individually, you can get something like this:
    http://www.newgrounds.com/dump/item/...92281e59592064

    Another thing is having a disturbance in it, which basically just influences the lines a bit.

    DEMO CONTROLS:
    mouseX controls the radius of the disturbance (the black ball)
    mouseY controls the strength of the disturbance
    WASD/Arrow Keys control the movement of the ball

    I think that this could make any RPG or outdoor based game a lot more immersive and alive. I'm still working on getting the grass to tile, which would be the whole thing very lightweight. I'll definitely be using this for my zombie shooter sometime, definitely some potential in making it scarier/atmospheric.

    Any comments are appreciated etc., enjoi

    P.
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  2. #2
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    That's nice.

    You using the drawing API for it, or just mcs / bitmaps ? Also whats the fps like, it looks like it could be stressful if you used it on too large an area.

    Squize.

  3. #3
    Senior Member Pazil's Avatar
    Join Date
    Sep 2006
    Location
    Ontario, Canada
    Posts
    913
    Quote Originally Posted by Squize View Post
    That's nice.

    You using the drawing API for it, or just mcs / bitmaps ? Also whats the fps like, it looks like it could be stressful if you used it on too large an area.

    Squize.
    It's all drawn to a bitmap (so the line drawing is a series of setPixel pizzaz), which by benchmarks is much faster than native vector drawing API in a funny way.

    FPS is really good actually, I run that demo at 60fps, and there are 5000 blades of grass moving. (And my computer is pretty ****ty). I have a simple idea on speeding up the grass rendering by a lot (2 copyPixels operations instead of those setPixels), and also performance is why I'll be working on getting it to tile, and so you could be rendering a 200x200 area, but have that spread all over. Thinking of using another bitmap as a mask to decide which blades to draw, and still thinking about how to have impulses/disturbances work with tiling.

    It's all very WIP, and this demo was very early in my thinking process about it. Hopefully after getting through school deadlines next week I'll have muchos time over March to experiment.

    P.
    WIP-ZOMBIES

    I love vegetarians! More meat for the rest of us!

  4. #4
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    Yeah bitmap will always be quicker.

    Cool, thanks for going into more detail, I'm interested in where you take this, it could be a really nice subtle effect.

    Squize.

  5. #5
    When you know are. Son of Bryce's Avatar
    Join Date
    Aug 2002
    Location
    Los Angeles
    Posts
    839
    Sweet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center