Grass Node v0.3.x

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

bumpity bump bump. check first post for screenie, :)
here for download:
http://gdlib.net/index.php?name=Downloa ... ails&id=64

grass is now generated from a bitmap
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

:shock: Drools... Wow. Now we just need someone to come up with a suite of weather effects scenenode like snow, rain, tornado, dust storm, etc. That way I can use them to finish my Lion 3D project. :)
Colt Rowdow
Posts: 3
Joined: Wed Nov 16, 2005 7:57 am

Post by Colt Rowdow »

Arg, I get compiling errors.:

Code: Select all

424 CGrassPatchSceneNode.cpp [Warning] converting to `irr::u32' from `irr::f32' 
439 CGrassPatchSceneNode.cpp [Warning] passing `float' for converting 2 of `irr::video::SColor::SColor(irr::s32, irr::s32, irr::s32, irr::s32)' 
there are a coupe more, but they are just these errors over again. I am using devcpp with irrlicht 0.14.0 is there anything that I am doing wrong?
needforhint
Posts: 322
Joined: Tue Aug 30, 2005 10:34 am
Location: slovakia

Post by needforhint »

theese are warnings, not errors
what is this thing...
Colt Rowdow
Posts: 3
Joined: Wed Nov 16, 2005 7:57 am

Post by Colt Rowdow »

Sorry for the double post. I found out what was wrong, :oops: I forgot to change one of the project options to the correct directories.
ErUs
Posts: 165
Joined: Thu Oct 07, 2004 6:13 pm

Post by ErUs »

Code: Select all

CGrassPatchSceneNode.cpp [Warning] converting to `irr::u32' from `irr::f32' 
get rid of that warning by doing irr::u32 bleh = (irr::f32) blah; ?
Guest

Post by Guest »

wrong, by doing irr::u32 bleh = (irr::u32) blah; because blah is f32 and has to be converted to u32


ps: erus you sexy bitch :D
Xaron
Posts: 310
Joined: Sun Oct 16, 2005 7:39 am
Location: Germany
Contact:

Post by Xaron »

Hi bitplane,

thanks for the new version! :)

As I see you did not change the faulty height compution thing. *g*

So I've built in a bilinear interpolation to get the more accurate height from the heightmap.

In CGrassPatchSceneNode.cpp change the following:

line 183:

from

Code: Select all

s32 x1 = (s32) xz.X;
s32 z1 = (s32) xz.Z;
to

Code: Select all

s32 x1 = floorf( xz.X );
s32 z1 = floorf( xz.Z );
and line 189

Code: Select all

if ( x1 < 0 || z1 < 0 || x1 > TerrainHeightMap->getDimension().Width || z1 > TerrainHeightMap->getDimension().Height )
to

Code: Select all

if ( x1 < 0 || z1 < 0 || x1 > TerrainHeightMap->getDimension().Width - 1 || z1 > TerrainHeightMap->getDimension().Height - 1 )
and line 207

replace

Code: Select all

video::SColor c = TerrainHeightMap->getPixel(x1,z1);
height = c.getBlue()* Terrain->getScale().Y; // -  ((rand() % 100) / 25.0f) + 2.0f;
with

Code: Select all

// do some bilinear interpolation to get the real height
f32 ay = TerrainHeightMap->getPixel(x1,z1).getBlue()* Terrain->getScale().Y;
f32 by = TerrainHeightMap->getPixel(x1+1,z1).getBlue()* Terrain->getScale().Y;
f32 cy = TerrainHeightMap->getPixel(x1,z1+1).getBlue()* Terrain->getScale().Y;
f32 dy = TerrainHeightMap->getPixel(x1+1,z1+1).getBlue()* Terrain->getScale().Y;
f32 u = xz.X - (f32)x1;
f32 v = xz.Z - (f32)z1;
height = ay*(1.0f-u)*(1.0f-v) + by*u*(1.0f-v) + cy*(1.0f-u)*v + dy*u*v;
Maybe you can integrate this into your next version? ;)

Best regards - Xaron
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

hey thanks Xaron, I was avoiding this. didnt know it was called bilinear interpolation. damn algorithm names! if bilinear is up the outsides then across the middle then i guess the wind is still linear and that needs fixing too. I shall get onto that today and release a new version :)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
andrei25ni
Posts: 326
Joined: Wed Dec 14, 2005 10:08 pm

Post by andrei25ni »

looks very nice, bitplane. I can hardly wait to test it. :P
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

okay here goes.. now with bilinear interpolation on wind and height of grass blades. :D
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

@ bitplane, nice to see that your project is on development, 2.5 looks better than 2.4. I love improvenments. You are very successive. This is one from my favourite topics :D .
Congratulations!
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
Xaron
Posts: 310
Joined: Sun Oct 16, 2005 7:39 am
Location: Germany
Contact:

Post by Xaron »

Thank you bitplane! This looks great! :)

Regards - Xaron
Xaron
Posts: 310
Joined: Sun Oct 16, 2005 7:39 am
Location: Germany
Contact:

Post by Xaron »

Hi bitplane,

as I use your great node in my project I just want to ask you 2 thing without looking too deep into your code. ;)

What are you doing with the TerrainColourMap and the TerrainGrassMap?

Regards - Xaron
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

TerrainColourMap is for changing the colour of the grass to match shadows on the terrain. TerrainGrassMap is grass size and density, brightness is height and alpha is density. iirc these need to be the same size as the heightmap.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply