Hydrax v0.4 - New version released + Editor!

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.

Postby Xavyiy » Sat Mar 29, 2008 3:50 pm

Cobra8472 wrote:Yep, that was the issue. I thought I had used the one I compiled but alas, that was not the case.It opens the configuration window now, and starts up - but then an exception appears;

Image


Ogre.log;

Code: Select all
13:23:36: [Hydrax] Hydrax object created.
13:23:36: [Hydrax] Module set.
13:23:36: [Hydrax] Creating module.
13:23:36: [Hydrax] Creating PerlinPGModule module.
13:23:36: [Hydrax] PerlinPGModule created.
13:23:36: [Hydrax] Module created.
13:23:36: [Hydrax] Creating materials,
13:23:36: [Hydrax] Creating water material...
13:23:36: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\src\OgreGpuProgram.cpp (line 873)


I feel like such a tool for being the only one with problems >.<
Are you using: mHydrax->setShaderMode(Hydrax::MaterialManager::SM_HLSL); and DirectX render system? Otherwise, for SM_CG you need the cg 2.0(I think, with older versions there're was some problem with textures order) version(Ogre cvs). SM_GLSL are not yet implemented. Check this, otherwise what ogre version are you using?

Xavi.
Last edited by Xavyiy on Sat Mar 29, 2008 4:27 pm, edited 1 time in total.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby Cobra8472 » Sat Mar 29, 2008 3:56 pm

I was trying to run in OpenGL. DirectX works fine.

Thanks for all your help Xvyiy!!
It looks quite fantastic, keep up the good work :D!
Cobra8472
Halfling
 
Posts: 83
Kudos: 0
Joined: 02 Jun 2005

Postby Xavyiy » Sat Mar 29, 2008 4:11 pm

Cobra8472 wrote:I was trying to run in OpenGL. DirectX works fine.

Thanks for all your help Xvyiy!!
It looks quite fantastic, keep up the good work :D!
;)
If you need run it in OpenGL mode, you can use SM_CG, but there is a little issue in reflections(a cg bug I think!).
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby mehdix » Sun Mar 30, 2008 2:12 pm

Hi Xavi

I have some problems. In my environment 1 unit is 1 meter, currently; for example my in-game camera is 1.8m (180cm) above the terrain and so on.
Here is what I'm done:

Code: Select all
    Ogre::Real length = 700, width = 420;   // Extents of the water plan:  700m x 420m
    // Set water mesh options
    mHydrax->setMeshOptions( new Hydrax::Mesh::SimpleGridOptions(
        Hydrax::Size(length, width), // Mesh size
        512) );                      // Grid complexity

    mHydrax->setModule( new Hydrax::Module::Perlin(mHydrax,
        Hydrax::Module::Perlin::Options(
            Hydrax::TEX_QUA_512, sqrt(length*width)/12, 0.1, 1, 1, 0.6, 5.0)) );

    // Set rtt textures quality
    mHydrax->setRttOptions(
        Hydrax::RttOptions(Hydrax::TEX_QUA_512,   // Reflection tex quality
                           Hydrax::TEX_QUA_512,   // Refraction tex quality
                           Hydrax::TEX_QUA_512)); // Depth tex quality
    // Set components that we want to have
    mHydrax->setComponents(
        static_cast<Hydrax::HydraxComponent>(Hydrax::HYDRAX_COMPONENT_SUN    |
                                             Hydrax::HYDRAX_COMPONENT_FOAM   |
                                             Hydrax::HYDRAX_COMPONENT_DEPTH  |
                                             Hydrax::HYDRAX_COMPONENT_SMOOTH |
                                             Hydrax::HYDRAX_COMPONENT_CAUSTICS));
    // Set shader mode
    mHydrax->setShaderMode(Hydrax::MaterialManager::SM_HLSL);

    // Create water
    mHydrax->create();

    mHydrax->setStrength(0.3);    // 30cm
    mHydrax->setPosition(waterPlanPos);
    mHydrax->setPlanesError(0.375);
    mHydrax->setSunPosition(sun.Pos);
    mHydrax->setSunColor(sunColor);
    mHydrax->setNormalDistortion(0.025);
    mHydrax->setDepthLimit(1.5);      // Just 1.5m
    mHydrax->setDepthColor(Ogre::Vector3(0.06,0.33,0.5));
    mHydrax->setSmoothPower(5);
    mHydrax->setGlobalTransparency(0.2);
    mHydrax->setFullReflectionDistance(12000);

