need Input about Entitys

Posted By: CocaCola

need Input about Entitys - 06/07/16 11:05

Hello,
I wont learn more about Entitys and fps, how it works and hope i can spawn more entitys.
Can you give me more back ground Infos, plase.
Posted By: Slin

Re: need Input about Entitys - 06/07/16 11:17

Entities are these things with a position, orientation, skills, flags and model and some other stuff. The almighty manual will give you some more information.
It works by calling ent_create, but there is also a max entity limit which you can change. But depending on how many you want and what you want them for entities might not be what you want and you should consider particles instead or do your own mesh merging solution.
Posted By: CocaCola

Re: need Input about Entitys - 06/07/16 14:12

I want to place many models.
I'm going to use a mesh merging solution to a forest create with Sprites, thank you.
I still remember that justsid told me of a minimum size for the models, which reserves the graphics card per model.
Where can I read something about?

Ich möchte viele Modelle plazieren.
ich werde die Verschmelzung Technik benutzen um einen Wald aus Sprites zu erstellen, danke.
Ich erinnere mich noch, das justsid mir von einer minimal Größe bei den Modellen erzählt hat, die die Grafikkarte pro Modell reserviert, unabhängig davon, wie-viel Speicher das Modell braucht.
Wo kann ich da nachlesen

Posted By: CocaCola

Re: need Input about Entitys - 06/07/16 16:34

this level was on 20 fps,... now, look at picture, thx
Posted By: Dooley

Re: need Input about Entitys - 06/07/16 21:14

There is an Acknex User Magazine article about making a grass/vegetation script that moves the grass along with the player. This way it does not require millions of entities on your level, and it saves your frame-rate. I have used a modified version of this script in my game "Star Explorers," and I'm very happy with the results...

http://www.opserver.de/ubb7/ubbthreads.php?ubb=showgallery&Number=458179

AUM is available online for free here: http://www.coniserver.net/coni_users/web_users/pirvu/aum/aumonline_e/

Use the search feature to look for "Serious Vegetation." I think the script they have in old C-Script, but it's pretty easy to change to Lite-C.
Posted By: CocaCola

Re: need Input about Entitys - 06/08/16 06:57

Hi Dooley!
Your Project is beautiful!
to The Gras, I found only this. Is this right? because it is from the svegetation.wdl but it´s only for one objekt.
Code:
function weaving_grass()
{
	var grass_angles;
	var grass_speed;
	grass_speed = 2 + random(5);
	while (1)
	{
		grass_angles += grass_speed * time; // allow the grass to weave
		my.roll += 0.02 * sin(grass_angles);
		wait (1);
	}
}

Posted By: CocaCola

Re: need Input about Entitys - 06/08/16 07:22

I have tested the mtl_animTree from the standard shader and it works fine for grras but my 345 trees are one model, the thousends of grases would be to, in one model, maby can animate these seperatly in the frames
Posted By: sivan

Re: need Input about Entitys - 06/08/16 11:33

this is where 3DGS performs badly...
345 separate trees are fine if poly count is not high, instead of grass sprites use grass models, they perform much better, you can create groups of grasses within a model, then use animtree shader for everything, and never let them have a while loop, it kills performance, reset their DYNAMIC flag.
Posted By: rayp

Re: need Input about Entitys - 06/08/16 12:49

Use clipping with lod if u dont already
example
Code:
action Object_ClipAway(){
  my.eflags |= CLIP0;   // clip away at 50% LOD range    
  wait (1);            
  my.emask &= ~DYNAMIC; // then make entity static for better performance	      
}
action Tree_Wed(){
  my.eflags |= CLIP0;       // clip away at 50% LOD range    
  set (my, POLYGON);        // if grass PASSABLE of course
  my.skill41 = floatv (30); // values for animTree
  my.skill42 = floatv (30);
  ent_mtlset(me,mtl_animTree, 1);	
  wait (1);
  my.emask &= ~DYNAMIC;     // then make entity static for better Performance
}

Posted By: CocaCola

Re: need Input about Entitys - 06/08/16 13:32

thx sivan and rayp.
I´will try the shader again, for my 345 tree Modell, maybe I need to change some proterities in the shader, I think it would work only it is a vertex transform shader

The D<namics Flag, I have never used bevor, maybe my generated wood, had mor fps laugh
Posted By: Dooley

Re: need Input about Entitys - 06/10/16 09:11

Thanks! I'm glad you like it. It is on Steam: Greenlight right now if anyone's interested:https://steamcommunity.com/sharedfiles/filedetails/?id=700074180

I have a whole bunch of small grass models, each one with this function as part of the action. I am not using the waving feature at this point, but I might try it in the future. They simply wait until the player moves a certain distance away, then they re-position themselves at a distance from the player. it's pretty seamless. I also added a feature that checks if they would appear under the water level, or on a steep angle, and it turns them invisible in case they do. I think I'm using around 900 different grass models or so...

