Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Terrain with Grass

Author
Message
LEAF
16
Years of Service
User Offline
Joined: 29th Oct 2008
Location:
Posted: 4th Aug 2009 20:25
Hello! i'm working on a 3rd person perspectiv game and I just want to add some nice graphical details but I need some help.

My 3D terrain is made of an bmp file
Code:


I want to add some nice grass to it .
Here's the grass code:

It seems like that code only works on a matrix and if I add it to the terrain they are gigantic and doesn't follow the ground as I want it to. Is there some way I can fix that or should I use another grass code? Please help me!

-BlackRetroBox-

-Square eyes is the only thing
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 4th Aug 2009 22:29 Edited at: 4th Aug 2009 22:30
Well, when you do this:

position object t,x#+rnd(sectionwidth#),y#+(grassheight#/2),z#+rnd(sectionlength#)

Your positioning grass randomly, but flat! - you need to work out the X and Z position first, then set Y as the height of the terrain, like:

GX#=x#+rnd(sectionwidth#)
GZ#=z#+rnd(sectionlength#)
GY#=get terrain ground height(1,GX#,GZ#)+(grassheight#/2)

Then position the grass object at GX#,GY#,GZ# and it should be level with the terrain.


Health, Ammo, and bacon and eggs!
LEAF
16
Years of Service
User Offline
Joined: 29th Oct 2008
Location:
Posted: 4th Aug 2009 22:48
That didn't make me much smarter . Where should I put the code? Should I delet the position object code and replace it? Please how do I make the grass smaller, the grass is almost bigger than my map and 10fps is hard to work with. And another thing, for some reason the grass textur takes over my map texture :S. Please help me, thanks.

-BlackRetroBox-

-Square eyes is the only thing
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 4th Aug 2009 22:51
It's probably best if you upload it, or email it to me, and I'll get onto it tomorrow - busy tonight but I'd be happy to make an example for you, it's much easier to get right with the same heightmap and grass texture.


Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2025-06-26 07:00:53
Your offset time is: 2025-06-26 07:00:53