This project is read-only.

Installing the project...

  1. Unzip the download and place in your Visual Studio Projects folder.
  2. Add as an additional project to your current SunBurn project.
  3. In the Effects folder of the WaterRenderHelperLib project you will find two files: Water.mat and WaterWaves.fx. Add these files to your current content project.
  4. Water.mat should use the "Material - SunBurn deferred material" content importer and processor.
  5. WaterWaves.fx should use the "Effect - XNA Framework" content importer and the "Effect - SunBurn lighting effect" content processor.
  6. Add a reference to the WaterRenderHelperLib.dll in your main project.

Using it!

There are 3 classes and 1 interface included in the project as of this release (0.1):
  1. BaseWater is an abstract class that all other water entities should be derived from.
  2. IWaterObjectManager interface provides an extension to the standard SunBurn ObjectManager.
  3. ReflectiveWater class provides a reflective/refractive water entity in the SunBurn editor.
  4. WaterRenderHelper class provides helper methods for rendering to reflective/refractive render targets.

Create a new SunBurn ObjectManager derived from the default ObjectManager, but also implement the interface IWaterObjectManager.
This requires you to implement one property and two methods:
  1. WaterBasedEntities property - must hold a list of any water objects added to the scene. You can override the Submit and Remove methods to do this.
  2. SuspendWaterBasedEntities method - must remove any water objects from the scene when called.
  3. RestoreWaterBasedEntities method - must restore any previously removed water objects.

Create an instance of WaterRenderHelper() during initialisation of your game.
: _waterRenderHelper = new WaterRenderHelper(_graphics, _sceneManager, DetailPreference.Low, 512);

Now, before the call to SceneState.BeginFrameRendering(...) call the WaterRenderHelper.Render() method...
_waterRenderHelper.Render(_View, _Projection, gameTime, _SceneEnvironment);

You will also need to re-apply the main scene's lighting preferences afterwards by calling:
SceneInterface.ApplyPreferences({lighting prefs here});

And that's it! Now compile, run your game and fire up the SunBurn editor. You should see the ReflectiveWater entity in the browser. Drag and drop it into your scene and play around with the settings.

Note: There are also a few settings available under the Custom Effects tab.

Last edited Jul 10, 2011 at 11:08 AM by cjhazard, version 2


No comments yet.