Map graphics configuration¶
There are many ways the map can customise the graphical rendering of the game through configurations.
It involves the following configuration fields:
Name | Type | Description | Default |
---|---|---|---|
fogend | float | The starting value of RenderSettings.fogEndDistance | 300.0 |
fogcolor | Color | The starting value of RenderSettings.fogColor | Pure white |
screeneffect | ScreenEffects | If this is SunRaysTopRight , inside SetScreenEffect, a new Prefabs/Particles/SunRay is instantiated childed to the GUICamera with a local position of (9.0, 7.0, 10.0) without rotations |
None |
skyboxmat | Material | The skybox material to use for this map when this field isn't null (also will have its shader _Tint set to pure gray when not in an inside). If this field is null, skybox is set to null (so no skybox), but MainManager.MainCamera .backgroundColor will be set to pure black |
null |
overrideskybox | bool | If true, it prevents FixedUpdate to update the _Rotation shader property of the skybox. It also prevents any material's color to be updated in FixedUpdate when entering or exiting an inside. NOTE: It is NOT recommended to set this to true because it has unintended side effects with insides |
false |
globallight | Color | The starting value of RenderSettings.ambientLight | Pure gray |
windspeed | float | Configures the range of values possible for the _ShakeDisplacement shader property of a material using the MainManager.windshader . This shader is only used during the SetUp of a BeetleGrass when MainManager.nowindeffect is false where the grass will get this shader as its sprite 's material. The shader property will have a random value that range from X / 2.0 to X where X is the value of this field. NOTE: Because this property is unused in that shader, this value effectively does nothing. The intended property was likely _ShakeWindspeed which would have configured the speed of the shaking, but it is not configurable under normal gameplay |
0.2 |
windintensity | float | Configures the range of values possible for the _ShakeBending shader property of a material using the MainManager.windshader (this property controls the amount of warping to apply to the object as a result of the wind). This shader is only used during the SetUp of a BeetleGrass when MainManager.nowindeffect is false where the grass will get this shader as its sprite 's material. The shader property will have a random value that range from X / 2.0 to X where X is the value of this field |
0.2 |
faderchange | bool | If true, all Fader will fade all their Renderer instead of culling them completely. Also, on Start, faders and fss gets their initialised on the first LateUpdate, but they are UNUSED |
false |
skycolor | Color | If a Fader is set to fade its GameObject's materials (forced to be the case if faderchange is true), this is the color tint to set the materials's colors to in RGB (the A component is ignored since Fader controls it) |
Pure white |
Fog¶
Maps can configure a Unity's fog effect by controlling RenderSettings.fogEndDistance (using the fogend
configuation field) and RenderSettings.fogColor (using the fogcolor
configuration field). The former controls the rendering distance one can see before seeing fog and the latter controls the color of the fog.
screeneffect
¶
This field has a special enum type called ScreenEffects
and it only has 2 values possible: None
and SunRaysTopRight
. Only the latter value does something and it is to render a sun ray visual effect on the top right of the GUICamera
.
Skybox control¶
By default, maps won't have a skybox and instead, have pure black rendered as the background. This is because the default behavior is to have RenderSettings.skybox set to null and to have MainCamera
's backgroundColor set to pure black.
However, maps can define a skybox to render behind the map instead. Setting up one involves the skyboxmat
configuration field which defines the material of the skybox to use.
The skybox material is meant to use the "Skybox/6 sided" shader which comes with Unity. This is because the map automatically manages its _Tint
and _Rotation
properties in the following ways:
_Rotation
: On FixedUpdate, if a skybox exists andoverrideskybox
is false (see the section below for details), the value of this property changes to be 180.0 +MainCamera
's x position. Basically, the skybox rotates depending on the horizontal position of the camera._Tint
: This property has some management done on it, but effectively, it maintains the default value being pure gray and the game can fade it to pure black when needed:- On Start, if there was an existing skybox, its
_Tint
gets set to pure gray when not in an inside - Pure gray is also the default
_Tint
value of theskyboxmat
as it's set when setting up the skybox (ifskyboxmat
isn't null) - On FixedUpdate, if a skybox exists,
nocolorchange
is false (only is true in certain areas under AreaSpecific) andoverrideskybox
is false (see the section below for details), the value of this property changes wheneverfadeammount
changes. This happens as a result of fading the insides when entering / exiting one, the_Tint
value changes withfadeammount
using a color whose r, g and b component are allfadeammount
clamped from 0.0 to 0.5 (from pure black to pure gray). Basically,fadeammount
changes causes the_Tint
of the skybox to change to pure black when fading the outside and then back to pure gray again when fading out the outside
- On Start, if there was an existing skybox, its
overrideskybox
¶
There is another skybox related configuration field, but it only takes effect if there is a skybox meaning that skyboxmat
didn't had a null value when the map started.
Having this field true implies several changes in FixedUpdate:
- insides fading won't happen meaning
fadeammount
won't change and therender
materials won't change. It also means that the_Tint
of the skybox won't change either - The
_Rotation
property of the skybox won't change with theMainCamera
x position
It's essentially a configuration that prevents the skybox from having its material properties changed, but enabling it also prevents the insides fading logic to happen in general when entering or exiting an inside.
It should be noted that this setting is only used in the SnakemouthUndergroundDoor
map and it was added as an attempt to make its skybox (Cavern2
) look better visually since it didn't look satisfactory. However, this doesn't end up doing anything different visually because it was decided during development to simply scrap the skybox (along with Cavern1
which had similar visual problems) and to instead mask them by adding black walls.
This setting can therefore be considered almost unused because while it is technically used and does function, the side effects related to the insides fading isn't expected. It is therefore not recommended to set this field to true.
globallight
¶
This configuration field controls RenderSetting.ambientLight. It allows the game to configure the color of the ambient lighting which is lights that gets emitted by Unity throughout the scene.
Wind control¶
BeetleGrass are setup with a special shader in their sprite
's material: MainManager.windshader
. This shader comes with 2 properties which can be controlled by configuration fields whose value express a random range from X
/ 2.0 to X
where X
is the value:
_ShakeDisplacement
(controlled bywindspeed
): This property actually doesn't do anything because it's not used in the shader. It is very likely that the correct property should have been_ShakeWindspeed
which would have changed the speed of the shaking, but because this one is not configurable, it's not possible to configure the shaking speed via MapControl_ShakeBending
(controlled bywindintensity
): Configures the amount of warping to apply as a result of the wind shaking
Fader control¶
Fader is a dedicated component that can be applied to any GameObjects on a map. It will through camera distance checking hide its GameObject by setting its Renderer's shadowCastingMode to ShadowsOnly
. This is done because it's possible some objects could occlude the camera so much that they take a large portion of the screen. Those objects gets a Fader component so they can be hidden earlier than the camera's near clip plane culling would. This works by collecting all Renderer components in a field called renders
and messing with all of them at once (not to be confused with MapControl's render
which is something different).
The default of a Fader is to simply cull the GameObject when out of range, but there is another opt-in mode: fading the GameObject through a different shader (usually MainManager.Fade3D
or MainManager.fadePlane
) before hiding it instead of just changing the shadowCastingMode. Any maps can opt-in to this fading behavior for all Fader present by having the faderchange
configuration field set to true. However, no matter what the value of this field is, the following areas will always have this behavior:
FarGrasslands
WildGrasslands
WaspKingdom
It's also possible for an individual Fader to force itself to operate in this mode if its alwaysfade
field is true which is expected to be done from the map's prefab where the Fader is defined.
skycolor
¶
On top of the fading behavior (whether or not it was caused by faderchange
being true), it's possible to change the color of the fading done (when the fading shader used is MainManager.Fade3D
). It can be done through changing the skycolor
configuration field. Since the Fader controls the alpha component of the color, only the r, g and b components of this field will be used. If the fading mode of the Fader isn't used, the skycolor
configuration field won't do anything.
There is an override on this field on AreaSpecific: if the area is WaspKingdom
and skycolor
converted to Vector3 has a magnitude above 0.9, it is overriden to pure gray.