Google

Myrddin Landscape Plugin SDK

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!

Moderators: OGRE Team, Moderators

Re: Myrddin Landscape Plugin SDK

Postby thepolo » Sun Aug 02, 2009 11:48 am

Hello !
I have a problem with the paging. I have made a new terrain with L3DT 2048*2048 and export the heighfield in raw format. So, i used this command to split the heighfield :

Code: Select all
String split = "C:\\test\\map02.raw C:\\test\\out landsample_hm.raw 8 true 0.6 3";
getSceneManager()->setOption("ToolGenerateMosaic", &split);


So ok, i get my 64 splitted pictures. Now i launch the game with the same landsample.xml file and i get this :

Image

It is like the pages were not in the good order. Any idea ?
Thanks in advance and gg for the good work !
Image
User avatar
thepolo
Newcomer
 
Posts: 24
Joined: Sat Mar 01, 2008 2:48 am
Location: France

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Tue Aug 04, 2009 2:50 pm

Hi guys,

to Oskee: yes you are right: if the terrain material is white, it is because HLSL shaders failed to compile: i cannot help you without more info so please can you send me the ogre.log file in debug mode because shader compilation errors should be logged if any ?

to thepolo: if you use the default landsample.xml config file, you need to generate SEAMLESS terrain with L3DT otherwise as seamless status is enabled in landsample.xml you will have strange artifacts like the one on your photo on terrain borders: if you have generated a not seamless terrain with L3DT you should disable seamless status in landsample.xml by setting both attributes WorldMap/Paging@WorldWidthSeamless and WorldMap/Paging@WorldHeightSeamless to "0".
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Tue Aug 04, 2009 3:11 pm

Hi,

to Razumihin:
well i think i will need to integrate myself Hydrax with MLP in order to solve your issue: i will try to spare time on it...

And it is not possible for MLP to automatically sample the splatting textures depending on the height of the vertexs: only the slope layer can be automatically sampled with the ground layer using the face normal if auto ground/slope splatting is enabled but you need to paint the other layers or make manually the splatting masks. What you could do is to generate by custom code the splatting masks from the heightmaps depending on the height (and ideally you should disable auto ground/slope splatting and take account the normal while generating the splatting masks in order to use different layers for ground/slope - like the default layers which are used when auto ground/slope splatting is enabled).
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby oskEE » Tue Aug 04, 2009 5:14 pm

