Myrddin Landscape Plugin Demo 2

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: licensing

Post by syedhs »

myrddinson wrote:Well, for now, i am planning to release both LGPL and commercial plugin licenses in about one to two months; LGPL license will include plugin documentation and C++ sources but not the shaders sources. Commercial license will include all sources.
What about editor - are you going to release it as well?

Edit: I mean source code, or at least have a plugin infra around it so that customization is possible.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland
x 5

Re: firewall

Post by reptor »

myrddinson wrote:Well, i tried the download link but my firewall - Kerio - did not complain about suspicious TCP intrusion - Kerio is set to block all TCP incoming.
I scanned the downloaded file for virus or malwares and did not find anything too so for now and if nobody else encounters troubles, plugin will stay at that place...
I didn't say that your file has a virus in it.

The website had (maybe still has).

I didn't download your file because the malware attacked me before I got to that.

The URL img3.free.fr tells where the attack came from.
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

editor

Post by myrddinson »

The editor will be released later: not before june 2009 now i think because it is still at 20% - and i cannot work at full time on it...

But as the plugin will be released soon, you will be able to build your own editor around if you cannot wait for the official editor ;) - plugin will include editor features yet like heightmap/splatting mask/lightmap/colormap painting.
sarmadm
Halfling
Posts: 57
Joined: Thu Feb 07, 2008 8:39 am

Post by sarmadm »

Can anybody tell me how we can use this plugin for our own app
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

I can't run the demo on Vista32. Game.exe stops without error message or logs...
Image
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

Vista

Post by myrddinson »

you can download patch for Vista here:
http://dl.free.fr/qOymMksKS

just overwrite MyrddinLandscapeDemo2 files with new ones.
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

Launch demo

Post by myrddinson »

And you need to launch start.bat - or one of the other *.bat -, not game.exe (see readme.txt).
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

it works, thanks ! and... wow !
Image
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

brief user doc

Post by myrddinson »

To use the plugin in your own app:

plugin binary is compiled for ogre 1.4.6 so it should be compatible with 1.4.6+ but not with Ogre 1.5.0 dlls.

first declare in your 'plugins.cfg':

#Myrddin landscape plugin
Plugin=Plugin_LandscapeSceneManager

#encrypted/zip-compressed library plugin
Plugin=PLugin_ZPK

copy all 'Datas' directory in your own app directory
copy following dll in your app directory: QuickGUI.dll (plugin internally uses abstract GUI wrapper to bind controls with plugin settings)

and add following lines in your 'resources.cfg':

[General]
# plugin common resources
FileSystem=./Datas
FileSystem=./Datas/fonts
FileSystem=./Datas/materials/programs
FileSystem=./Datas/materials/scripts
FileSystem=./Datas/materials/textures
FileSystem=./Datas/models
FileSystem=./Datas/gui/default

# plugin terrain common resources
FileSystem=./Datas/terrain/materials/scripts
FileSystem=./Datas/terrain/materials/textures/splatting
FileSystem=./Datas/terrain/materials/textures/sky
FileSystem=./Datas/terrain/materials/textures/water
Zip=./Datas/terrain/materials/textures/water/WaterCaustic.zip
Zpk=./Datas/terrain/materials/shaders.zpk


#one resource group per terrain data (heightmap+splatting masks+lightmaps+colormaps)
[land2]
FileSystem=./Datas/terrain/land2

now in your app, you can call InitializeAllResourceGroups() to initialize resources groups declared in 'resources.cfg'
or manually initialize them if you prefer.

now the app code: you can initialize and use plugin like any other ogre scene manager plugin;
for instance, here is sample of code picked from the demo - sorry only C# ;)

