Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, aliswee), 835 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Serious User
jumpman  Offline 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 Offline
Senior Expert
Superku  Offline
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:
Quote:
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 Offline
User
Emre  Offline
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)

Code:
//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 Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
If u are using sprites ( or models ) a seed map might become handy. Check out for
Code:
ent_seed

in Manual ( include level.c ).

To keep Performance also check out the CLIP's and DYNAMIC flags
Code:
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;
Re: How to approach Grass and large vegetation [Re: rayp] #472923
05/30/18 04:11
05/30/18 04:11
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Search for "serious vegetation" on the AUM site:
http://www.coniserver.net/coni_users/web_users/pirvu/aum/aumonline_e/

Re: How to approach Grass and large vegetation [Re: Dooley] #472950
06/01/18 17:04
06/01/18 17:04
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Thank you for your advice my friends!

@Superku

I know how to pass a vector postion to a shader, however wouldnt the grass tuft need a while() to send the vector position to the shader? Or use a startup and iterate through each tuft's skill for each of their shader, assuming each tuft is meant to have its dynamic flag off.

@RayP thank you, Ive never looked at this code at all, this is great!

Ill send some examples of my chosen method in the projects forum. Thank you all friends!

Re: How to approach Grass and large vegetation [Re: jumpman] #472953
06/01/18 18:56
06/01/18 18:56
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
No, don't send via (entity) vecSkill41+ but as a material skill (vecSkill1) or just as a global variable/ VECTOR (look up the *_var feature, I think to be found under *_flt or similar).


"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: Superku] #472957
06/01/18 22:19
06/01/18 22:19
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
WOW superku, I didnt know you could pass a global vector into a shader!!! Im a dummy, which makes sense why you can change PSSM_ variables and have it change the shader. Thank you!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1