Ok, so here's the Ogre.log file, or at least the part related to MLP initialization:
Code: Select all
18:16:14: Parsing scripts for resource group MLP
18:16:14: Parsing script ambientOneTexture.program
18:16:14: Parsing script StdQuad_vp.program
18:16:14: Parsing script CursorBrushPaint.material
18:16:14: Parsing script Objects.material
18:16:14: Parsing script bloom.material
18:16:14: Parsing script DepthShadowmap.material
18:16:14: Parsing script hdr.material
18:16:15: Parsing script LandscapeSplattingDepthShadowMapIntegrated.material
18:16:15: Parsing script LandscapeSplattingFogWaterCausticEffect.material
18:16:15: Parsing script Sky.material
18:16:15: Parsing script bloom.compositor
18:16:15: Parsing script HDR.compositor
18:16:15: Finished parsing scripts for resource group MLP
18:16:15: Parsing scripts for resource group land2
18:16:15: Finished parsing scripts for resource group land2
18:16:15: Texture: lm_null.png: Loading 1 faces(PF_A8R8G8B8,1x1x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1x1x1.
18:16:15: Texture: cm_null.png: Loading 1 faces(PF_A8R8G8B8,1x1x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1x1x1.
18:16:15: Texture: m0_null.png: Loading 1 faces(PF_A8R8G8B8,1x1x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1x1x1.
18:16:15: Texture: m1_null.png: Loading 1 faces(PF_A8R8G8B8,1x1x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1x1x1.
18:16:15: TerrainSceneManager: Registered a new PageSource for type Heightmap
18:16:15: Initialising resource group land2
18:16:15: Texture: WaterRR_N.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) with  hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x512x1.
18:16:15: Texture: WaterFLinear.png: Loading 1 faces(PF_A8R8G8B8,256x1x1) with  hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x1x1.
18:16:15: MaterialSerializer : writing material Landscape/Water0 to queue.
18:16:15: MaterialSerializer : parsing texture layer.
18:16:15: MaterialSerializer : parsing texture layer.
18:16:15: MaterialSerializer : parsing texture layer.
18:16:15: MaterialSerializer : parsing texture layer.
18:16:15: MaterialSerializer : done.
18:16:15: MaterialSerializer : writing material(s) to material script : water0.material
18:16:15: MaterialSerializer : done.
18:16:15: TerrainSceneManager: Activated PageSource Heightmap
18:16:38: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:38: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:38: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:38: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)
18:16:39: OGRE EXCEPTION(2:InvalidParametersException): Parameter called iRanges does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at e:\flying samurai 3rdparty\ogre_1.6\ogremain\src\ogregpuprogram.cpp (line 1097)


This isn't much of a valuable information for you, I'm afraid. For what I've been able to debug out of it, those exceptions (or at least first of them) occur during the setWorldGeometry call inside a page creation/setup stage. The name of the (apparently generated) material seems to be "TileMat/0:5:0:0"; the exception occurs during its technique creation. What represents the "iRanges" parameter, I don't have a clue.

EDIT: Nevermind myrddinson, I've already solved the problem. :wink:
Last edited by oskEE on Mon Aug 10, 2009 11:25 am, edited 1 time in total.
Core 2 Duo @ 1.86 GHz / GeForce 8800GT 512 MB / Windows 7 (64bit)
User avatar
oskEE
Newcomer
 
Posts: 14
Joined: Tue Mar 31, 2009 1:31 pm
Location: Prague, Czech Republic

Re: Myrddin Landscape Plugin SDK

Postby KoudyDevCZ » Wed Aug 05, 2009 8:03 am

Hello,

I have a problem with splating mask... I make RGBA png image as splating mask for sample data (landsample_sm0_0_0.png), but in game is visible only auto slope layer... why?
KoudyDevCZ
Newcomer
 
Posts: 4
Joined: Wed Jul 15, 2009 11:07 am
Location: Hradec Králové, Czech Republic

Re: Myrddin Landscape Plugin SDK

Postby Razumihin » Fri Aug 07, 2009 1:49 pm

Hi! Yes, I will make those splatting masks myself. Do you have any kind of sample how to assing textures to the terrain geometry? I'll keep reading but example might make things easier to understand for many people.
Razumihin
Newcomer
 
Posts: 19
Joined: Thu Jul 30, 2009 11:35 am

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Mon Aug 10, 2009 12:39 pm

Hi guys,

to oskEE: did you need to modify the sources to solve the issue ? In this case, it could be useful to post the bug fix.

to KoudyDevCZ: it is because you need to define the page material too for page 0, 0 to ref the layer materials otherwise material manager cannot know what layers you use: see new chapter for Page Materials in the last user doc (v0.93)

to Razumihin: you can find all info you need in user doc 0.93: read "terrain splatting", "config file settings" and "terrain data files" chapters.
But i will modify sources in the next release so that plugin will automatically generate packed splatting mask(s) from the intermediary alpha-blend splattings masks if the packed splatting masks are not present - and only if TSM_EDIT is defined: it means that in the next release, if you want to import your own splatting masks, you will just need to store in the terrain resources directory the alpha-blend layer mask(s) (one per used page layer) and define the page material for any page which uses more than 2 or 1 layers (depending on the auto ground/slope splatting status) and plugin will gracefully build the packed splatting masks.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby Razumihin » Tue Aug 11, 2009 12:31 pm

Yes that sound really user friendly, getting used to the new interface using docs is always pretty slow. But yes i got it working.
Razumihin
Newcomer
 
Posts: 19
Joined: Thu Jul 30, 2009 11:35 am

Re: Myrddin Landscape Plugin SDK

Postby oskEE » Fri Aug 21, 2009 1:32 pm

oskEE wrote:EDIT: Nevermind myrddinson, I've already solved the problem.

myrddinson wrote:to oskEE: did you need to modify the sources to solve the issue ? In this case, it could be useful to post the bug fix.

No, I didn't have to. The problem was in the shaders.zpk file - apparently, the one I was trying to load was either corrupted or old, I can't say that. When I re-downloaded the Data package from your online repository and overwritten the file, the problem disappeared. Mea culpa...
Core 2 Duo @ 1.86 GHz / GeForce 8800GT 512 MB / Windows 7 (64bit)
User avatar
oskEE
Newcomer
 
Posts: 14
Joined: Tue Mar 31, 2009 1:31 pm
Location: Prague, Czech Republic

Re: Myrddin Landscape Plugin SDK

Postby Razumihin » Tue Aug 25, 2009 7:58 am

As a suggestion to next version:

It would be nice to be able to specify Pagematerials/Material so that there would be start x, end x, start z, end z possibility, so that if i use the same layer configuration for example in 16x16 grid i wouldn't have to duplicate it 256 times :) If i have spare time i might look into this myself.
Razumihin
Newcomer
 
Posts: 19
Joined: Thu Jul 30, 2009 11:35 am

Re: Myrddin Landscape Plugin SDK

Postby oskEE » Mon Aug 31, 2009 11:35 am

Hi myrddinson,
I have a few questions for today :wink:

1) Is it possible to turn off the clouds somehow, other than specifying an empty clouds texture? I'm aware that this may be a RTM question, but I wasn't able to find the information in the documentation.
The reason why I need this may possibly interest you - I'm using a very large terrain (few hundreds km^2) and when being far from the origin, the whole cloud plane starts to shake very disturbingly, obviously due to numerical inaccuracy of float. So I have to resort to turn the cloud layer off.

2) I wonder if there exists any reason for requirement on PageSizeWorld being 2^n. I clearly understand why the resolution of texture tiles must be 2^n+1, but it seems to me that it's not essential for their world size to follow the power-of-two rule. I'm asking because I would need to set the terrain size differently than I can achieve with this limitation.

