LoD

Topics about the general development of Orxonox.

Moderator: PPS-Leaders

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

LoD

Post by greenman » Mon Mar 01, 2010 7:36 pm

Today we started thinking about LoD and found out the following points:

Mesh LoD:
- can be achieved by "upgrading" the mesh to contain certain versions of it (with removed complexity).
- this can be done using the OgreMeshUpgrader from the ogre-tools package
- i would say this would be a good ticket for the current semester to find out the best parameters for each model (as vertex decrease rate, #of lod levels, distance for each lod)
- we tried out different variants and achieved a increase of 50% in frame rate for asteroids in empty_level

Texture LoD:
- this seems far more complicated ...
- there is the possibility to use mipmaps and use different resolutions of the texture at different lods
- there is even the possibility to change the material file and make some fancy effects at high lod and other effects at lower lod
- this task seems to involves a lot of knowledge about material scripts
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Re: LoD

Post by beni » Tue Mar 02, 2010 2:32 am

Sounds interesting. Have you talked to Felix about this? He looked at this before.
I bet it's true that model LoD works good on asteroids, but I worry that with more complicated models this is more complicated. I don't know exactly how it works, but if the wrong details are reduced, this can be messy. However you mention parameters so I think it would be a good ticket to make a nice LoD-method for Orxonox.

For textures I know nothing better than mipmaps. Is there better technology by now?
I also think looking at the material files a little better should not hurt. Practically nobody at Orxonox has or had knowledge about the material-scripts. There is some documentation online. It would be nice to find out some things that we could use so we make better use of Ogre. So I think it's worth taking a look at materials anyway.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: LoD

Post by greenman » Tue Mar 02, 2010 8:14 am

i think the OgreMeshUpgrade script works quite nice (parameters are: #of lod levels, distance at which levels become active, reduction of vertices per level, i think thats all). i also tried it with the assff fighter but not thoroughly yet

for textures/materials mipmapping seems to be done automatically, but i could not see any significant performance increase/decrease when activating/deactivating it ...
however there's also the possibility to make different material techniques at different lods (i.e. full quality at high lod and maybe no bumpmap or no specular reflection at low lod)

i talked to felix about this yesterday. what we found out i mostly posted above.
i had a look into theese material scripts: it seems that one can do really fancy stuff with them ;) i think if we can identify a model as a bottleneck then we could trim the material script for this model to use less fancy material techniques at high lod.
i think these material scripts are documented quite well

apart from hs-w01 the biggest performance issue at the moment is probably the spaceship effects (most probably backlight and maybe also effects like smoke and explosions)

particle scripts are yet another topic ... someone said to me yesterday that they are not so good documented. i did not have a look at it yet.
does anybody know a bit about particle scripts?
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: LoD

Post by greenman » Tue Mar 02, 2010 9:44 am

manual LoD for meshes seems to be a bit more complicated. the only way i found out so far to do manual lod is the following:
- export the top lod object in blender to the ogre xml format
- export all low lod versions to the mesh format (?)
- add inside the <mesh> section of the top LoD model the following code:
<levelofdetail numlevels="xx" manual="true">
<lodmanual fromdepthsquared="distance1^2" meshname="mesh1"/>
<lodmanual fromdepthsquared="distance2^2" meshname="mesh2"/>
</levelofdetail>
- now convert the top LoD xml to mesh using OgreXMLConverter. this should include low lod versions of the model into the generated mesh


i'm not sure what to use for meshname (probably the normal filename though). information about this xml format can be found here

i have not yet tried this out but at least it seems possible to do ;)
i would say once we know this works we can have students generate low lod level versions of object (i.e. assff, astX, other ships, transporter, ...)

modeling guys: would you say reducing faces and vertices of an object is a difficult or rather easy task for a student?
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: LoD

Post by x3n » Tue Mar 02, 2010 2:07 pm

modeling guys: would you say reducing faces and vertices of an object is a difficult or rather easy task for a student?
i'd say it's a pain in the ass because one has to unwrap the whole model again and apply textures to it. so i really suggest to use the usual approach and let the graphics engine collapse vertices automatically. I don't know how this is done in Ogre, but I'm sure there is some code to do that.

the same applies for material scripts. it shouldn't be too hard to deactivate all shaders on a material if the object is too far, while on the other hand we'd need an army of designers to do that manually for each file.
does anybody know a bit about particle scripts?
sure I do.
you may remember i worked quite a lot with particle effects and enhanced the particle interface between ogre and orxonox. and i also worked with material files when I implemented adjustable shader parameters in orxonox. but to answer your future question right away, no i don't know how to implement LoD in material files and no, there is no easy and out-of-the-box way to reduce particle effects over distance. but there surely is a way to implement it and i don't think it's too complicated.

