|
How to approach Grass and large vegetation
#472891
05/28/18 18:19
05/28/18 18:19
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
Hello friends
I was wondering which technique you would choose when it comes to rendering large fields of tall grass. Here are a list of choices I think I have, let me know what you all think:
1. Fur Shader: The shader in the wiki uses the shell method, rendering shells/triangles multiple times with offsets based off the normal, and a transparency causing a nice fuzzy fade. This method looks great, especially when looking at the surface straight on. But looking at the side of the shells will show the slices. If I wanted taller grass, I would need to add more shells/more passes.
2. Model billboards: This method can easily make tall grass if you have a good standing image of grass, you could add sway and animation, as well as pushing it out of the way when an object touches the model. The downside is that you have to manually place these tufts of grass in the level, and each tuft would require a while(). Im assuming I could also have a single while() iterate through each tuft, but once again, these are seperate objects each, which take resources. Model instancing wont be added :(, as well as the illusion breaking down if you look down at the model, which would show the cross section.
3. Sprites: Sprite instancing is possible in the current A8, but that means the grass will be facing the camera, they wont have any shading/lighting, and sprites arent really meant to stay in the world for long, how would I manage a large field of sprites? An emitter that can place sprites in an area with an infinite life?
Let me know if you all have experience with grass, and what methods you use that worked for you, and why.
Thank you!
|
|
|
Re: How to approach Grass and large vegetation
[Re: jumpman]
#472896
05/28/18 19:17
05/28/18 19:17
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Sprites are normal entities and don't have a limited/ finite life (when placed with WED or just via ent_create). Might wanna have a look at the following feature as well: A8 If the sprite's file name ends with "_x2" or "_x3", it is rendered in the shape of 2 resp. 3 crossed planes. This is very useful for simulating vegetation. You can find an example in the infinite_terrain.c demo. I'd probably spawn randomly scaled and oriented grass models all over the place, adjust them a little (in-engine) manually. Then have a script combine them into just one mesh or multiple meshes, depending on the vertex count or the size of the area. Another function would then write all vertices and triangles into a text (obj) file, following the very simple *.obj format, and import it into MED again. You don't need any while loops for interaction really, just put additional code into the vertex shader which does some distortion based on character positions.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: How to approach Grass and large vegetation
[Re: jumpman]
#472897
05/28/18 19:22
05/28/18 19:22
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
Hi jumpman. Fur shader is waste of time and waste of gpu power. You can forget about it. Since i'm still using A7, i can't say aything about sprite instancing. I am using model. I don't need vertex animation and while operation. I can animate foliages&grasses with shader. it's simple. About the "pushing it out of the way when an object touches the model.": I never try that but i think you can do it with event and shader like this: (not grasses but weeds and bushes)
//Lite-c
if(event_type==EVENT_FRICTION)
my.skill41=floatv(1)
...
//shader
if(vecSkill41.x==1)
do animation
But i don't think it's necessary. Players may not pay attention to them, especially in the action games. in a nutshell I prefer the model. Here is what and how i'm doing. Edit:I did not see the post of superku when I wrote this. I also agree with him. Edit2:if there is a misunderstanding, i was talking about specific object when i point to vecskill41.
Last edited by Emre; 06/01/18 20:45.
|
|
|
Re: How to approach Grass and large vegetation
[Re: Emre]
#472913
05/29/18 12:41
05/29/18 12:41
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
If u are using sprites ( or models ) a seed map might become handy. Check out for in Manual ( include level.c ). To keep Performance also check out the CLIP's and DYNAMIC flags
action place_grass()
{
vec_scale(my.scale_x,0.75+random(0.5));
my.flags |= PASSABLE | TRANSLUCENT;
my.alpha = 70;
my.eflags |= CLIP1;
wait(1);
my.emask &= ~DYNAMIC;
}
Maybe you know those nice functions already. Greets
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
|