Subject: [Nel] Enabling Water Pools in Client

From: Robert Bjarnason <[email-masked]>
Date: Tue, 26 Feb 2002 03:58:49 -0800

Hi,

I've been trying to get a Water Pool to work
in a client app that is based on the Snowballs
client.  I've spent a lot of time trying to
figure this out, my pool works fine in the
object viewer, but not when I load it into
the client along with the WaveMaker shape.

One thing I noticed is that CWaterModel::registerBasic()
is not called, I tried adding CScene::registerBasics ();
and then the CWaterModel is registered... But
no pool appears...

Is it possible to enable the Water Pools using
the UDriver concept or should I set up my Driver
more like the ObjectViewer does it?

Here is how I create the WaterPoolManager after
and Instance Group with a WaterShape and WaveMakerShape
has been loaded and added to the Scene:

WaterPoolManager = &NL3D::GetWaterPoolManager();

NL3D::CWaterPoolManager::CWaterHeightMapBuild whmb;
whmb.ID   = 0;
whmb.Name = "Water01";
whmb.Size = 256;
whmb.FilterWeight = 3.0f;
whmb.UnitSize = 0.3f;
whmb.WavesEnabled = true;
whmb.WaveIntensity = 1.5f;
whmb.WavePeriod = 0.05f;
whmb.WaveRadius = 3;
whmb.BorderWaves = true;
whmb.Damping = 0.99f;

WaterPoolManager->createWaterPool(whmb);
WaterPoolManager->setBlendFactor(dynamic_cast<IDriver*> (Driver), 0.1f);

Any hints would be appreciated...

Thanks,
Robert Bjarnason
[email-masked]

---

From: "Nicolas Vizerie" <[email-masked]>
Date: Tue, 26 Feb 2002 11:32:27 +0100

Hi Robert,

The way you proceed seems correct. Well, for now, you have to create a water
pool the way the object viewer does, since it isn't exposed by the user
interface for now. One is provided as the default if you don't create one,
however. Note that you can also edit the water pool in the object viewer and
save it, so just do a serial on the water pool then.
You must also be sure that the normal of the water is pointing towards
positives z when you create it, it can't work otherwise and will either
display nothing or garbage.

Here's the complete process anyway:

- Create a convex polygon in the x-y plane where your water surface is. Note
that the way it is tesselated force you to make it intersect the border of
the object containing the water.
- Assign it a NeL water material (see
\nel\tools\3d\plugin_max\nel_water_material.txt for details)
- Apply mapping coordinates to the surface if you use a diffuse map.

At this point you can see the surface by selecting it and clicking 'View the
scene'. A GeForce 3 or better is needed to get the water looking good, other
versions will be done later (older card are supported, but with no bump)

If you want waves on your surface :

- Create a wave maker (Geometry / NeL tools / Wave maker)
- Assign it the same ID than the water surfaces it must create waves in
- Go to the object viewer.
- Edit the water pool properties to get the waves you want (and eventually
save it). Note that a water pool is shared by several water surfaces (to
allow waves propagating from one surface to another). Waves can only be seen
when near the viewer, so you may need to adjust the parameter 'Water Unit
Size' to a higher value.
- Export the shapes and the instance groups.

Then you load it in the client, the way you did, and it should work :

 UInstanceGroup  *ig   =
UInstanceGroup::createInstanceGroup(std::string("water.ig"));
 ig->addToScene(*scene);
// setup the water pool then...

If this doesn't work, you could also check wether the shapes are found.

Hope it helps

Regards,
Nicolas Vizerie

----- Original Message -----
From: "Robert Bjarnason" <[email-masked]>
To: <[email-masked]>
Sent: Tuesday, February 26, 2002 12:58 PM
Subject: [Nel] Enabling Water Pools in Client

> _______________________________________________
> Nel mailing list
> [email-masked]
> /mailman/listinfo.cgi/nel
>

---

From: "Daniel Miller" <[email-masked]>
Date: Tue, 26 Feb 2002 12:30:30 +0100

I've observed some odd behaviour relating to the water - sometiimes its
there and sometimes its not...

- Try compiling in different modes and see if it starts working. (one of the
guys on the Ryzom team has a problem in certain build modes)

- Behaviour may be different on different machines but this remains to be
confirmed. (I've seen problems on some machines but I can't guarantee that
they were running the same executables as the machines that run OK)

We haven't looked into how to make the problem repeatable yet - when we do
we'll fix it.

Cheers