and screen shots:

Image
Image

As you see there are no 'foam' and 'coastics'. In addition 'depth' is not correct; although it's obvious at the shores, but here are shots when depth is disabled by
Code: Select all
// Hydrax::HYDRAX_COMPONENT_DEPTH  |


Image
Image

Btw in the Hydrax demo everything is ok.

This is the log:

Code: Select all
 ....
16:31:18: Initialising resource group Hydrax
16:31:18: Parsing scripts for resource group Hydrax
16:31:18: Finished parsing scripts for resource group Hydrax
 ....
16:31:26: [Hydrax] Hydrax object created.
16:31:26: [Hydrax] Module set.
16:31:26: [Hydrax] Creating module.
16:31:26: [Hydrax] Creating PerlinModule module.
16:31:26: [Hydrax] Creating hydrax texture manager, Textures size: 512
16:31:26: WARNING: Texture instance 'HydraxHeightMap' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
16:31:26: WARNING: Texture instance 'HydraxNormalMap' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
16:31:26: [Hydrax] Hydrax texture manager created.
16:31:27: [Hydrax] PerlinModule created.
16:31:27: [Hydrax] Module created.
16:31:27: [Hydrax] Creating materials,
16:31:27: [Hydrax] Creating water material...
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Reflection in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture Reflection. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Reflection in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Refraction in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture Refraction. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Refraction in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Depth in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture Depth. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Depth in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Texture: Fresnel.bmp: Loading 1 faces(PF_L8,256x1x1) with 8 generated mipmaps from Image. Internal format is PF_L8,256x1x1.
16:31:28: Texture: Foam.png: Loading 1 faces(PF_R8G8B8,512x512x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
16:31:28: [Hydrax] Water material created.
16:31:28: [Hydrax] Creating depth material...
16:31:28: Texture: Caustics_0.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_1.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_2.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_3.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_4.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_5.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_6.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_7.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_8.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_9.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_10.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_11.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_12.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_13.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_14.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_15.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_16.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_17.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_18.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_19.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_20.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_21.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_22.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_23.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_24.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_25.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_26.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_27.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_28.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_29.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_30.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: Texture: Caustics_31.bmp: Loading 1 faces(PF_R8G8B8,128x128x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
16:31:28: [Hydrax] Depth material created.
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Reflection in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture Reflection. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Reflection in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Refraction in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture Refraction. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Refraction in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Depth in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture Depth. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Depth in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxReflectionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture HydraxReflectionMap. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxReflectionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxRefractionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture HydraxRefractionMap. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxRefractionMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxDepthMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: Error loading texture HydraxDepthMap. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource HydraxDepthMap in resource group Hydrax or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 603)
16:31:28: [Hydrax] Materials created.
16:31:28: [Hydrax] Creating water mesh.
16:31:28: WARNING: Mesh instance 'HydraxMesh' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
16:31:28: [Hydrax] Water mesh created
16:31:28: [Hydrax] Creating RTListeners.
16:31:28: Creating viewport on target 'rtt/725567360', rendering from camera 'InGame Camera', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
16:31:28: Creating viewport on target 'rtt/725567840', rendering from camera 'InGame Camera', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
16:31:28: Creating viewport on target 'rtt/725574304', rendering from camera 'InGame Camera', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
16:31:28: WARNING: Texture instance 'HydraxReflectionMap' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
16:31:28: WARNING: Texture instance 'HydraxRefractionMap' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
16:31:28: WARNING: Texture instance 'HydraxDepthMap' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
16:31:28: [Hydrax] RTListeners created
16:31:28: [Hydrax] Registring device restored listener
16:31:28: [Hydrax] Device restored listener registred
16:33:28: Unregistering ResourceManager for type BspLevel
16:33:28: *-*-* OGRE Shutdown
 ....


Thanks.
User avatar
mehdix
Halfling
 
Posts: 78
Kudos: 0
Joined: 22 Jun 2007

Postby Xavyiy » Sun Mar 30, 2008 2:55 pm

mehdix wrote:Hi Xavi

I have some problems. In my environment 1 unit is 1 meter, currently; for example my in-game camera is 1.8m (180cm) above the terrain and so on.
Here is what I'm done:

Code: Select all
...
and screen shots:
...

As you see there are no 'foam' and 'coastics'. In addition 'depth' is not correct; although it's obvious at the shores, but here are shots when depth is disabled by
Code: Select all
// Hydrax::HYDRAX_COMPONENT_DEPTH  |
...

Btw in the Hydrax demo everything is ok.

This is the log:

Code: Select all
...

Thanks.
Hi mehdix,
at first of all: ¿Is your terrain an Entity? If not, you should add the depth technique to your terrain material using:
Code: Select all
/** Add depth technique to an especified material
         @param Material Material where depth technique will be added
         @param Index Depth technique creation index
         @remarks Call it after Hydrax::create() !!!

                  Add depth technique when a material is not an Ogre::Entity, such
                  a terrains, PLSM2 materials, etc.
                This depth technique will be added with "Depth" scheme in order
                to can use it in the Depth RTT.
                It will be update automatically with params updates.
       */
      void Hydrax::MaterialManager::addDepthTechnique(Ogre::MaterialPtr &Material, const int &Index);
I haven't tried this funtion, but it must work! About: "It will be update automatically with params" isn't implemented yet, so you have to add the depth technique after set your depth parameters and have been called Hydrax::create().

If your terrain is an Entity the error must be in depth water parameters, try changing the DepthLimit parameter.

About using the simple grid geometry, the prefered water module is the current PerlinPG module, like the demo(faster and nicer). But next released the Hydrax module system will be updated(I have done 50% at the moment) and I hope SimpleGrid module will be faster than the actual!

Edit:About foam: try Hydrax::setFoamStart(...) beetwen [-1,1], foam doesn't depend of depth, so it will be a parameter wrong value.

If these solutions don't work, you say that in the demo works; have you translate your world-metrics to the demo? using the SimpleGrid geometry?

Xavi
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby mehdix » Sun Mar 30, 2008 10:09 pm

Thanks very much Xavi

My terrain isn't an entity and addDepthTechnique() did the trick!
But it needs a little change, to prevent crash:

Hydrax/MaterialManager.cpp
Code: Select all
   void MaterialManager::addDepthTechnique(Ogre::MaterialPtr &Material, const int &Index)
   {
      if (!Ogre::MaterialManager::getSingleton().resourceExists(_def_Depth_Material_Name))
      {
         _createDepthMaterial(mComponents, mOptions);
      }

      Material->getTechnique(Index)->removeAllPasses();
        Material->getTechnique(Index)->createPass();    // <<< This line must be added.
      Material->getTechnique(Index)->setSchemeName("HydraxDepth");

      Ogre::Pass *DM_Technique0_Pass0 = Material->getTechnique(Index)->getPass(0);    // Otherwise will be crashed here
    ....


Foam texture is (just) shown with these values:
Code: Select all
    mHydrax->setFoamScale(0.1);    // Or something else
    mHydrax->setFoamStart(-0.5);    // Must be negative
    mHydrax->setFoamMaxDistance(100);

but...

Image

If these solutions don't work, you say that in the demo works; have you translate your world-metrics to the demo? using the SimpleGrid geometry?

My world has no special matrices. I was scale some values of the demo by ~0.01 when I used them in my app. (am I understand you correctly?)

I tried PerlinPG but it isn't suitable for my current terrain; as this module is not bounded and also my terrain isn't island like. additionally it needs lots of tweaking for my extents.
Anyway thanks for your advice. :D
User avatar
mehdix
Halfling
 
Posts: 78
Kudos: 0
Joined: 22 Jun 2007

Postby Xavyiy » Sun Mar 30, 2008 10:47 pm

mehdix wrote:Thanks very much Xavi

My terrain isn't an entity and addDepthTechnique() did the trick!
But it needs a little change, to prevent crash:

Hydrax/MaterialManager.cpp
Code: Select all
...


Foam texture is (just) shown with these values:
Code: Select all
...

but...
[IMAGE]
If these solutions don't work, you say that in the demo works; have you translate your world-metrics to the demo? using the SimpleGrid geometry?

My world has no special matrices. I was scale some values of the demo by ~0.01 when I used them in my app. (am I understand you correctly?)

I tried PerlinPG but it isn't suitable for my current terrain; as this module is not bounded and also my terrain isn't island like. additionally it needs lots of tweaking for my extents.
Anyway thanks for your advice. :D

At first of all, thanks for the bugfix!

About the foam issue, I don't remember what value I used when I tried the Perlin module, but I'm sure that it wasn't negative. Try with all values from -1 to 1 with 0.1 intervales and if it doesn't work well(Only showing the foam on water heigths regions) is the moment to hunt a possible bug!

Foam is calculated in the main water shader, using 3 parameters:
2 of them are static: Water plane position and max water strength.
the other one is dynamic(the actual pixel heigth). It's calculated with this code: MaterialManager.cpp
Code: Select all
"float hmap = ((iPosition.y - uFoamRange.x)/uFoamRange.y)*foamVisibility;\n") +
"float2 foamTex=iPosition.xz*uFoamScale+pixelNormalModified;\n" +
"float foam=tex2D(uFoamMap,foamTex).r;\n" +
"float foamTransparency=saturate(hmap-uFoamStart)*uFoamTransparency;\n" + "oColor=lerp(oColor,float4(1,1,1,1),foamTransparency*foam);\n";
uFoamRange.x = Water plane heigth
uFoamRange.y = Water strength
iPosition.y = Actual pixel heigth

Values are uploaded to the shader with this code:
Code: Select all
float FRange[2] = {mHydrax->getPosition().y, mHydrax->getStrength()};
FP_Parameters->setNamedConstant("uFoamRange",        FRange, 1, 2);

and with this code when it's updated calling Hydrax::setFoamStrength:
Code: Select all
void Hydrax::setStrength(const Ogre::Real &Strength)
    {
        mMesh->setStrength(Strength);

      if (isComponent(HYDRAX_COMPONENT_FOAM))
      {
          mMaterialManager->setGpuProgramParameter(
             MaterialManager::GPUP_FRAGMENT, MaterialManager::MAT_WATER,
             "uFoamRange", Ogre::Vector2(mPosition.y, Strength));
      }
    }
If trying different values doesn't solve the issue, you can start looking into the issue with the previous information.

About the Perlin module, I hope that the new SimpleGrid module available in future 0.3 version will be at least 200% faster(Using the new Perlin Noise module wich is very fast and updating mesh geometry directly in the vertex buffer, it will have two normal generation techniques: From texture(and writting data directly in the buffer, faster than the actual method) and from vertex(very fast))

Edit: Sorry for my English! ;)