Code: Select all

	protected override void ChooseSceneManager()
	{
		// get the landscape scene manager
		sceneMgr = root.CreateSceneManager(SceneType.ST_EXTERIOR_FAR, "LandSceneManager"); //here only SceneType.ST_EXTERIOR_FAR is important:
																						   //note that Myrddin plugin will be selected only if 
																						   //you use ST_EXTERIOR_* constants
	}


    protected override void CreateScene()
    {
        camera.AspectRatio = ((float)viewport.ActualWidth) / ((float)viewport.ActualHeight);

        //load terrain geometry from config file
        {
            GameSystem.GameGUI.LoadingBar loadingBar = new GameSystem.GameGUI.LoadingBar();

            loadingBar.Start(window, 0, 1, 0.0F);

            StringBuilder sLevelFileName = new StringBuilder(NameLevel);
            sLevelFileName.Append(".xml");
            ResourceGroupManager.Singleton.WorldResourceGroupName = NameLevel;
            ResourceGroupManager.Singleton.LinkWorldGeometryToResourceGroup(NameLevel,sLevelFileName.ToString(),sceneMgr);
            ResourceGroupManager.Singleton.LoadResourceGroup(NameLevel);

            loadingBar.Finish();
        }
        //! or you can use sceneMgr.SetWorldGeometry( NameLevel+".xml" );

        //get sun light
        if (sceneMgr.HasLight("Sun"))
            mLightSun = sceneMgr.GetLight("Sun");
        else
        {
            mLightSun = sceneMgr.CreateLight("Sun");
            mLightSun.DiffuseColour = new ColourValue(1.0f, 1.0f, 1.0f);
            mLightSun.SpecularColour = new ColourValue(1.0f, 1.0f, 1.0f);
            mLightSun.Type = Light.LightTypes.LT_DIRECTIONAL;
            mLightSun.CastShadows = true;
        }

        //create point light
        if (sceneMgr.HasLight("Cursor"))
            mLightCursor = sceneMgr.GetLight("Cursor");
        else
        {
            mLightCursor = sceneMgr.CreateLight("Cursor");
            mLightCursor.DiffuseColour = new ColourValue(0.2f, 1.0f, 0.2f);
            mLightCursor.SpecularColour = new ColourValue(1.0f, 1.0f, 1.0f);
            mLightCursor.Type = Light.LightTypes.LT_POINT;
            mLightCursor.SetAttenuation(2000.0f, 0.0f, 0.0f, 0.00001f);
            mLightCursor.CastShadows = false;
            mLightCursor.Visible = true;
        }

        //create spot light
        if (sceneMgr.HasLight("TorchLamp"))
            mLightSpot = sceneMgr.GetLight("TorchLamp");
        else
        {
            mLightSpot = sceneMgr.CreateLight("TorchLamp");
            mLightSpot.DiffuseColour = new ColourValue(1.0f, 1.0f, 0.2f);
            mLightSpot.SpecularColour = new ColourValue(0.2f, 0.2f, 0.2f);
            mLightSpot.Type = Light.LightTypes.LT_SPOTLIGHT;
            mLightSpot.Position = camera.Position;
            Vector3 dir = camera.Direction;
            dir.Normalise();
            mLightSpot.SetAttenuation(2000.0f, 0.0f, 0.0f, 0.000001f);
            mLightSpot.Direction = dir;
            mLightSpot.SetSpotlightRange(new Radian(new Degree(45.0f)), new Radian(new Degree(70.0f)), 2.0f);
            mLightSpot.CastShadows = false;
            mLightSpot.Visible = true;
        }


        //create landscape camera ray scene query
        mRsqWorldGeometry = sceneMgr.CreateRayQuery(new Ray(camera.Position, Vector3.NEGATIVE_UNIT_Y));
        mRsqWorldGeometry.SetSortByDistance(true);
        mRsqWorldGeometry.QueryTypeMask = SceneManager.WORLD_GEOMETRY_TYPE_MASK;


        //create cursor ray scene query
        mRsqCursor = sceneMgr.CreateRayQuery(new Ray(camera.Position, camera.Direction));
        mRsqCursor.SetSortByDistance(true);
        mRsqCursor.QueryTypeMask = (uint)SceneManager.WORLD_GEOMETRY_TYPE_MASK | SceneManager.ENTITY_TYPE_MASK;

    }

    /// <summary>
    /// get world gometry y coordinate at x and z coordinates
    /// </summary>
    /// <param name="x">x world coordinate</param>
    /// <param name="z">z world coordinate</param>
    protected float GetHeightAt(float x, float z)
    {
        mRsqWorldGeometry.Ray = new Ray(new Vector3(x, 10000, z), Vector3.NEGATIVE_UNIT_Y); //note that axis y ray casts are faster than 
																							//generic ray casts because implemented as heightmap direct read
        mRsqWorldGeometry.Execute();
        RaySceneQueryResult result = mRsqWorldGeometry.GetLastResults();
        if ((!result.IsEmpty) && result.Front.worldFragment != null)
        {
            if (result.Front.worldFragment.fragmentType == SceneQuery.WorldFragmentType.WFT_SINGLE_INTERSECTION)
            {
                return result.Front.worldFragment.singleIntersection.y; //note that normal is stored in
																		//result.Front.worldFragment.planes.Back.normal
            }
        }
        return 0.0f;
    }
