[HELP] Foliage that is parallel with the camera

Posted By: Enduriel

[HELP] Foliage that is parallel with the camera - 03/13/09 09:57

I've been working on some foliage in maya the past few days, getting them to look right in-game is a really difficult task. I've tried planes, bent planes and all kind of stuff, it's still not what I had in mind.

So now I'd like to make the planes parallel with the camera instead pretty mush like Oblivion.

Right now I do not have any ideas on how to do that with a shader (if it's possible even). I'd like to have the trunk on a different MDL file as I'm using Slins normal map shader on it, and all the planes (leaves) in either one MDL file or have a single MDL plane and use some sort of a for loop which checks through either "bones" with names or vertexes and inserts them accordingly and then giving them each an action which has like my.pan = camera.x or something. But I guess that would be abit slow if I have like 50+ Trunks.

So does anyone know or have some ideas which could help me achieve this without shader programming as I have no clue about it or if the for loop idea would work?

Thanks in advance!

//Endu
Posted By: Max_Prower

Re: [HELP] Foliage that is parallel with the camera - 03/13/09 10:45

If you mean foliage that always faces the camera, you could try a sprite. Just don't give it an angle of any kind and it will always turn to face the camera. If you wanted to make it impassable you could try making a cube and making it completely transparent.
Posted By: Enduriel

Re: [HELP] Foliage that is parallel with the camera - 03/13/09 12:01

I ment more like the leaves of a tree, like 50-100 planes with a 32 bit alpha texture that face the camera always, any ideas?
Posted By: Enduriel

Re: [HELP] Foliage that is parallel with the camera - 03/13/09 22:42

Oh well, I fixed my problem with a for loop that checks through the vertexes and adds leaves to them accordingly, and then assigning an action that makes it always be parallell with the camera smile

Here is the code for the people who maybe wants it smile

Code:

STRING* leaf_string = "leaf.bmp"; //The leaf file, can be a plane mdl with alpha aswell
ENTITY* mdl_with_vertexes_only; 

action face_camera()
{
	while(1)
	{
		my.pan = camera.pan;
		my.tilt = camera.tilt;
	wait(1);
	}

}

function Add_leaf_to_vertex(ENTITY* ent)
{
  var i;
  for (i = ent_vertices(ent); i > 0; i--) // repeat until all vertices are checked
  {
    VECTOR v;
    vec_for_vertex(v, ent, i);
    ent_create(leaf_string,v,face_camera);
  }
} 

action tree() // Assign this to the mdl file that is supposed to have only vertexes
{
	mdl_with_vertexes_only = me;
	Add_leaf_to_vertex(me);
}

Posted By: Max_Prower

Re: [HELP] Foliage that is parallel with the camera - 03/16/09 17:21

Congratulations! ^^
© 2024 lite-C Forums