Corrado
Member
|
Grasses into one mesh
Hello,
im studing how put over a terrain with different heights some grasses : for maximum speed i need one single mesh with more grasses.
I load one mesh grass, copy into an array, obtain the heights from the terrain, change the vertex values and finally create a mesh with create(array, num).
I have some problems after i changed the vertex values, i think i have to recalculate something like : tangents, normals, ...
Note : to change the vertexes values i used : VtxSet(), now : what i have to do after to obtain a correct mesh to use with create(array, num) ?
Many Thanks,
Corrado
|
|
01-21-2009 07:56 PM |
|
Esenthel
Administrator
|
Re: Grasses into one mesh
Hi,
if you want to keep grass bending effect (that the grass bends on the wind slightly) you can't do that, currently grass bending is determined by vertex Y position (which is always in 0..1 range)
if you've only repositioned vertex values you don't need to set tangents/binormals
but you need to recalculate mesh box (Mesh::setBox), and convert software meshes to renderable versions (Mesh::setRender)
|
|
01-22-2009 12:48 PM |
|
Corrado
Member
|
Re: Grasses into one mesh
Many Thanks,
yes : now all its Ok (the bending effect also it works good), tks again (i forgot to recalculate the BoundingBox).
I think i will use this way also to draw instances of small mesh : i see that your engine works fast for large mesh but dont increase
the speed if i have mesh with a few of faces :
Example : instances with draw(matrix)
10000 instances with 600 faces -> 27 Fps
10000 instances with 2 faces -> 27 Fps (the same!)
(In this case normally the increase should be from 5 times to 20 times).
Maybe i forgot something or there is another way to draw 2faces meshes ?
Tks a lot
Corrado
|
|
01-22-2009 02:50 PM |
|
Esenthel
Administrator
|
Re: Grasses into one mesh
rendering models with full texturing and shading must be done only through Mesh::draw, or Mshl::draw, or Mshc::draw
if thats the results of your test then it seems that the bottleneck is directX states setting,
but for instanced grass rendering you can use also Grass class which is suited for instancing, and uses less directX states switching so it should work a little faster, there is a tutorial about using the 'Grass' class, in "Advanced\Mesh" folder
|
|
01-22-2009 03:19 PM |
|
Corrado
Member
|
Re: Grasses into one mesh
Tks again,
maybe the others engines dont set full option to have good lights like yours and so they can go faster with small objects.
About the sample with your grass tks, i already studied it but the speed is almost the same.
Bye
Corrado
|
|
01-22-2009 04:12 PM |
|
Esenthel
Administrator
|
Re: Grasses into one mesh
The default renderer in my engine is using Deferred Rendering, so Lighting is done independently to the geometry complexity.
|
|
01-22-2009 04:19 PM |
|
Corrado
Member
|
Re: Grasses into one mesh
.. and so why the other engines draw much more faster the small objects ?
Until today i used PowerRender and Ogre : these are very speed with instances with small objects :
10000 objects 2faces PowerRender-> Fps : Cpu=71 Gpu=208/1164(static)
10000 objects 2faces Ogre-> Fps: Gpu=239/686(static)
... but with bigger objects the speed of your engine is similar than the others.
For sure i will move my job from the others to your engine because i think yours is much better for
various reasons : lights, shadow, optimizations, ... a lot of ready classes like clouds, sky, sun, ...your
good and prompt assistance, ...
Bye,
Corrado
|
|
01-22-2009 05:33 PM |
|
Esenthel
Administrator
|
Re: Grasses into one mesh
this is because of Deferred Rendering, which works differently (it's an advanced rendering technology)
the base speed of this technique is slower, but it gets faster when you draw a lot of meshes + lights
you can switch to standard rendering (Forward Rendering) using Renderer.type(RT_SINGLE_PASS)
you can check the documentation\programming\rendering for a little more info about it
|
|
01-22-2009 05:37 PM |
|