Quote:

grass_drop = c_trace(vector(my.x + 1536,my.y,my.z + 1000),vector(my.x + 1536,my.y,my.z -1000),IGNORE_ME|IGNORE_PASSABLE|USE_POLYGON|IGNORE_FLAG2);
if(var_boiled == -1 && hit.z <= ice_level)
{
set(my,INVISIBLE);
my.x = hit.x;
my.y = hit.y;
my.z = hit.z;
}
else if(hit.z < fog_level || normal.z < .95)
{
set(my,INVISIBLE);
my.x = hit.x;
my.y = hit.y;
my.z = hit.z;
}
else
{
reset(my,INVISIBLE);
my.x = hit.x;
my.y = hit.y;
my.z = hit.z;

vec_to_angle (my.pan, normal); // and align it properly
}


This function runs in a while loop in the grass action, and it checks the player's position as compared to the grass position like this: if(planet_character.x > my.x + 768) in all four directions.
Posted By: CocaCola

Re: need Input about Entitys - 06/10/16 13:51

Your Project is realy interesting.
to place my trees I´m usind the Hair Partice in Blender and export the Models as one Model, the limit of vertces is <64k, more and my system crashed.
Hair Prticle are very simple for beginners, du you have experience with blender?
The Basik Steps are these:
klick on the Gras models right and press Strg+G, to group your Models Pool.
Chose your Terain Model and (1&2in picture) add a Particle system.

in Type: you chose Hair.
in Renderer you chose Group chose in the empty mini window your Group with grasses.
Ready.

You can make/chose many different settings:
Random Object from the Pool group
Random Size
parant by normal Angle or not

at last you have to make hair to vertex convert, sorry I don´t konow how this funktion is callig but you find it in the left down popupmenue.
Posted By: Dooley

Re: need Input about Entitys - 06/10/16 16:27

I use Blender to do most of my modelling. I would not have thought to use hair particles in a game though...

My grass is about 900 models, which are each 80 vertices, and use an overlay effect on the grass bitmap.



Having one huge model with that many vertices might cause your frame-rate to crash. I'm not sure exactly how that works, but I think the engine handles a lot of small models better than a small number of huge models...
Posted By: CocaCola

Re: need Input about Entitys - 06/10/16 17:52

have you a example for hair particle in 3dgs?
Posted By: Dooley

Re: need Input about Entitys - 06/11/16 18:34

In most games I've seen, grass is handled with low poly models with transparent bitmaps, rather than articulated models/individual particles.

However, you could use a particle emitter. I tried this successfully, but I did not like the results. Also, particles die by default, and it felt strange to make them stay alive by extending their lifetime with code.

Maybe someone else has some thoughts on this...
Posted By: Anonymous

Re: need Input about Entitys - 06/12/16 01:24

Well a single (joined group) grass model with up to a 1000 polys shouldn't be a bad thing. The trouble is making it line to the terrain. You can place the grass in 3dsmax(blender, ect) , right on the terrain in place, then group them into one model.(Of course delete the terrain before exporting the grass model and bring each on it's own to WED/MED/Engine).

I'm currently testing functions to just reshape the grass model to the terrain at level-load(run-time). That way I won't need special models for each area/level and random levels can us grass. Also to save time and energy I've hacked up the ent_seed() function and made a my own mod version for placing this stuff. )(ent_seed() in includes/level.c).

BTW you 2 guys should compare(PM) the specs on your test machines.My old one couldn't render 10% of the grass my current one can. But it was a simple student laptop.

I'll share some results if I get any with y'all.
Posted By: Anonymous

Re: need Input about Entitys - 06/12/16 20:26

@Thread Group

So part of the issue here is a lack of definition to the problem.

I mean - how to make lots of grass/trees is not The actual problem.?!
for example - Last night I covered a level and terrain (small.hmp), size of 1200x1200 in a clip field of the same size, with fields of waving grass. I ran a smooth 60 fps at x1080 HD . I used a grouped grass model that had (almost) 9,000 verts each. And I ran it through the (minor twitched) animTree shader.

So - We need to understand each part of the problem. See in a 1200x1200 level-box I can run grass but in a 12,000 x 12,000 -> lol fields of grass kill fps and must be made into patches of grass. Also we have to account for differences in cpu+gpu+ram+vram. It's not just a limit of model/poly size count on the engine, the gpu plays it's part in that.

So the better we can define and box-in the problem, is the only way we can solve it.

@ Dooley, I am current running a group grass made out of "stands" like in your post above. Baking the image with normal and specular data can help in the final look. Using many skins you can have a shader that runs bump mapping on it, that can help. In the end how much focus is the grass really getting? The games tend to have more focus elsewhere. When I play games like (shadow warrior), many times I do play session just to look at the level, because I miss so much beauty in full-run-and-gun play sessions.

