Porting the Ocean's Demo to MOGRE

Moyatzo

31-12-2008 15:41:03

Hello,

i'm trying to port some code from the Ocean's Demo of Ogre to my application written using Mogre.

All i can get is the correct plane of the ocean (with waves) but without colors (is very, very dark). It seems to me that no lights has been defined, but i'm sure that the ambient light is activated.

Any ideas?

Here is my code:

Dim oceanSurface As Mogre.Plane
oceanSurface.normal = Mogre.Vector3.UNIT_Y
oceanSurface.d = 20

Mogre.MeshManager.Singleton.CreatePlane("OceanSurface", Mogre.ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, _ oceanSurface, 1000, 1000, 50, 50, True, 1, 1, 1, Mogre.Vector3.UNIT_Z)

Dim ocean_entity As Entity = _scene_manager.CreateEntity("OceanSurface", "OceanSurface")
ocean_entity.SetMaterialName("Ocean2_Cg")
_scene_manager.RootSceneNode.CreateChildSceneNode.AttachObject(ocean_entity)


Thank you!

And happy new year!!!

Moyatzo

02-01-2009 10:27:07

Hi!

I have found the cause. The problem is in the line:

_scene_manager.ShadowTechnique = Mogre.ShadowTechnique.SHADOWTYPE_STENCIL_ADDITIVE

But I don't know how to solve the problem. Why the ocean's shader does not work with this shadow technique?

Any ideas? Thank you!

Moyatzo

02-01-2009 10:39:02

Solved!

With this line:

_scene_manager.ShadowTechnique = Mogre.ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE

all works fine!

Thanks!