3) I'm having problems with rendering billboards/ribbon trails when the skyplane is a background. See this picture (and please ingnore the reversed aircraft direction :) ):
Image
Both the billboard and the ribbon trail are cut at the line where the sky plane starts and are completely non-visible, as you can see.
The relevant technique settings for flare billboard are:
Code: Select all
scene_blend add
depth_write off

and for ribbon trail:
Code: Select all
scene_blend colour_blend
depth_write off

The settings for she sky techniques are you default ones, but I get the same results when I substitute all "scene_blend modulate" with "scene_blend add" (I have pretty much tried all combinations of the relevant settings, but the results were never correct). As you can see, rendering over the terrain background is correct.

4) The last one :) I'd like to know if there is any possibility of generating the alpha-splatting maps procedurally. For example, let's say I have the vector data for roads on the terrain but I don't want to store these alpha maps on the HDD because they would waste much space considering that the non-black pixels representing the road layer would be very sparse (considering how sparse are roads in the contryside :wink: ). So instead of storing the data I would provide the correct alpha map to the manager as requested.
I understand this is a vague and possibly strange question, so I don't expect you to be exact either :) .

I know this is many questions, so thanks in advance for your help.
Regards,
oskEE
Core 2 Duo @ 1.86 GHz / GeForce 8800GT 512 MB / Windows 7 (64bit)
User avatar
oskEE
Newcomer
 
Posts: 14
Joined: Tue Mar 31, 2009 1:31 pm
Location: Prague, Czech Republic

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sun Sep 06, 2009 11:14 am

Hi guys,

sorry to reply so late but forum still do not notify me when new messages are posted ;(

It would be nice to be able to specify Pagematerials/Material so that there would be start x, end x, start z, end z possibility, so that if i use the same layer configuration for example in 16x16 grid i wouldn't have to duplicate it 256 times If i have spare time i might look into this myself.


Yes Razumihin this would be a good improvment: i will implement it for the next release.

1) Is it possible to turn off the clouds somehow, other than specifying an empty clouds texture? I'm aware that this may be a RTM question, but I wasn't able to find the information in the documentation.
The reason why I need this may possibly interest you - I'm using a very large terrain (few hundreds km^2) and when being far from the origin, the whole cloud plane starts to shake very disturbingly, obviously due to numerical inaccuracy of float. So I have to resort to turn the cloud layer off.


you can set clouds transparency to 0 to turn off the clouds: for the bug float inaccuracy bug, i will investigate that (very strange really because normally sky quad is rendered is screen space): Thanks for reporting it.

2) I wonder if there exists any reason for requirement on PageSizeWorld being 2^n. I clearly understand why the resolution of texture tiles must be 2^n+1, but it seems to me that it's not essential for their world size to follow the power-of-two rule. I'm asking because I would need to set the terrain size differently than I can achieve with this limitation.


it is a constraint due to the geomipmapping technique: vertex indexs are downsampled with lod distance and as 4 vertexs are downsampled to 1 while switching lod you need a 2^n+1 vertex buffer in order to achieve geo-mipmapping.
So if you want to use tiles of any size, you will need to implement a different mipmapping technique.

3) I'm having problems with rendering billboards/ribbon trails when the skyplane is a background. See this picture (and please ingnore the reversed aircraft direction ):


It is because sky is rendered by default after all scene geometry: Just change sky rendering group:
set /WorldMap/Atmosphere/Sky/@DrawFirst to "true" in landsample.xml and it should work fine (as long as your billboards are rendered after the skydrawfirst render group)
I think i will set this setting to true by default for the next release too to prevent such annoying bug ;)

4) The last one I'd like to know if there is any possibility of generating the alpha-splatting maps procedurally. For example, let's say I have the vector data for roads on the terrain but I don't want to store these alpha maps on the HDD because they would waste much space considering that the non-black pixels representing the road layer would be very sparse (considering how sparse are roads in the contryside ). So instead of storing the data I would provide the correct alpha map to the manager as requested.
I understand this is a vague and possibly strange question, so I don't expect you to be exact either .


You could generate alpha-splatting maps procedurally but for that you will need to modify the SplattingMaterialManager class: you have the sources so it is up to you ;)


Thanks for reporting.

Myrddinson.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby DanielSefton » Sun Sep 06, 2009 2:53 pm

I have a few problems that I've noted as well, but a few of them maybe need videos to explain better.