if you want to apply dynamic fog to your own objects, you need to add dynamic fog pass to object material
look at this code:

Code: Select all

    Entity ent = sceneMgr.CreateEntity("column", "column.mesh"); 
    bool bDynamicFog = false;
    sceneMgr.GetOption("ALSIsDynamicFogEnabled", out bDynamicFog); //you can use sceneMgr.SetOption("ALSEnableDynamicFog",true) to enable/disable dynamic fog
    if (bDynamicFog)
    {
        string matName = ent.GetSubEntity(0).MaterialName;
        sceneMgr.SetOption("ALSAddDynamicFogPass", matName); //this will add dynamic fog pass at the end of all material techniques
															 //note that that works only if material uses vertex/fragment programs yet
															 //and as dynamic fog pass is generated using highest shader version (up to vs_3_0/ps_3_0),
															 //entity material shaders need to use same version too.
    }
full user doc will be included with LGPL and commercial plugin version so please be patient...
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

plugin user doc

Post by myrddinson »

and of course you need to copy Plugin_LandscapeSceneManager.dll and PLugin_ZPK.dll in your own app directory ;)
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

I am trying to integrate my own terrain with Myrddin.

I don't understand what is the raw files in terrain/land2 folder like this one :
Image

It seems to be the heightmaps but how do you make them ? Do you use L3DT ?
Image
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

heightmap encoding

Post by myrddinson »

yes, the raw files in land2 directory are terrain heightmaps:
plugin heightmap raws must be 16bits little-endian encoded and must be square with width = height = (2^n)+1 (n>= 5) because sibling pages share common border.
To generate heightmaps for the demo, i have generated 2048/2048 seamless heightmap with L3DT and used plugin built-in splitting method to split big heightmap in 8x8 257x257 heightmaps (because L3DT cannot generate odd size mosaic).

Well, user doc is not ready yet but here is how to use built-in splitting method to generate plugin-compatible 8x8 mosaic heightmap from a 2048x2048 seamless heightmap generated with L3DT (free version):

Code: Select all

//GenerateMosaic command:
//SetOption param1 :must be equal to "GenerateMosaic"
//SetOption param2 :must be a string that contain string-encoded GenerateMosaic command parameters in this order (only the 4 first params are necessary):
//		 param1: heightmap source full path
//		 param2: destination full path
//		 param3: destination heightmap(s) base name + extension = '[base name]_hm.raw' 
//		 param4: desired size of generated mosaic in pages (by world side): 
//				 if 1, no splitting is done but source heightmap is still normalized before copy to destination 
//				 (so that destination heightmap width/height is (2^n)+1) 
//		 param5: true if heightmap source is seamless, false otherwise (optional: default is false)
//		 param6: gaussian blur deviation (optional: default is 0.6)
//		 param7: gaussian blur radius (optional: default is 0)		 
//		 					
//		 the last two parameters apply a optional blur filtering on the heightmap source after normalization but before splitting (if param7 - blur radius - is 0, no blur is applied)

//example:
//sceneMgr.SetOption("GenerateMosaic", "c:\\test\\hm2048.raw c::\\test\\dest land_hm.raw 8 true 0.6 3");
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

Thanks!

Raaa now i get this error :

Code: Select all

15:31:29: OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library Plugin_LandscapeSceneManager.  System Error: La procédure spécifiée est introuvable.

 in DynLib::load at f:\ogre_cvs_vc9\ogrenew_146\ogremain\src\ogredynlib.cpp (line 80)
Edit : i think it is because i use Ogre 1.4.7...
Image
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

Doesn't work either in Ogre 1.4.6 :(