-----Original Message-----
From: [email-masked] [mailto:[email-masked]]On Behalf Of
Nicolas Vizerie
Sent: Tuesday, February 26, 2002 11:32 AM
To: [email-masked]
Cc: [email-masked]
Subject: Re: [Nel] Enabling Water Pools in Client

Hi Robert,

 UInstanceGroup  *ig   =

Hope it helps

Regards,
Nicolas Vizerie

---

From: Robert Bjarnason <[email-masked]>
Date: Tue, 26 Feb 2002 12:05:45 -0800

Hi Nicolas,

NV> Well, for now, you have to create a water pool the way the object viewer does,
NV> since it isn't exposed by the user interface for now.

I might be missing something in this process of creating
the water pool the way the object viewer does it...

NV> - Export the shapes and the instance groups.

After making my pool look really good in Object Viewer
I export the shapes and the instance group.

NV> Then you load it in the client, the way you did, and it should work :

Then I use this code to load the ig:

UInstanceGroup  *waterIg = UInstanceGroup::createInstanceGroup(std::string("9_AO.ig"));
waterIg->addToScene(*Scene);

<-cut whmb setup->
nlinfo("Nr of waterpools %d nr.",WaterPoolManager->getNumPools());

NV> If this doesn't work, you could also check wether the shapes are found.

The WaterShape is added to the scene I confirmed that
with debug code.

But this method in CWaterModel is never
called: void CWaterModel::registerBasic()

This leads me to belive that there is something that I'm
missing in the setup of the Driver, can this be the case?

Thanks,
Robert

---

From: "Nicolas Vizerie" <[email-masked]>
Date: Wed, 27 Feb 2002 12:36:25 +0100

Hi Robert,

That seems to be a bug : I was able to reproduce that in release build. It
comes from the ordering of transparent objects. I found that a bitfield in a
COrderingLayeredTable was not working correctly with Visual C++ in release
build only (in the begin() method). Tracing it showed that it may be a
compiler bug. I split it in several fields and it solved the problem. The
fix will be available on the CVS.
If this doesn't solve your problem, could you report it ?
Thanks.
Nicolas Vizerie

----- Original Message -----
From: "Robert Bjarnason" <[email-masked]>
To: "Nicolas Vizerie" <[email-masked]>
Sent: Tuesday, February 26, 2002 9:05 PM
Subject: Re[2]: [Nel] Enabling Water Pools in Client

> UInstanceGroup  *waterIg =
UInstanceGroup::createInstanceGroup(std::string("9_AO.ig"));

---

From: Robert Bjarnason <[email-masked]>
Date: Thu, 28 Feb 2002 04:15:42 -0800

Hi Nicolas,

NV> That seems to be a bug : I was able to reproduce that in release build. It
NV> comes from the ordering of transparent objects. I found that a bitfield in a
NV> COrderingLayeredTable was not working correctly with Visual C++ in release
NV> build only (in the begin() method). Tracing it showed that it may be a
NV> compiler bug. I split it in several fields and it solved the problem. The
NV> fix will be available on the CVS.
NV> If this doesn't solve your problem, could you report it ?

It did solve my problem, thank you very much.
I had also tried running it in ReleaseDebug and
it had the same behavior there but works fine in
both now.

Warm regards,
Robert

---

From: Loic Dachary <[email-masked]>
Date: Thu, 28 Feb 2002 09:37:37 +0100

Hi,

	Could you please commit the corresponding changes to the
:pserver:[email-masked]:/cvsroot/bang CVS tree so that we can
try them ?

	Thanks in advance,

-- 
Loic   Dachary         http://www.dachary.org/  [email-masked]
12 bd  Magenta         http://www.senga.org/      [email-masked]
75010    Paris         T: 33 1 42 45 07 97          [email-masked]
        GPG Public Key: http://www.dachary.org/loic/gpg.txt

---

From: Robert Bjarnason <[email-masked]>
Date: Thu, 28 Feb 2002 13:16:37 -0800

Hi Loic,

LD>         Could you please commit the corresponding changes to the
LD> :pserver:[email-masked]:/cvsroot/bang CVS tree so that we can
LD> try them ?

Nicolas at Nevrax made those changes and they were committed to
the Nevrax CVS tree yesterday.

The demo app I'm using to load the Water Pools has a minor
addition that has to do with enabling the WaterPoolManager.
I will upload that code tree to our new development server
at http://savannah.gnu.org/projects/bang/ in the next
few days. We decided to leave SourceForge because of the
recent changes in there hosting licence.

Warm regards,
Robert Bjarnason