- On entities the lighting (specular?) seems to flash on and off when you move the camera, or according to it's angle.
- There are lots of single white pixels all over the terrain sometimes, more noticeable when it's flatter. Is this "pixel error"?
- The whole sky shakes when the camera moves, and this gets worse the further away you are from the origin (0,0). When I'm far from the origin it shakes vigorously and it looks ridiculous. This happens in the demo as well, but because the camera moves so slowly you probably didn't notice it. :P
- There are still memory leaks when you destroy the terrain even with the latest 0.93. It racks up an extra 30MB every time you call setWorldGeometry then clearScene.
- It crashes at renderOneFrame if I unload or destroy the resources after clearScene has been called. Why? Does it register itself to the resources when setWorldGeometry is called then they can't be unloaded?

I ported it to Ogre 1.7 and it works great. I noticed that your OctreeSceneManager is kind of outdated, I had to make a few changes in there. Plus when you allocate memory in the Octree the category should be GEOMETRY not GENERAL.

Also, I'm interested to hear your opinion about the new terrain/paging system sinbad is implementing. The best thing about MyRddin is the shaders, I didn't know if in the future you would consider swapping to sinbad's new terrain system? There's nothing more it can do than yours (at the moment), but it's far more efficient and isn't a scene manager. I had a go but struggled to get the atmosphere working without a scene manager. :P

Thanks!
User avatar
DanielSefton
Veteran
 
Posts: 1087
Joined: Fri Oct 26, 2007 12:36 am
Location: East Yorkshire, UK

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sun Sep 06, 2009 4:56 pm

2) I wonder if there exists any reason for requirement on PageSizeWorld being 2^n. I clearly understand why the resolution of texture tiles must be 2^n+1, but it seems to me that it's not essential for their world size to follow the power-of-two rule. I'm asking because I would need to set the terrain size differently than I can achieve with this limitation.


Actually you are - almost - right:

There is a constraint for size of tiles due to the geomipmapping technique: for tiles, vertex indexs are downsampled with lod distance and as 4 vertexs are downsampled to 1 while switching lod you need a 2^n+1 size vertex buffer for tiles in order to achieve geo-mipmapping.

But actually for pages, you are almost right: you should be able at least to define pages with size = m*2^n+1 where m >= 1 and 2^n+1 is size of one tile (so page size just need to be a multiple of tile size) so for instance you should be able to define pages with size = 3*128+1 = 385 if tile size is 129 and not only pages with size 2*128+1 = 257 or 4*128+1 = 513.
Actually, it should be easy to modify the sources to authorize a page size equal to m*2^n+1: i think only the page size checking method needs to be fixed.
I will implement that for the next release.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sun Sep 06, 2009 5:33 pm

Hi,

- On entities the lighting (specular?) seems to flash on and off when you move the camera, or according to it's angle.

Sorry but what do you mean exactly by flashing ? For specular lighting, lighting depends on both light direction and camera to vertex vector so specular lighting actually changes while camera is moving (not while rotating only).

- There are lots of single white pixels all over the terrain sometimes, more noticeable when it's flatter. Is this "pixel error"?

can you please post a screenshot ?

- The whole sky shakes when the camera moves, and this gets worse the further away you are from the origin (0,0). When I'm far from the origin it shakes vigorously and it looks ridiculous. This happens in the demo as well, but because the camera moves so slowly you probably didn't notice it.

yes i know about this issue: i will fix that for the next release.

- There are still memory leaks when you destroy the terrain even with the latest 0.93. It racks up an extra 30MB every time you call setWorldGeometry then clearScene.

I still need to investigate these memory leaks issues: probably there are still some memory resources not allocated and freed properly using new memory management introduced with 1.6.0.

- It crashes at renderOneFrame if I unload or destroy the resources after clearScene has been called. Why? Does it register itself to the resources when setWorldGeometry is called then they can't be unloaded?

Nope plugin does not register to the resources and only world geometry resources are unloaded when you clear the scene: do you have traced in debug where it crashes in order to know about the resource(s) which is buggy ?

I ported it to Ogre 1.7 and it works great. I noticed that your OctreeSceneManager is kind of outdated, I had to make a few changes in there. Plus when you allocate memory in the Octree the category should be GEOMETRY not GENERAL.

Yes the OctreeSceneManager has been ported directly from 1.4.6 version: thanks for the reporting ;)

Also, I'm interested to hear your opinion about the new terrain/paging system sinbad is implementing. The best thing about MyRddin is the shaders, I didn't know if in the future you would consider swapping to sinbad's new terrain system? There's nothing more it can do than yours (at the moment), but it's far more efficient and isn't a scene manager. I had a go but struggled to get the atmosphere working without a scene manager.

sinbad terrain/paging system looks interesting and you are right: i have been focusing more on the shaders and the terrain and sky/haze materials: actually MLP is a extended Ogre TerrainSceneManager with paging support and extended materials. So perhaps i will switch later with better terrain/pagin system but it is not a priority for now.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby DanielSefton » Sun Sep 06, 2009 6:29 pm

Thanks for your reply.

