Author Topic: Suimono layers?  (Read 879 times)

dinosaursssssss

  • Newbie
  • *
  • Posts: 2
    • View Profile
Suimono layers?
« on: July 18, 2017, 10:02:36 AM »
Hi, I have been evaluating the suimono water system for use on a project, and I'm concerned about the number of layers it uses; our project is very large and we are approaching the limit of layers that Unity can handle (32). Suimono creates 3 layers of its own (water, depth, and screen), which potentially makes it unusable for us. Can you please explain what these layers are for, and if we can get away with using fewer of them? Or, for example, is there any reason I couldn't just change my water object to be on Unity's default 'Water' layer to avoid adding unneccesary extra layers?

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1587
    • View Profile
    • Tanuki Digital
Re: Suimono layers?
« Reply #1 on: July 18, 2017, 10:55:52 AM »
Hi Dinosaursssssssssss,

In the future I might find better ways to control the layer usage, but currently for full functionality Suimono requires all 3.  I'll descrbe what each does below:

Suimono_Water - This contains the Suimono water surfaces and is used to render two render passes, one for the water surface itself, and the second for the scene without the water surface for transparency composition.  It's important that ONLY SuimonoSurface objects are on this layer.

Suimono_Screen - This is used for special effects generation.  Particularly for screen normals reconstruction which is used for the refracive effect on the water ripple effect.

Suimono_Depth - This is used exclusively for Shoreline Object depth generation.  It renders shorelineObject meshes which need to be invisible to the main camera, then passes the buffer to the surface for wave shoreline generation effects.

Since you are on an extremely limited layer budget, you can customize the code a bit in order to consolidate some layers.  If you know you don't need ripple effects, and if you aren't using any shoreline objects for wave generation in your scene you can consolidate even further.  I'll explain how to do this below... the code edits assume you're using the latest version (2.1.4) but similar edits should work for older versions as well...

Consolidate to "Water" Layer:
1) Open up SuimonoModule.cs and search for "void InitLayers ()" which should bring you to the 'Init Layers' function.  In this section replace every instance of "Suimono_Water" with "Water" instead.
2) Open up the SuimonoObject.cs file and search for "gameobject.layer"  This will take you to the Set Layer Mask section.  Comment out the 4 lines in this section like so:
Code: [Select]
//-------------------------------------------------------
//###  SET LAYER MASK  ###
//-------------------------------------------------------
//gameObject.layer = moduleObject.layerWaterNum;
//if (suimonoObject != null) suimonoObject.layer = moduleObject.layerWaterNum;
//if (scaleObject != null) scaleObject.layer = moduleObject.layerWaterNum;
//if (surfaceReflections != null) surfaceReflections.gameObject.layer = moduleObject.layerWaterNum;
3) Go to the SuimonoModule and uncheck the "Set Automatic Layers" option.
4) Go to the SuimonoModule and remove the "Water" layer from the transparency render layers list.
5) Go to Edit-->Project Settings-->Physics and uncheck the water layer from every other layer in the matrix.
6) Go to your Suimono_Surface object in your scene, and set the layer to "Water" (and it's child objects too!).
7) Delete the Suimono_Water layer.

Remove "Suimono_Screen" Layer:
Note that you won't be able to use Ripple distortion effects properly.
1) Open the SuimonoModule.cs file and search for the following "SET COMPONENT LAYERS".  This will bring you tot he layer assignment for these effects.
2) comment out the two lines under this section as follows:
Code: [Select]
//SET COMPONENT LAYERS
//if (normalsCamObject != null) normalsCamObject.cullingMask = 1<<layerScreenFXNum;
//if (wakeCamObject != null) wakeCamObject.cullingMask = 1<<layerScreenFXNum;
3) Search for "fxRippleObject.layer = layerScreenFXNum;" and comment out this line.
4) If you are using any ripple fx objects you should disable them, else they will not render properly.
4) Delete the Suimono_Screen layer.

Remove "Suimono_Depth" Layer:
Note that you won't be able to use ShorelineObjects properly.
1) Go to the SuimonoModule-->cam_SuimonoShoreline object, and Disable it.
2) If you have any ShorelineObjects in your scene, disable them as well.
3) Delete the Suimono_Depth layer.

Following the above steps should allow you to consolidate or disable all the Suimono layers.  Just make sure that you don't have any other objects on the "Water" layer other than your Suimono_Surface objects, else there may be unexpected rendering issues.

Hope this helps!
« Last Edit: July 18, 2017, 10:58:34 AM by Chingwa »

dinosaursssssss

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Suimono layers?
« Reply #2 on: July 18, 2017, 01:30:11 PM »
Wow, that's extremely helpful! Thanks so much for the quick response, if I have any issues I'll let you know.

Anibisala

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Suimono layers?
« Reply #3 on: October 25, 2017, 04:06:07 AM »
I like this way of thinking is very high.