Xavi
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby marks » Sun Mar 30, 2008 11:45 pm

I'm getting something strange when compiling the demo on the Mac (using CG). I get an assertion error on allocating an OgreAxisAlignedBox:

Code: Select all
../Dependencies/Ogre.framework/Headers/OgreAxisAlignedBox.h:251: failed assertion `(mx <= Mx && my <= My && mz <= Mz) && "The minimum corner of the box must be less than or equal to maximum corner"'


from Hydrax::Mesh::create( Ogre::SceneNode *SceneNode) on the following line:

Code: Select all
      // End mesh creation
        Ogre::AxisAlignedBox meshBounds(0,0,0,
                                     mOptions->MeshSize.Width, mStrength, mOptions->MeshSize.Height);


because the MeshSize width and height are -1, from the default ProjectedGridOptions constructor. And then on the very next line, we have:

Code: Select all
      if (getType() == PROJECTED_GRID)
      {
         meshBounds = Ogre::AxisAlignedBox(-1000000,-1000000,-1000000,
                                             1000000, 1000000, 1000000);
      }


...which would actually work for a meshBounds constructor... (getType() does indeed return PROJECTED_GRID). It looks like mOptions are invalid for whatever reason.

Am I overlooking something?

Thanks!

edit: Removed superfluous text.
edit2: By the way, this stuff is brilliant!
marks
Gnoblar
 
Posts: 5
Kudos: 0
Joined: 30 Mar 2008

Postby eugen » Mon Mar 31, 2008 12:09 pm

I have the same error in debug, release version works fine
this could be related to this thread
http://www.ogre3d.org/phpBB2/viewtopic.php?t=40254&highlight=&sid=c99570684edfee4a382c8e23db7a45ce
or not since here it seeems to be more deliberate
User avatar
eugen
OGRE Expert User
OGRE Expert User
 
Posts: 1556
Kudos: 4
Joined: 22 May 2004
Location: Bucharest

Postby Xavyiy » Mon Mar 31, 2008 2:00 pm

marks wrote:I'm getting something strange when compiling the demo on the Mac (using CG). I get an assertion error on allocating an OgreAxisAlignedBox:
Code: Select all
...


from Hydrax::Mesh::create( Ogre::SceneNode *SceneNode) on the following line:
Code: Select all
...


because the MeshSize width and height are -1, from the default ProjectedGridOptions constructor. And then on the very next line, we have:
Code: Select all
...


...which would actually work for a meshBounds constructor... (getType() does indeed return PROJECTED_GRID). It looks like mOptions are invalid for whatever reason.

Am I overlooking something?

Thanks!

edit: Removed superfluous text.
edit2: By the way, this stuff is brilliant!

Hi marks! Yes, as eugen sais it shoudn't appear in release mode. It's an Hydrax bug, next version will fix it! Thanks for the bug and, you can as a temporally solution use the following code:
Code: Select all
// End mesh creation
Ogre::AxisAlignedBox meshBounds(0, 0, 0,
                                10, 10, 10);
(only if you are going to use the PerlinPG module).

Otherwise, it runs on mac? I only tested it under windows.
In windows with: OpenGL + Hydrax::MaterialManager::SM_CG there's a little issue with reflections. (Cg bug I think).

Xavi
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby marks » Mon Mar 31, 2008 4:30 pm

Xavyiy wrote:Hi marks! Yes, as eugen sais it shoudn't appear in release mode. It's an Hydrax bug, next version will fix it! Thanks for the bug and, you can as a temporally solution use the following code:
Code: Select all
// End mesh creation
Ogre::AxisAlignedBox meshBounds(0, 0, 0,
                                10, 10, 10);

(only if you are going to use the PerlinPG module).


Oops, didn't see his response. I did something similar; works great.

Xavyiy wrote:Otherwise, it runs on mac? I only tested it under windows.
In windows with: OpenGL + Hydrax::MaterialManager::SM_CG there's a little issue with reflections. (Cg bug I think).


Yep! Works like a charm and looks amazing. My framerate was tanking with the island mesh though (at least that is my current guess); going to investigate fully tonight.
marks
Gnoblar
 
Posts: 5
Kudos: 0
Joined: 30 Mar 2008

Postby Xavyiy » Mon Mar 31, 2008 4:35 pm

marks wrote:Yep! Works like a charm and looks amazing. My framerate was tanking with the island mesh though (at least that is my current guess); going to investigate fully tonight.
Can you post a screenshot of how it looks under mac? I want to compare it with OpenGL under windows results jeje

Xavi
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby marks » Mon Mar 31, 2008 6:21 pm

Xavyiy wrote:Can you post a screenshot of how it looks under mac? I want to compare it with OpenGL under windows results jeje


Image Image Image Image

I average 11-12fps with the island, and 85-90fps without. Haven't looked at full screen yet. If you wanted something specific, let me know. The first screenshot is without the island mesh (obviously). My machine is a:

MacBook Pro
2.33 GHz Core 2 Duo
2 GB RAM
ATI Radeon X1600
marks
Gnoblar
 
Posts: 5
Kudos: 0
Joined: 30 Mar 2008

Postby Xavyiy » Mon Mar 31, 2008 7:01 pm

marks wrote:
Xavyiy wrote:Can you post a screenshot of how it looks under mac? I want to compare it with OpenGL under windows results jeje


Image Image Image Image

I average 11-12fps with the island, and 85-90fps without. Haven't looked at full screen yet. If you wanted something specific, let me know. The first screenshot is without the island mesh (obviously). My machine is a:

MacBook Pro
2.33 GHz Core 2 Duo
2 GB RAM
ATI Radeon X1600
As I expected, the reflection issue affects opengl/cg under mac :( If you can try the precompiled demo in a windows machine(with DX) you would see an enormous difference caused by the reflection issue! About island, try it without the Offset mapping material and check the frame rate.

Edit:See the difference beetwen OpenGL and DirectX:
Image

Xavi
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby marks » Mon Mar 31, 2008 7:23 pm

Xavyiy wrote:As I expected, the reflection issue affects opengl/cg under mac :( If you can try the precompiled demo in a windows machine(with DX) you would see an enormous difference caused by the reflection issue! About island, try it without the Offset mapping material and check the frame rate.

Xavi


Just ran it on my machine at work (2.40GHz Core2 Duo, 3GB RAM, GeForce 7900GS): jesus christ. I saw screenshots over the weekend (I don't have a PC at home), but you really have to see it in real time to really appreciate it all. It really does look beautiful.

However, for my current needs, the CG issue is not a big deal for me. I'm not writing production code by any means, and I'm OK with it. However, I am tempted to install Boot Camp (to run Windows XP on my MacBook Pro) and compare performance (since it'll be on the same hardware).

As far as the island is concerned, a scaled-back material did the trick. Duh, that was an obvious oversight.

Keep up the amazing work.
marks
Gnoblar
 
Posts: 5
Kudos: 0
Joined: 30 Mar 2008

Postby Infuse » Mon Mar 31, 2008 11:43 pm

Umm can someone help me out please...

Can someone tell me how to compile this thing cuz i really wanna use this and all i'm getting is a bunch of errors when i try to run/build it
Infuse
Gnoblar
 
Posts: 18
Kudos: 0
Joined: 20 Mar 2008

Postby Xavyiy » Mon Mar 31, 2008 11:44 pm

Infuse wrote:Umm can someone help me out please...

Can someone tell me how to compile this thing cuz i really wanna use this and all i'm getting is a bunch of errors when i try to run/build it
We can't help you if you don't give us some informationa about your problem...
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby Beatnik Joe » Tue Apr 01, 2008 4:50 am

Xavyiy wrote:
Beatnik Joe wrote:I was also wondering -- is the Demo sample project supposed to look the same as the downloadable binary? Mine looks very different (much, much darker and a lot less clear.) I might just have something misconfigured, but I was wondering if these two apps are basically the same thing.
Yes, the downlaodable binary is the demo project compiled, wihtout any changes(Using Ogre December CVS Snapshot and VS 2005).
What ogre version are you using? Can you post some screenshots of your results? Do you change any code in the project demo?
Edit: Are you using OpenGL render system? at the moment there're some issues with OpenGL render system and reflections.(CG bug I think...)
Xavi

Hi Xavi, I'm almost certain that it must be some sort of misconfiguration on my part, but let me post a couple of screenies for reference anyhow to give you an idea of what I mean.

I am using Direct3D in both cases. I am using the Eihort SDK build of Ogre. I did not make any changes to the project outside of some project file tweaks to get it to build with my path structure.

First, here is what I get when I use your precompiled binary:
Image
Aaaahhh... very nice. :)

And here is what I get when I compile from source:
Image
Still very nice... but quite dark and murky. Also, the first two skyboxes in the "M" skybox rotation are white "blanks"! I am assuming that it is some problem with the way I have arranged my resource files. If I find time to get it sorted out, I'll try to post a follow-up in case anyone else runs into the same problem.

Anyhow, I don't think for a second this is a problem on your end, just wanted to follow up on your question. My resource fumbling aside, I'd like to compliment you again on a job (very) well done!
Beatnik Joe
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 30 Apr 2005

Postby mehdix » Tue Apr 01, 2008 12:45 pm

Xavyiy wrote:...
Foam is calculated in the main water shader, using 3 parameters:
2 of them are static: Water plane position and max water strength.
the other one is dynamic(the actual pixel heigth). It's calculated with this code: MaterialManager.cpp
Code: Select all
"float hmap = ((iPosition.y - uFoamRange.x)/uFoamRange.y)*foamVisibility;\n") +
"float2 foamTex=iPosition.xz*uFoamScale+pixelNormalModified;\n" +
"float foam=tex2D(uFoamMap,foamTex).r;\n" +
"float foamTransparency=saturate(hmap-uFoamStart)*uFoamTransparency;\n" + "oColor=lerp(oColor,float4(1,1,1,1),foamTransparency*foam);\n";
uFoamRange.x = Water plane heigth
uFoamRange.y = Water strength
iPosition.y = Actual pixel heigth
...


Hi

Thanks for you help. My water plan's height is ~6 but as 'iPosition' is in local space, there is no need for uFoamRange.x. So the first line of the above fragment shader must be as follows:
Code: Select all
"float hmap = foamVisibility * Position.y/uFoamRange.y;\n") +

I didn't test with PerlinPG, But I get the correct result with this line:
Code: Select all
"float hmap = ((2 * (iPosition.y-uFoamRange.y*0.5)) / uFoamRange.y) * foamVisibility;\n") +

as I'm using Perlin module currently, it seems like a bug in this module.

Cheers.
User avatar
mehdix
Halfling
 
Posts: 78
Kudos: 0
Joined: 22 Jun 2007

Postby Xavyiy » Tue Apr 01, 2008 1:44 pm

@Beatnik Joe:The problem seems like the CG issue, you can try the follow options:

- DirectX and Hydrax::MaterialManager::SM_HLSL
- DirectX and Hydrax::MaterialManager::SM_CG (With cg 2.0!)

If these two options don't work you can check if the reflection map is correct, you can try: Hydrax::setFullReflectionDistance(1). If the sky is reflected it works and consequently the problem is in the shader and as a result of this the most probably options is your Ogre version. About skyboxes it should be an resources path error.

@mehdix:...Terrible bug!:P It will be fixed! I haven't considered that iPosition is in local space!:(

Xavi
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby Infuse » Tue Apr 01, 2008 8:39 pm

Hey ok...i finally got my stuff to build but now i get an error saying that it can't find the material called sky/clubtropicana. Now i'm wondering if its not included in the package, cuz i can't find it anywhere on my machine
Infuse
Gnoblar
 
Posts: 18
Kudos: 0
Joined: 20 Mar 2008

Postby Xavyiy » Tue Apr 01, 2008 9:26 pm

Infuse wrote:Hey ok...i finally got my stuff to build but now i get an error saying that it can't find the material called sky/clubtropicana. Now i'm wondering if its not included in the package, cuz i can't find it anywhere on my machine

see in: packs/skyboxes.zip ;)
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

Postby Cobra8472 » Tue Apr 01, 2008 9:40 pm

Me again *waves*

I was wondering, though this is kind of the wrong thread perhaps- if you could aid me in sun reflections. I am attempting to use Hydrax with Caelum, and Caelum utilizes a directional light (I'm told this does not have a position, only a direction).

Since Hydrax takes a Vector3 for the sun position, i'm wondering how this could be solved? Perhaps creating a manual scenenode on the ray from the sun?

I ask this in this thread because perhaps there is a chance I can modify the code to work with directional lights, or maybe you know of a better solution?

Otherwise it works great, fantastic work!

Image
Cobra8472
Halfling
 
Posts: 83
Kudos: 0
Joined: 02 Jun 2005

Postby nullsquared » Tue Apr 01, 2008 10:19 pm

I just want to say, I just ran the demo again out of pure amazement by the pretty water :D
User avatar
nullsquared
Old One
 
Posts: 3245
Kudos: 9
Joined: 24 Apr 2007
Location: NY, NY, USA

Postby Xavyiy » Tue Apr 01, 2008 11:21 pm

Cobra8472 wrote:Me again *waves*

I was wondering, though this is kind of the wrong thread perhaps- if you could aid me in sun reflections. I am attempting to use Hydrax with Caelum, and Caelum utilizes a directional light (I'm told this does not have a position, only a direction).

Since Hydrax takes a Vector3 for the sun position, i'm wondering how this could be solved? Perhaps creating a manual scenenode on the ray from the sun?

I ask this in this thread because perhaps there is a chance I can modify the code to work with directional lights, or maybe you know of a better solution?

Otherwise it works great, fantastic work!
If I have understand you, you can use:

Code: Select all
Ogre::Vector3 SunPosition = CameraPosition - 100000 * CaelumSumDirection.normalizedCopy();

I think It would work, the camera psition + a big constant(the distance Camera-Sun, Caelum sphere radio :P or a big number) multiplied by the negative sun direction.

:)

Edit: Little modification
Last edited by Xavyiy on Wed Apr 02, 2008 4:50 pm, edited 3 times in total.
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
 
Posts: 845
Kudos: 84
Joined: 12 Apr 2005
Location: Albacete - Spain

PreviousNext

Return to Using OGRE in practice

Who is online

Users browsing this forum: No registered users and 5 guests