myrddinson wrote:Sorry but what do you mean exactly by flashing ? For specular lighting, lighting depends on both light direction and camera to vertex vector so specular lighting actually changes while camera is moving (not while rotating only).

That must be it then, but one second it has specular and the next second it doesn't. So as the camera moves it flashes on and off. Here's a screenshot:

http://www.tidalware.com/images/extern/myrddin-bug1.jpg

- There are lots of single white pixels all over the terrain sometimes, more noticeable when it's flatter. Is this "pixel error"?

can you please post a screenshot ?

Here: http://www.tidalware.com/images/extern/myrddin-bug2.jpg - Single white pixels scattered about that also appear randomly according to camera movement.

Nope plugin does not register to the resources and only world geometry resources are unloaded when you clear the scene: do you have traced in debug where it crashes in order to know about the resource(s) which is buggy ?

Well it only traced to renderOneFrame, didn't go any further. But if this shouldn't happen, I'll investigate more. It unloads/destroys the resources fine, but when it enters the loop and hits renderOneFrame it crashes.

Also, HDR doesn't support FSSA, right? When I enable HDR and FSAA I get "OGRE_EXCEPTION(3:RenderingAPIException): Unable to create AA render target: Invalid call in D3D9Texture::_createNormTex at ...OgreD3D9Texture.cpp (line 1015)" Not to worry, however, I know CryTek had that issue with their HDR implementation.

EDIT: Also also, setting the Sky's "DrawFirst" option to "true" fixes the depth buffer issue for the sky, but the water is still rendered in front. Is there a similar solution for the water plane?

EDIT 2 Would it be possible to implement a feature that colourises the default fog? I'd like to disable the atmospheric haze for lower end PC's and replace it with EXP2 fog, but you can only apply a single colour. Would be nice if there was an option to automatically manage this like what Caelum does.
Last edited by DanielSefton on Sat Sep 12, 2009 11:30 am, edited 2 times in total.
User avatar
DanielSefton
Veteran
 
Posts: 1087
Joined: Fri Oct 26, 2007 12:36 am
Location: East Yorkshire, UK

Re: Myrddin Landscape Plugin SDK

Postby oskEE » Mon Sep 07, 2009 11:25 pm

Hi Myrddinson, thanks for the answers :D

Ad 1) and 3) - both are now fixed, using the settings you have provided.

Ad 2) - I think we are speaking about 2 different things here. If I understand correctly you have been explaining why the source textures (and therefore also the rectangular grids representing the terrain) must have the resolution of 2^n+1 pixels/vertices (or in case of the whole pages, m*2^n+1, as you have added later). In other words, this is supposedly controlled by the WorldMap/Paging@PageSize parameter. While demanding this to be 2^n+1 for the page may seem a bit limiting, I guess that most of us graphics nerds are used to work with power-of-two textures :wink: I personally don't have any problem with such constraint.
What I have been asking is why the value of WorldMap/Paging@PageSizeWorld is needed to be 2^n. You have it written in the documentation ("PageSizeWorld%(PageSize-1) must be 0") and indeed setting this parameter to something else than 2^n causes the application to crash. I'm aware that geomipmapping requires the grid to have the resolution of 2^n+1, to be able to collapse 4 adjacent vertices into 1, but since it operates on the discrete grid itself, it shouldn't require the world size of the grid to be of some concrete value. For example, both the standard nonpaged terrain manager in Ogre and PLSM2 can set the page world size to an arbitrary value. I can imagine, that the power-of-two constraint could be imposed even on the world size of the page, for instance because of some specific metric calculations, but it still seems quite improbable to me.
But please, correct me if I'm wrong.

Kind regards,
oskEE
Core 2 Duo @ 1.86 GHz / GeForce 8800GT 512 MB / Windows 7 (64bit)
User avatar
oskEE
Newcomer
 
Posts: 14
Joined: Tue Mar 31, 2009 1:31 pm
Location: Prague, Czech Republic

Re: Myrddin Landscape Plugin SDK

Postby Herb » Thu Sep 10, 2009 6:08 pm

Myrddinson,

Been working with your plugin for awhile and I've been quite happy with it. Still having a couple of issues that I think can be solved by configuration, so I thought I'd ask for some input.

1.) I have a rain scene where I bring in the overcast dark clouds and have it rain. However, the sky haze still has the mountains in the distance fade out to a blue color based of the sky but it looks wrong with the overcast dark grey clouds. Any ideas for me?

2.) I would like to have a map 1/4 the size of landsample. I'm not quite sure on how to do it, as I've only been able to make additional maps the same size. I went into L3DT and reduced the map size from 2048x2048 to 512x512 and split the map up the same way (8x8). Then I divided by four the following xml attributes under paging: pagesize, tilesize, pagesizeworld, pageheightworld. I guess the height doesn't matter, but anyway, when I render the map I don't see any terrain, just the sun, sky, and water. Am I missing something, or do I need to do something different to get a reduced map size?

Thanks in advanced for looking at this,
Herb
User avatar
Herb
Familiar face
 
