Back to main page

Enviroment

It is usually spelled "Environment" but any alternative spelling that is shorter is useful when programming.

void Enviroment_SetBackgroundColor(float Red, float Green, float Blue, float Alpha);

The background color is used where nothing has been rendered.

The background color is used as the fog color since looking at infinity through fog would show the fog's color.

Sets the background color to the new color (Red,Green,Blue,Alpha) created from your arguments.

void Enviroment_GetBackgroundColor_OutV4(void);

Writes the background color to (X1,Y1,Z1,W1) in the matrix buffer.

void Enviroment_SetFarClipPlane(float NewValue);

100 is the default far clip plane.

NewValue > 0 but no warning is given since the error is harmless.

Sets the far clip plane to NewValue.

float Enviroment_GetFarClipPlane(void);

Returns the far clip plane.

void Enviroment_SetNearClipPlane(float NewValue);

0.01 is the default near clip plane.

NewValue > 0 but no warning is given since the error is harmless.

Sets the near clip plane to NewValue.

float Enviroment_GetNearClipPlane(void);

Returns the near clip plane.

void Enviroment_SetMaxFogIntensity(float NewValue);

Max fog intensity is a value that will multiply the amount of fog in the scene.

0 means no fog.

0.5 means up to 50% opacity.

1 means realistic fog so that you can't see the far clip plane.

0 ≤ NewValue ≤ 1

Sets the maximum fog intensity to NewValue.

float Enviroment_GetMaxFogIntensity(void);

Returns the maximum fog intensity.

void Enviroment_SetMediumHighDetailLimit(float NewValue);

The limit between medium and high detail level is defined by the distance to the point given to Enviroment_UpdateAutomaticDetailLevels (Usually the main camera's position).

For this to work, the models must use multi resolution and the instances must use automatic detail level using Instance_SetAutoDetailLevel.

(Far clip plane > low to medium > medium to high > near clip plane) must be true to use each detail level. It is not enforced because the limits are affecting each other's preconditions.

Sets the limit between medium and high detail level to NewValue.

float Enviroment_GetMediumHighDetailLimit(void);

Returns the limit between medium and high detail level.

void Enviroment_SetLowMediumDetailLimit(float NewValue);

The limit between low and medium detail level is defined by the distance to the point given to Enviroment_UpdateAutomaticDetailLevels (Usually the main camera's position).

For this to work, the models must use multi resolution and the instances must use automatic detail level using Instance_SetAutoDetailLevel.

(Far clip plane > low to medium > medium to high > near clip plane) must be true to use each detail level. It is not enforced because the limits are affecting each other's preconditions.

Sets the limit between low and medium detail level to NewValue.

float Enviroment_GetLowMediumDetailLimit(void);

Returns the limit between low and medium detail level.

void Enviroment_UpdateAutomaticDetailLevels(float X, float Y, float Z);

Use Instance_SetAutoDetailLevel with the instances that you want to modify using this call.

Use this call with your main camera's position before a group of rendering calls so that the detail levels are consistent between different cameras that create one image.

Each instance with automatic detail level be updated using the distance to (X,Y,Z) and the detail level limits.

void Enviroment_UseAsSkyInstance(int Instance);

Place the sky instance around the camera before rendering. Don't forget to do this when rendering reflections.

Do not cast shadows from the sky instance by removing all shaders in shader channel 1.

Use WorldToCamera_NoRefraction instead of WorldToCamera in the sky's vertex shader. Apply the refraction in the pixel shader by refracting the view direction that you use to sample the sky color.

Do not use a bounding volume or clip pixels with the cutting plane since the position is not refracted in the vertex shader.

Any items that you want in the sky should be raytraced in the sky's shader instead of being another instance.

Instance is a valid instance reference or 0 for removing it.

Instance is drawn first without writing to the depth buffer so that it is drawn behind everything else to make it look bigger.