Exporting particle grass from Blender

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Exporting particle grass from Blender

Post by ent1ty »

Hi,
my friend made me a nice particle grass model in Blender, but when i export it, i get just a green plane. I am exporting to .obj. How should i properly export it? Should I use some other format?
CuteAlien
Admin
Posts: 9930
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I am not sure what exactly a particle grass model is. You can't export effects if that is what you need. You can only export stuff like textured polygons.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Memorial76
Posts: 103
Joined: Mon Aug 10, 2009 8:22 pm
Location: France

Post by Memorial76 »

I would really be interested in creating such effects with Irrlicht?
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

Well, to be honest, i don't know what particle grass is too :) He just told me it is called like that. If it helps, i can upload the file in .blend format.
Last edited by ent1ty on Mon Mar 08, 2010 6:05 pm, edited 2 times in total.
Memorial76
Posts: 103
Joined: Mon Aug 10, 2009 8:22 pm
Location: France

Post by Memorial76 »

It's a particle system simulating grass or hair. It has really nice render
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

So i guess the chances are that irrlicht does not support this :cry:
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

well write your own particle system for this. static grass like that seams reasonable to me when using VBOs. but dynamic with thousands of particles hmmm...dunno
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

At the moment you can't export a particle system in blender and import it into irrlicht. The systems are completely different (one is optimized for raytracing, the other is optimized for gameplay)

The irrb is a project that can export blender to irrlicht, but can't export particle systems (and even when it does, it will be limited)

I've modified the grass scene node for putting a grass mesh on a ground mesh. If you are interested I can post if here, though you might find it difficult to implement (it uses a texture to figure out where to put the grass)

If you're using a ground terrain and a image for grass you can simply use the grass scene node in the scripts forum
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

My ground is made from terrain(heightmap) and i already implemented calculating of position for all the grasses and also hiding them depending on their distance from camera(screen http://img709.imageshack.us/img709/694/23872444.jpg ). Now I will just replace all the cubes with some nice grass models, but I am a bit afraid of the fps. When i set their hardware mapping hint to static, is there any chance that they will render faster than cubes?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, hopefully you batch all the grass into one scene node, that would become much faster than the current version.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

But that would make impossible for me to hide the distant grass nodes, wouldn't it? Anyway, here is my current grass model showing also fps on the screen(nvidia 9500gt)http://img14.imageshack.us/img14/7051/55344849.jpg
The model has about 20 000 polys.
Now I am facing another problem; is there any way to get terrain's rotation in exact coordinations? Want to align the grass nicely to the terrain.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, you need to get the height at the surrounding vertices as well, and calculate the slope. Maybe it would be an idea to add a getSlope(x,y) to the terrain node.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

ent1ty wrote:But that would make impossible for me to hide the distant grass nodes, wouldn't it? Anyway, here is my current grass model showing also fps on the screen(nvidia 9500gt)http://img14.imageshack.us/img14/7051/55344849.jpg
The model has about 20 000 polys.
Now I am facing another problem; is there any way to get terrain's rotation in exact coordinations? Want to align the grass nicely to the terrain.
It depends on the bottleneck. how do you calc visibility?maybe patching several grassnodes together will speed it up as well.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

I calc it from a ray cast on every node, then get the rays lenght and maybe hide it, depending on the distance

Code: Select all

if(timer->getTime()%10==0)
  {
    grassesShowed=0;
    for(int i=0; i< grasses.size(); i++)
    {
      ISceneNode* grassNode= grasses[i];
      if(!strcmp(grassNode->getName(), "grass"))
      {
        line3d<f32> grassRay;
        grassRay.start= grassNode->getPosition();
        grassRay.end= camera->getPosition();
        if(grassRay.getLength()>50)grassNode->setVisible(false);
        else if(grassRay.getLength()>40 && i%4==0){grassNode->setVisible(false); grassesShowed++; }
        else if(grassRay.getLength()>30 && i%2==0){grassNode->setVisible(false); grassesShowed++; }
        else {grassNode->setVisible(true); grassesShowed++; 
      }
      }
    }
  }
Anyway, how can one patch several scenenodes into one?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can either add all vertices and indices into one meshbuffer, or add all meshbuffers into one scene node. The latter is not as efficient for rendering as the former solution, but it is much simpler to manipulate afterwards (for changing rotations etc). And it also saves many calls to the driver.
Post Reply