Posts: 31
Joined: Thu Jun 04, 2009 3:21 am

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sun Sep 13, 2009 12:31 pm

Hi Gerb,

1.) I have a rain scene where I bring in the overcast dark clouds and have it rain. However, the sky haze still has the mountains in the distance fade out to a blue color based of the sky but it looks wrong with the overcast dark grey clouds. Any ideas for me?


yes it is a problem i know about: i will need to add a parameter to the sky and haze shaders in order for user to alter current sky color depending on wheather conditions.

2.) I would like to have a map 1/4 the size of landsample. I'm not quite sure on how to do it, as I've only been able to make additional maps the same size. I went into L3DT and reduced the map size from 2048x2048 to 512x512 and split the map up the same way (8x8). Then I divided by four the following xml attributes under paging: pagesize, tilesize, pagesizeworld, pageheightworld. I guess the height doesn't matter, but anyway, when I render the map I don't see any terrain, just the sun, sky, and water. Am I missing something, or do I need to do something different to get a reduced map size?


it is better if tile size is at least 129 (big terrain patches work better for geomipmapping) so split only 4x4 your 512x512 map so that page size is 129 and set tile size the same so 129 too and pagesizeworld = 128*32 = 4096 (must be a multiple of pagesize-1)
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sun Sep 13, 2009 12:43 pm

Hi Oskee,

Ad 2) - I think we are speaking about 2 different things here. If I understand correctly you have been explaining why the source textures (and therefore also the rectangular grids representing the terrain) must have the resolution of 2^n+1 pixels/vertices (or in case of the whole pages, m*2^n+1, as you have added later). In other words, this is supposedly controlled by the WorldMap/Paging@PageSize parameter. While demanding this to be 2^n+1 for the page may seem a bit limiting, I guess that most of us graphics nerds are used to work with power-of-two textures I personally don't have any problem with such constraint.
What I have been asking is why the value of WorldMap/Paging@PageSizeWorld is needed to be 2^n. You have it written in the documentation ("PageSizeWorld%(PageSize-1) must be 0") and indeed setting this parameter to something else than 2^n causes the application to crash. I'm aware that geomipmapping requires the grid to have the resolution of 2^n+1, to be able to collapse 4 adjacent vertices into 1, but since it operates on the discrete grid itself, it shouldn't require the world size of the grid to be of some concrete value. For example, both the standard nonpaged terrain manager in Ogre and PLSM2 can set the page world size to an arbitrary value. I can imagine, that the power-of-two constraint could be imposed even on the world size of the page, for instance because of some specific metric calculations, but it still seems quite improbable to me.
But please, correct me if I'm wrong.


Yes you are - almost- right: actually you can set WorldMap/Paging@PageSizeWorld to any value = n*(PageSize-1) (with n positive integer >=1) so not only to 2^n ;) So for instance if you have page size = 513 you can set PageSizeWorld to 512 or 2*512, 3*512, etc...
Even if you can set it to any value, it is recommended to set to a multiple of (PageSize-1) to limit discrepancy errors in metrics.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sun Sep 13, 2009 1:34 pm

Hi DanielSefton,

On your first screenshot, it seems that the specular bug happens on objects and not on the terrain itself right ? Because the black squared building looks like a object for me: if it is so, you should check the object material - which is not provided by the plugin unless you use a material modified from the one provided with the two default objects.

I did not notice the white pixels on my system: have you installed the latest drivers for you graphic card ?

Well it only traced to renderOneFrame, didn't go any further. But if this shouldn't happen, I'll investigate more. It unloads/destroys the resources fine, but when it enters the loop and hits renderOneFrame it crashes.


check if terrain scene manager mbWorldIsLoaded is properly set to false after you destroy the scene: it could crash in renderOneFrame if this var is not reset after scene is destroyed.


Also, HDR doesn't support FSSA, right? When I enable HDR and FSAA I get "OGRE_EXCEPTION(3:RenderingAPIException): Unable to create AA render target: Invalid call in D3D9Texture::_createNormTex at ...OgreD3D9Texture.cpp (line 1015)" Not to worry, however, I know CryTek had that issue with their HDR implementation.


Yes i use modified HDR compositor and shaders from Ogre 1.4.6 which use floating point format render targets so it is not compatible with AA which can deal only with not floating point render targets i guess.

EDIT: Also also, setting the Sky's "DrawFirst" option to "true" fixes the depth buffer issue for the sky, but the water is still rendered in front. Is there a similar solution for the water plane?


the water plane queue group is RENDER_QUEUE_WORLD_GEOMETRY_2 while terrain is RENDER_QUEUE_WORLD_GEOMETRY_1: for now, you will need to modify the sources if you want water plane to be drawed before. I will add appropriate config file setting in the next release.


EDIT 2 Would it be possible to implement a feature that colourises the default fog? I'd like to disable the atmospheric haze for lower end PC's and replace it with EXP2 fog, but you can only apply a single colour. Would be nice if there was an option to automatically manage this like what Caelum does.