@CocaCola - I've use the hair system in 3dsmax to make grass. The process is to covert the grass patch to geometry, then run it through a polygon reducer. You can end up with a low poly model, that way. However, you can also leave it high poly -> then render it both as image and normal map. From there you can use the rendered images in the "stands" like Dooley did.


EDIT - pictures all at 1080 HD and all running at 60 fps (sorry I could capture the fraps fps counter)
edit-> all grass is using the animTree shader( I did a tweak to it)
Sorry I've not the gift for art... A little time would help as I did this grass model quick and dirty.

They are
bare
normal
double -> grass models overlap by using 2x in the space
insane4x-> grass models overlap by place 4-times as many in the level area



Posted By: Anonymous

Re: need Input about Entitys - 06/13/16 09:32

Hi so the last map was tiny. So I used the bigger terrain and added badly optimized-ugly-as-hell trees. I'm still able to pull 60fps with many models and the shader. I'm using over-kill numbers of models just for testing, so I'm making up in clip ranges. It's got full clip at 4000 and half_cutting for models in then 2000. I ran it 6000 clip and it did knock fps down to 50 +- 5.
Of course I'd never try to use bad model or carpet the ground with grass (I need that extra cpu/gpu power for gun blast and zombie guts laugh )

Here is another image roll. Just a walk to the woods lol laugh







Anyway I was working on obj->ground place and shape, not making ugly levels. I got side tracked in this , so I'm done now and back to the work.
Posted By: Kartoffel

Re: need Input about Entitys - 06/13/16 10:07

Do you have transparency / alphablending enabled?

Because the overdraw caused by alphablending with densely placed geometry kills your fps.

In your screenshots it looks like it's disabled, though.
Posted By: Dooley

Re: need Input about Entitys - 06/13/16 19:53

I've found that "overlay" with bigger bitmaps works better than using an alpha transparency. I always get weird artifacts if I use alpha transparency.
Posted By: Anonymous

Re: need Input about Entitys - 06/14/16 02:05

@Kartoffel -> I do some mushing of shaders (With the little I know) to get a working version for whatever I need. So here in this case I dropped the "render twoside_alpha" bit into the pass for the animTree. If I needed a normal_mapping I'd work out hacking that in also. I've just learned this way, a good 50% reading up and tutorials and 100% try,fail,try again. 150% = learning things the hard way.
Code:
pass {CullMode = None; AlphaTestEnable = True; ZWriteEnable = true; VertexShader = compile vs_2_0 animTree_VS();



Possible you are seeing both my terrible texture and the add light + ambient effects of the shader. Actively shaded objects have a bit of light glow. I notice a touch of popping on screen and figured out it is the shader turning on and off in the clip range.
Here is the texture lol TGA2PNG for web hosting


- Funny story the need for a twosided material got added to the collection because I(and others) complained about wanting it to just be a WED ent flag. JCL would say how simple it was to add in code. Well we have a material that really isn't needed and JCL was right. However, ask me to explain the workings of the code snip beyond it's second layer of understanding and I still have no idea the answrs.

@Dooley - It's my understanding that in the end using this snip or the overlay both achieve the same thing -> running the entity in the solid pass. However, now I have to read up again to makes sure what I "think" and what is "true" are the same in that matter.
Posted By: Kartoffel

Re: need Input about Entitys - 06/14/16 08:40

Yeah, you're right.
CullMode = None disables the backface culling, so polygons are visible from both sides.
AlphaTestEnable tells the shader to check the alpha of the pixel-shader's output. If it's higher than AlphaRef it sets the pixel's alpha to 100% if it's lower the pixel will not be drawn.
ZWriteEnable (in combination with alpha-testing) will prevent layering artifacts (this one is on by default afaik)

Using AlphaTestEnable should already include this, but you could add AlphaBlendEnable = False just to be sure that it's disabled.
Posted By: Anonymous

Re: need Input about Entitys - 06/15/16 00:48

Thanks for the notes. They got me reading more and they are transportable notes on directx not just this engine (or rather maybe HLSL). Which is great, because I'm looking to learn future transferable skill, like dx and hlsl.

Turns out , AlphaBelndEnable is set to off(FALSE) by default.

I add the line to test and I saw no visible differences.

Quote:
D3DRS_ALPHABLENDENABLE
TRUE to enable alpha-blended transparency. The default value is FALSE.
The type of alpha blending is determined by the D3DRS_SRCBLEND and D3DRS_DESTBLEND render states.

Microsoft Link


Aside for the bad texture -> the over-layered grass models have random scale differences as well as random pan angle shifts, and do to the floor normal alignment they can differ in tile and roll angles as well. I'm not sure what you see(Because I'm ignorant to what I'm looking for.), but maybe it's related to these other factors.

Thanks for the notes, and help. There always welcomed.
© 2024 lite-C Forums