Terrain LOD. Does nothing?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Terrain LOD. Does nothing?

Post by suliman »

Hi
Trying to inrease LOD on my terrain. I try to make all terrain highest detail (its LOD=0 right?). I try the code below, try some other combinations but nothing seems to effect the way the terrain lowers quality at some distances... I see many posts on this and people are confused. The API doesnt explain this really...

www.terrain->overrideLODDistance(0,20000);
www.terrain->overrideLODDistance(1,21000);
www.terrain->overrideLODDistance(2,22000);
www.terrain->overrideLODDistance(3,23000);
www.terrain->overrideLODDistance(4,24000);

see a screenshot:
Image
upload
rcalvin
Posts: 31
Joined: Tue Jan 08, 2013 1:58 am

Re: Terrain LOD. Does nothing?

Post by rcalvin »

I'm not positive this is the case, but I think what you are looking to do is alter the mipmap settings. I'd guess the function you are currently using is for the terrain mesh lod, which alters the number of polygons comprising the terrain based on distance from the camera. I'm not sure how its done off the top of my head, but I guess that mipmapping is either set as a material flag or maybe a driver property, you'll have to look it up.
polylux
Posts: 267
Joined: Thu Aug 27, 2009 12:39 pm
Location: EU

Re: Terrain LOD. Does nothing?

Post by polylux »

Same here. From your explanations I guess you talk about texture - not geometry - settings.
beer->setMotivationCallback(this);
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Terrain LOD. Does nothing?

Post by hendu »

That's about texture filtering as the others said. Enable aniso to get rid of it.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Terrain LOD. Does nothing?

Post by suliman »

Ok cool i found this in the API:

u8 irr::video::SMaterialLayer::AnisotropicFilter

Is this what i need? But there is no example on what im supposed to do with it in the API. Could someone help me with that? I create the material like this if it helps:

Code: Select all

    // create materials
    video::IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices();
    s32 newMaterialType = 0;        
    if (gpu)
    {
            MyShaderCallBack* mc = new MyShaderCallBack();
            // create the shaders depending on if the user wanted high level
            // or low level shaders:
            if (UseHighLevelShaders)
            {
                    // create material from high level shaders (hlsl or glsl)
                    newMaterialType = gpu->addHighLevelShaderMaterialFromFiles(
                            vsFileName, "vs_main", video::EVST_VS_2_0,
                            psFileName, "ps_main", video::EPST_PS_2_0,
                            mc, video::EMT_DETAIL_MAP);                        
            }                
            mc->drop();
    }
 
//and then...
 
    irr::video::ITexture * tex = driver->getTexture("gfx/terrain/base.png");
    www.terrain->setMaterialTexture(0,tex);
    www.terrain->setMaterialTexture(1,driver->getTexture("gfx/terrain/tex1.jpg"));
    www.terrain->setMaterialTexture(2,driver->getTexture("gfx/terrain/tex2.jpg"));
    www.terrain->setMaterialTexture(3,driver->getTexture("gfx/terrain/tex3.JPG"));
    www.terrain->setMaterialType((video::E_MATERIAL_TYPE)newMaterialType);          
 
 
 
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Terrain LOD. Does nothing?

Post by hybrid »

do terrain->getMaterial(0) and set AnisotropicFiltering=true
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Terrain LOD. Does nothing?

Post by suliman »

I try many combinations like

terrain->getMaterial(0).setFlag(AnisotropicFilter,true);
terrain->getMaterial(0).AnisotropicFilter=true;
terrain->getMaterial(0).AnisotropicFiltering=true;


Buts its hard to find out the syntax by trial and error. The API does say there is something called AnisotropicFilter as an attribute to SMaterialLayer but not how to change it.
Thanks for your help
Erik
polylux
Posts: 267
Joined: Thu Aug 27, 2009 12:39 pm
Location: EU

Re: Terrain LOD. Does nothing?

Post by polylux »

Trial and error? Irrlicht is wonderfully documented. Look here and set these to your likings.
beer->setMotivationCallback(this);
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Terrain LOD. Does nothing?

Post by suliman »

thanks guys.
But then i shouldnt use getMaterial(0) it seems. For anyone else new to this, the correct solution i found to solve the above problem is (and doesnt seem to lower my fps at all by the way):

www.terrain->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER , true);

I dont mean to be a whiner but the documentation is far from wonderful if you are new to 3d programming. If you already know all the concepts of 3d graphics then i guess its adequate. But irrlicht says its easy to use for beginners, and the API mostly lists what functions there is, sometimes defaults is written sometimes not, but that's pretty much is. A good manual would have some examples and explain a bit what its good for and what alternatives there is. HGE (a 2d engine) does this wonderfully. Maybe that engine is truely aimed to beginners but i never have to ask in those forums since everything is explained in the documentation, and relevant links to alternatives is always found.

Many questions on the irrlicht forums seem to be about basic stuff, but not in the tutorials (which themselves i dont compain about). And for beginners to 3D programming the API is quite intimidating (huge lists with a lot of new concepts that are not explained and no examples). I understand building a more complete manual would be a lot of work though, but the engine is many years running now.
rcalvin
Posts: 31
Joined: Tue Jan 08, 2013 1:58 am

Re: Terrain LOD. Does nothing?

Post by rcalvin »

Irrlicht is significantly more complex than HGE. You are right, I think, in saying that the manual is not so good for people who are not familiar with many of the concepts of 3D programming. However, I think you are underestimating the scope of what you suggest. The manual is not, I think, meant to teach about 3D programming, it is rather meant to instruct on how to accomplish certain tasks within the context of the Irrlicht engine. If there were articles explaining how to do every little thing, the docs would be ridiculously huge. I think the more realistic approach is to ask the usrrs to bring some knowledge of what they want to do with them when they approach the docs. Whether that means asking questions on the forum or spending an afternoon on Google, I think it has to ne expected that the user will look for information on concepts elsewhere.

Irrlicht is very easy to use, in the context of 3D rendering engines. That doesn't necessarily mean that it's easy!
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Terrain LOD. Does nothing?

Post by suliman »

true. But often when i ask something i dont understand im (sometimes rudely) refered to the API, which often feels like its just listing all functions. And not in a very sorted/intuitive way either. I mean if i open the files all the functions are right there also...

Im not saying someone owe me this, im just saying its far from perfect or newbie friendly.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Terrain LOD. Does nothing?

Post by hybrid »

In case you use the setMaterialFlag, you set the flag for all materials. If you get only a dedicated material, you can set the flag more detailed. In this case, it's all the same.
We have a huge number of examples. They are also linked in the API docs, but are also available directly in source code in the SDK. If you work through these examples, you will learn a lot about the API and also about the concepts of 3d programming. And also about the material settings.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Terrain LOD. Does nothing?

Post by hendu »

There's the book for those looking for more detailed docs.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Terrain LOD. Does nothing?

Post by suliman »

Oh i missed where are the examples of usage? I know about the 10 or so tutorials but you mean there is others?
Where are they linked in the API? I mean on a page like this:

http://irrlicht.sourceforge.net/docu/cl ... _node.html

Are there any links there to the examples when you wonder about a specific function or attribute? Or did i misunderstand?
Erik
rcalvin
Posts: 31
Joined: Tue Jan 08, 2013 1:58 am

Re: Terrain LOD. Does nothing?

Post by rcalvin »

There are in fact 23 tutorials on the homepage, the very first of which demonstrates how to set material flags =D

There are 26 tutorials (including the 23) linked in the docs under related pages.
Post Reply