I default EXP2 fog, you can only apply a single colour: if you want to do more, you need to implement your own fog passe(s) as MLP does with haze. What you could do is to modify at each frame EXP2 colour based on sky color along horizon (and use a direction opposite to sun to avoid to get sun glow color) for instance which should provide a light dynamic haze: the problem is that blending with sky at far range will not be perfect because sky color along horizon is not constant (for instance not the same if you are facing sun or opposite) and default EXP2 fog can apply only one color to all vertexs.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sat Sep 26, 2009 1:47 pm

Hi guys,

actually when the sky is overcast (e.g. clouds coverage set to 1), in order to make the color of the sky at far range look realistic (e.g. not too blue), you just need to lower sun intensity (which is correct because sun light should be altered by occluding clouds): setting WorldMap/Atmosphere/LightScattering/@SunLightIntensityParams first value to a value between 2 and 3 for instance makes the sky look more better for overcast sky ;) You can also manually adjust 'Sun Intensity' slider control on the Atmospheric settings panel.

More generally, to make sky and haze realistic depending on wheather conditions, you will need to alter one or more light atmospheric settings: i will add a wheather panel in next demo in order to illustrate this (so you will be able to select a set of sky and atmospheric settings based on type of wheather conditions - from clear sky to overcast sky) Perhaps i will add presets too to show atmosphere for some extra-terrestrial planets - for instance Mars or Venus: actually as atmospheric lighting and sky settings are fully parametizable, you can simulate any atmosphere you want with MLP integrated atmospheric manager ;)

If you want to understand more about atmospheric light scattering and especially about the meaning of light scattering settings - what settings you need to modify to obtain the desired atmosphere, you should take a look at these documents which i use as a basis for implementing both dynamic sky and atmospheric light scattering:

http://www2.imm.dtu.dk/pubdb/views/edoc ... mm2554.pdf
http://www.cs.utah.edu/~shirley/papers/ ... sunsky.pdf
http://ati.amd.com/developer/dx9/ATI-Li ... tering.pdf
http://developer.amd.com/media/gpu_asse ... eNotes.pdf

http://portal.acm.org/citation.cfm?id=1178574

Kind regards,

Myrddinson.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby DanielSefton » Sat Sep 26, 2009 3:21 pm

Thanks for the document links, very useful -- Wish I understood half of the maths though :) Will be implementing server-side weather soon. I agree that your atmosphere system is powerful.

On your first screenshot, it seems that the specular bug happens on objects and not on the terrain itself right ? Because the black squared building looks like a object for me: if it is so, you should check the object material - which is not provided by the plugin unless you use a material modified from the one provided with the two default objects.

Yeah, that black squared building kinda sucks - programmers art. :roll: Yeah, you're right, I didn't set the materials correctly, it only flashes very subtly now. I think I'll wait for depth scene rendering, because it's really not practical for objects with multiple materials - having to add a haze pass in the code manually is a bit of a pain. It's fine for objects with one material, because I add it when my component-based object system calls setMaterial on an entity.

I did not notice the white pixels on my system: have you installed the latest drivers for you graphic card ?

Well, my card is quite old and I don't have the latest drivers (because it doesn't support them), so I guess I'll ignore the pixels.

check if terrain scene manager mbWorldIsLoaded is properly set to false after you destroy the scene: it could crash in renderOneFrame if this var is not reset after scene is destroyed.

Unless it crashed before it reached mbWorldIsLoaded, it's guaranteed to be set to false, so I don't think that's the issue.

Also, could you clearly explain how paging works? e.g. what AsyncLoadPageMargin, LivePageMargin, PageCacheSize, WorldWidth/HeightSeamless. do. The explanation in the docs is a bit cryptic.

The landsample is absolutely huge, I can never reach the end :P What I want is it to just load the heightmaps in landsample once and not duplicate anything if that makes sense. It appears to seamlessly page them forever.

Also, in my project I use real world scales, and the avatar is about 2.5m tall. Problem is, this is really small in relation to the terrain. So it's very close to the geometry, and the textures are blurry. I also needed to reduce the near clip plane quite significantly, to 0.5 because the camera is so close to the terrain. However, the lower the value below 1, the more the water plane shakes at a long distance.

I noticed that it's not just the sky that shakes a long way from the origin, but the entire terrain and water plane also shake violently - basically everything shakes. :P

Cheers.
User avatar
DanielSefton
Veteran
 
Posts: 1087
Joined: Fri Oct 26, 2007 12:36 am
Location: East Yorkshire, UK

Re: Myrddin Landscape Plugin SDK

Postby myrddinson » Sun Sep 27, 2009 2:05 pm

Hi DanielSefton,

Yeah, that black squared building kinda sucks - programmers art. Yeah, you're right, I didn't set the materials correctly, it only flashes very subtly now. I think I'll wait for depth scene rendering, because it's really not practical for objects with multiple materials - having to add a haze pass in the code manually is a bit of a pain. It's fine for objects with one material, because I add it when my component-based object system calls setMaterial on an entity.

