Eeeew, my grass looks like ****

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

the hardware vertex buffers wont help with billboards, only static meshes (i think) cos you need to change them to face the camera every frame
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Hmm. If you were to write the grass, would you use a billboarding effect?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

well i tried it and billboards look pretty good so far. getting a reasonable frame rate anyway.
Image
shame the distant ones are black instead of fading out.

download here

if you change some parameters and want to regenerate the grass, just delete the files out of /grass/ and they'll be recreated next time you start
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post by dawasw »

Bitplane I've tried your grass and it's great ! :D

But I don't know If I will use any grass in my project anyway , I'm afraid of low speed. (when I would add grass, many trees and later player with enemies it would work fast enough)
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Damn! Very nice. So what did you do that made yours speed up? (Havent read the code yet)

======

Wow, using a particle system for each grass billboard eh. That works. Has irrlicht got special optimizations for using particles instead of regular billboards then?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

what you've got there is a 10x10 grid of grass nodes, each one contains a particle system. turn debug data on to see whats going on.
it will only calculate particles if its near to the screen, and it will only draw particles that are within a certain range. what it needs next is a daddy node that spawns and destroys grass nodes as the camera moves around. there's no need for 100 grass nodes, a 3x3 grid around the camera at all times would be good for seamless worlds.
I think this calls for some showing off in the project announcements forum!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Agreed completely! Very well done.

Bit, why does the grass shake? Is that the particle system refreshing the grass?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

thats my 'wind' example. I've made a function that will (one day) provide the wind speed at a given position and time, but i'm crap at fancy wave-like movement.
download from here instead for *slightly* better wind (still doesnt use time)
http://gdlib.net/index.php?name=Downloa ... ails&id=64
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Well, thanks a bunch for the scene node. I will soon write the tree tutorial as I promised :)
Xaron
Posts: 310
Joined: Sun Oct 16, 2005 7:39 am
Location: Germany
Contact:

Post by Xaron »

Thanks bitplane, this looks really great! :)

Regards - Xaron
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Nice, Very similar technique to parts of what's described in a GPU Gems 2 article
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
MindGames
Posts: 32
Joined: Sat Jul 16, 2005 2:02 am

Post by MindGames »

Thanks a lot, I just tried your demo and it looks pretty good. One problem I had was that if you rotate the view, the bilboards rotate too and this is quite noticable.

Have you any ideas about how to get around this problem?
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

Post by krama757 »

Well thats the problem with billboards, they rotate :)

If you just made them all meshes that didnt rotate then you would get some wierd looking grass when you looked at the meshes from the side...So this is the ideal solution.
Guest

Post by Guest »

Dug out this old link from an OGRE shot:

http://img180.imageshack.us/my.php?image=grassy25na.jpg

Generally a star-shaped geometry approach with height variations, normals that face upward for lighting and shaders for waving. You could implement the same in Irrlicht, OGRE has a demo of this IIRC if you want to see it in action.
Post Reply