Imo the harder part, at least considering the design of the code and not the actual algorithms, is how to determine the amount of details which is needed for an object to look good. i think the formula is in the order of max(size, importance)/distance^2.
while the distance is simply length(camera-pos - object-pos), the other two parameters are harder to define.
the size of a model can be computed (bounding box), same goes for billboards. but particle effects are a lot harder (however it's still possible, for example size(initial distribution) + max(size(particle)) + time-to-life * speed + f(affectors), but you see, it's quite complicated, especially since affectors can modify the speed or size of particles.
the third parameter, 'importance' is manually defined in the level file. think about a quest like "destroy the pirate base", then you fly into an asteroid field - it's not necessary to see all asteroids in the field, but it's important to see the pirate base in the middle of it.

the last problem with LoD is, it depends on the point of view. so we have to know the position of the camera. i think that's currently possible but i also think we all (mostly) agree the camera management is still an open task. (if you don't agree, try to implement a cut-scene (maybe including shaders?) which is synchronized over the network. if you stopped crying, you'll probably agree).
Fabian 'x3n' Landau, Orxonox developer

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: LoD

Post by greenman » Tue Mar 02, 2010 4:23 pm

i'd say it's a pain in the ass because one has to unwrap the whole model again and apply textures to it. so i really suggest to use the usual approach and let the graphics engine collapse vertices automatically. I don't know how this is done in Ogre, but I'm sure there is some code to do that.
i'm not sure if the texturing is really neccessary
the automatic approach only changes the faces and has no new information about vertices and texturing

i'll probably have to change the question: how about simplifying just the object itself without texture

the automatic approach had some ugly problems with the texture if i applied it to the spaceship (if you want to have a look at it yourself, just use the lod version i uploaded today)



what you write about particles is that we implement the whole lod mechanism ourself and don't use the one ogre provides, if i understand you correct ?!
however a lot of these problems do not arise if we just use the ogre version of it. there are different strategies to select levels:
- by distance (ogre already knows the position of both the camera and the object)
- by size (ogre guesses the pixel size of an object on the screen)
- maybe there are also others but i know of none

i don't know yet how this works with particles but i would suggest to use the ogre lod mechanism
the importance of objects can also be "coded" into lod information by saying ogre to reduce less faces or at a bigger distance or whatever
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: LoD

Post by x3n » Tue Mar 02, 2010 8:17 pm

greenman wrote:
i'd say it's a pain in the ass because one has to unwrap the whole model again and apply textures to it. so i really suggest to use the usual approach and let the graphics engine collapse vertices automatically. I don't know how this is done in Ogre, but I'm sure there is some code to do that.
i'm not sure if the texturing is really neccessary
the automatic approach only changes the faces and has no new information about vertices and texturing

i'll probably have to change the question: how about simplifying just the object itself without texture
i don't say you have to change the texture, it's the mapping of vertices to texels which is a lot of work (called the unwrapping of a model). maybe there is a simple way to do that in blender, but i still prefer the automatic way because it allows an unlimited amount of detail-levels and thus is way more flexible.
the automatic approach had some ugly problems with the texture if i applied it to the spaceship (if you want to have a look at it yourself, just use the lod version i uploaded today)
yeah that's probably true, but first you don't see reduced models from close and second most models (like asteroids) have very simple textures.

what you write about particles is that we implement the whole lod mechanism ourself and don't use the one ogre provides, if i understand you correct ?!
however a lot of these problems do not arise if we just use the ogre version of it. there are different strategies to select levels:
- by distance (ogre already knows the position of both the camera and the object)
- by size (ogre guesses the pixel size of an object on the screen)
- maybe there are also others but i know of none

i don't know yet how this works with particles but i would suggest to use the ogre lod mechanism
the importance of objects can also be "coded" into lod information by saying ogre to reduce less faces or at a bigger distance or whatever
well i don't know if Ogre has such a mechanism for particle effects. if it does, then we don't have to implement it by ourself of course.
Fabian 'x3n' Landau, Orxonox developer

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: LoD

Post by greenman » Wed Mar 03, 2010 9:59 am

i don't say you have to change the texture, it's the mapping of vertices to texels which is a lot of work (called the unwrapping of a model).
i think this could exactly be the problem with the automatic script of ogre. i don't know how this is with the manual approach but with the automatic one there doesn't seems to be any information about this mapping in the mesh for lower lod versions that the topmost one. in fact there only seems to be information about faces ?! i guess thats why these models look so ugly with automatic reduction (reduction of faced in the wrong place and the there's some glitches with the texture that rapidly changes colour not the way it's supposed to)

i think we should do manual lod for important/complex models like assff, ghost, transporter and use the ogre script for simple models like asteroids or planets

edit: the script i was talking about wasn't made by blender but by ogre
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: LoD

Post by greenman » Wed Mar 03, 2010 11:09 am

found an ogre/cegui mesh viewer which also has lod functionality
http://www.ogre3d.org/wiki/index.php/CEGUI_Mesh_Viewer
unfortunately there only seem to be windows binaries (the source package only contains binaries)
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: LoD

Post by x3n » Wed Mar 03, 2010 12:36 pm

greenman wrote:
i don't say you have to change the texture, it's the mapping of vertices to texels which is a lot of work (called the unwrapping of a model).
i think this could exactly be the problem with the automatic script of blender. i don't know how this is with the manual approach but with the automatic one there doesn't seems to be any information about this mapping in the mesh for lower lod versions that the topmost one. in fact there only seems to be information about faces ?! i guess thats why these models look so ugly with automatic reduction (reduction of faced in the wrong place and the there's some glitches with the texture that rapidly changes colour not the way it's supposed to)

i think we should do manual lod for important/complex models like assff, ghost, transporter and use the ogre script for simple models like asteroids or planets
i think you misunderstood my post. i'm not talking about automatic vertex reduction in _Blender_, i say we should do that automatically in _Orxonox_. i've seen a directX sample many years ago that showed a detailed mesh and a slide-bar. with the slider i could change the level of detail of the mesh in realtime. i searched for this demo and i still have it on my computer, but i didn't find a good demo/video in the internet. however there are other sources like this: http://www.cs.ucl.ac.uk/research/equato ... oc19330250
Fabian 'x3n' Landau, Orxonox developer

User avatar
greenman
Baron Vladimir Harkonnen
Posts: 360
Joined: Wed Oct 03, 2007 2:53 pm
Contact:

Re: LoD

Post by greenman » Wed Mar 03, 2010 1:22 pm

i made en error above: talked about a blender convert script, but it's actually an ogre one

are you talking about orxonox opening the mesh file and then changing the data in it or using ogres (very simple) internal mechanisms to generate LoDs just based on percentage or absolute number of reduced faces?
There are only 10 types of people in the world: Those who understand binary, and those who don't.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: LoD

Post by x3n » Wed Mar 03, 2010 1:59 pm

i'm talking about a pice of code which calculates simplified versions of models, probably when the model is loaded first. if Ogre has such a feature we'll use that, if it doesn't we'll have to implement it ourself.

i don't wan't to do anything in blender, i don't want to run a script and i don't want to edit mesh files, i want everything to work automatically.

designer creates high poly mesh -> orxonox loads mesh -> mesh is displayed with a reasonable amount of faces, based on LoD and distance

as you may remember, we usually have a lot more coders than designers, so it seems to be a good idea to automate boring tasks.
Fabian 'x3n' Landau, Orxonox developer

User avatar
beni
Baron Vladimir Harkonnen
Posts: 949
Joined: Tue Oct 03, 2006 9:15 am
Location: Zurich
Contact:

Re: LoD

Post by beni » Thu Mar 04, 2010 1:14 am

I like x3n's idea, but I worry, that it is not so easy to establish. I think it makes a lot of sense to look at the source of the Ogre lod-function to see what we can copy from there or maybe get an idea.
I guess LoD has three main steps:
1) Finding vertices as candidates for removal and remove the best candidates
2) recalculate the new faces with the remaining vertices
3) remap texture on those new faces