Yes with depth scene rendering you will not need to add haze pass to objects materials but i will implement it for v2.0 only because it implicates to rewrite a lot some shaders.


Unless it crashed before it reached mbWorldIsLoaded, it's guaranteed to be set to false, so I don't think that's the issue.

ok i will investigate that.


Also, could you clearly explain how paging works? e.g. what AsyncLoadPageMargin, LivePageMargin, PageCacheSize, WorldWidth/HeightSeamless. do. The explanation in the docs is a bit cryptic.


LivePageMargin is the radius in count of pages of pages being rendered (minus the current page which is always rendered):
for instance if LivePageMargin = 2 it means that (2*2+1)^2 pages are rendered at every frame.
And to disable paging, set LivePageMargin to 0 so that (2*0+1)^2 = 1 page is rendered only.

AsyncLoadPageMargin is the radius in count of pages of pages being loaded even if they are not rendered yet (must be >= LivePageMargin to enable paging and better if >)

PageCacheSize is the max count of pages which remain in memory (minus the ones which are rendered)


WorldWidthSeamless is the count of pages which repeat seamlessly along X axis while
WorldHeightSeamless is the count of pages which repeat seamlessly along Z axis
(set to 0 to disable seamless status)

The landsample is absolutely huge, I can never reach the end What I want is it to just load the heightmaps in landsample once and not duplicate anything if that makes sense. It appears to seamlessly page them forever.

Yes as WorldWidthSeamless and WorldHeightSeamless are set to 8 it means that terrain repeat seamlessly (every 8 pages) in all directions...
To load once the heightmaps as terrain is seamless 8x8 pages set AsyncLoadPageMargin to 4 and PageCacheSize to 64 should be enough to avoid pages to be unloaded/reloaded (but vertex buffers still need to be builded because page vertexs coordinates are not the same)

Also, in my project I use real world scales, and the avatar is about 2.5m tall. Problem is, this is really small in relation to the terrain. So it's very close to the geometry, and the textures are blurry. I also needed to reduce the near clip plane quite significantly, to 0.5 because the camera is so close to the terrain. However, the lower the value below 1, the more the water plane shakes at a long distance.

Yes it is because if you lower NearClipPlane but not FarClipPlane, the more math discrepancy errors you will have (shaders work with floating point not double...): just take care that ratio FarClipPlane/NearClipPlane stay constant and low enough.
In order to use real world scale (you mean 2.5 world unit = 2.5 meters ?) you must modify PageWorldSize and PageHeightSize by a factor of /4 at least i think but in this case you must also lower both Near and Far clip plane so that ratio remain constant and sufficiently low to avoid discrepancy errors; you will need to adjust haze blending with sky too.

I noticed that it's not just the sky that shakes a long way from the origin, but the entire terrain and water plane also shake violently - basically everything shakes.

Yes i noticed that too but only for the clouds and the water plane: i think i will need to modify world origin so that camera = world origin in order to render properly clouds and water plane.
The other easy way is to reduce Far clip plane/Near clip plane ratio by setting Near clip plane to higher value: it works well with sky (because it is far away actually you do not need small value for near clip plane) - you can try by setting near clip plane to 50 for instance: sky will not shake anymore but terrain will be clipped if camera is too close to the ground...
So to properly implement that i will need to feed sky shader with a custom modified proj matrix (because i need to keep the standard matrix for rendering objects and terrain). For the water plane, the same can apply but only when camera is high above water plane: if camera y is near water plane y, i still can use normal projection matrix because shaking is unnoticeable near water plane and we need small value for near clip plane to avoid water plane being clipped like for terrain.
For the terrain, i did not notice shaking: i think it is because you set near clip plane to a very small value (1 or below) without adjusting proportionally the far clip plane ?

Cheers.

Myrddinson.
Myrddinson
http://myrddinplugin.sourceforge.net/

Intel Core I7 CPU, Geforce GTX 260M 1GB
User avatar
myrddinson
Regular
 
Posts: 124
Joined: Mon Mar 31, 2008 1:16 pm
Location: France

Re: Myrddin Landscape Plugin SDK

Postby DanielSefton » Sun Sep 27, 2009 5:37 pm

Thanks, that helped a lot. And the scale is much more realistic now. :D

(you mean 2.5 world unit = 2.5 meters ?)

Yep.

Edit: I've answered all my own questions. :P Again, thanks for this awesome plugin. We're having fun constructing our sci-fi world with it. :)
User avatar
DanielSefton
Veteran
 
Posts: 1087
Joined: Fri Oct 26, 2007 12:36 am
Location: East Yorkshire, UK

PreviousNext

Return to Showcase

Who is online

Users browsing this forum: boyamer, Google Adsense [Bot], MSN [Bot], RoadKillGrill and 9 guests