Are you sure you use 1.4.6 ? The Ogremain.dll file size from my SDK 1.4.6 doesn't match with the Ogremain.dll file in your Myrddin demo...

Edit : The procedure not found seems to be : "_Init_CLRObject@PlaneBoundedVolumeListSceneQuery".
Image
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

plugin

Post by myrddinson »

well actually ogremain.dll that i use in the demo is C++/CLI dll (compiled from ogremain modified sources that are included in MOgre 1.4.6 release) so it is normal because i need to use C++/CLI ogremain.dll with MOgre and demo C# code.
But plugin itself is compiled as pure C++ so it should work with Ogre 1.4.6 dlls: strange indeed i will fix that...
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

plugin compatibility

Post by myrddinson »

ok i know the problem now: as lanscape scene manager plugin is compiled using C++/CLI OgreMain modified headers, some of inline methods like Init_CLR are compiled too so i will download Ogre 1.4.6 SDK and compile plugin with standard Ogremain headers: this should fix this issue...
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

:o
Image
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

plugin ogreSDK 1.4.6 dlls

Post by myrddinson »

well you can download OgreSDK 1.4.6 compatible dlls from this link:
http://dl.free.fr/pjYzFKThy

dlls should be compatible with Ogre 1.4.6-1.4.9 because normally interface does not change before 1.6.0...

I have no time now to test myself so please tell me if it is ok ?
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Post by Assaf Raman »

Why don't you use pages.google.com for file links?
Watch out for my OGRE related tweets here.
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

Loading is now OK :

Code: Select all

mRoot->loadPlugin("Plugin_LandscapeSceneManager");
mRoot->loadPlugin("PLugin_ZPK");
mRoot->loadPlugin("Plugin_ParticleFX");
mRoot->loadPlugin("Plugin_CgProgramManager");
But scene creation crashes :

Code: Select all

mSceneManager = Ogre::Root::getSingleton().createSceneManager(Ogre::SceneType::ST_EXTERIOR_FAR, "LandSceneManager");
with only an access violation message :

Code: Select all

Exception non gérée à 0x00fc4b30 dans rndcenter.exe : 0xC0000005: Access violation.
Edit : Could you generate the plugin dlls for Ogre in Debug mode ?
Image
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

plugin dlls

Post by myrddinson »

Have you declared resource groups too before creating scene manager ?
I will upload debug dlls perhaps tonight: sorry but i am at work now ;)

hum google pages do not accept new sign-up now: they are moving google pages to google sites but it is not done yet...
User avatar
thepolo
Gnoblar
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Post by thepolo »

The resources need to be intialized before the scene creation ?

ok, so i did it. Then now, all resources can be initialized except "Shaders.pkz" (access violation message, the pkz plugin loading is passed however).

So ok, i comment the loading of "Shaders.pkz" for the moment, but the scene creation still doesn't work (access violation message).

In my opinion, it still seems to be a dll version problem...
sorry but i am at work now
Hurry ! Slave ! :twisted:
Image
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

plugin dlls

Post by myrddinson »

yes you need to declare resource groups before scene creation (with InitializeAllResourceGroups() or manually)
PLugin needs shaders.zpk too because it contains terrain/sky/water/haze encrypted programs.

I will test plugin myself with ogre C++ app to ensure new dll upload will be OK but this will not be for tonight i guess ;)
User avatar
myrddinson
Greenskin
Posts: 125
Joined: Mon Mar 31, 2008 1:16 pm
Location: France
x 5

C++ plugin dlls

Post by myrddinson »

about resource groups, you do not need to initialize terrain data resource group (for instance 'land2' in the last demo) before calling setWorldGeometry method because plugin ensures world geometry resource group is initialized before loading landscape data; but at least 'bootstrap' and 'general' resource groups needs to be initialized before calling setWorldGeometry.

I just have fixed dlls for Ogre C++ 1.4.6; i have tested the plugin with the sdk terrain demo - slightly modified - and it works well... Too late now to prepare the upload: i will upload tomorrow ;)
sarmadm
Halfling
Posts: 57
Joined: Thu Feb 07, 2008 8:39 am

Post by sarmadm »

thanx a lot bro....this demo is great. keep up the good work
Post Reply