This seems quite difficult, but I have to agree with x3n, that such works are less boring and in my opinion have more to do with the BIWI. After all it's a PPS at the D-ITET for EE students and while we do encourage creative work, it's still mainly a project that involves coding.
"I'm Commander Shepard and this is my favorite forum on the internet."

User avatar
lieni
Noxonian Reg'metholt
Posts: 56
Joined: Tue Oct 31, 2006 4:35 pm
Location: Hell
Contact:

Re: LoD

Post by lieni » Sat Mar 06, 2010 12:33 pm

http://www.agg.ethz.ch/education/course ... urse_notes (cool course btw. for those still lacking credits, it's a new lecturer though since this semester).

Lectures packs 7 and 8 should be relevant.
Error quadrics should give you the candidates for collapsing.

I wouldn't try to reinvent the wheel and implement everything again. Either find a mesh format that already supports progressive meshes and make it work with Ogre or even better use Ogre own progressive meshes: http://www.ogre3d.org/docs/api/html/cla ... eMesh.html
In their features section they promise support for "Progressive meshes (LOD), manual or automatically generated". Especially the 'automatically generated' sounds promising since you don't wanna reedit all your existing meshes.
Haven't found a demo or example for that yet though.

Sorry if I just repeated something already said, didn't read all and everything in detail :-)
The secret to creativity is knowing how to hide your sources.

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: LoD

Post by x3n » Wed Mar 10, 2010 11:22 pm

yeah, progressive mesh is exactly what i was talking about. it's good to see ogre has built in support for that. should make things a lot easier :)
Fabian 'x3n' Landau, Orxonox developer

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest