Fog Layer

From Unify Community Wiki
Revision as of 18:26, 5 October 2006 by Joeante (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Author: Joachim Ante

Contents

Description

This

Usage

Add this script to

You might want to change Vector3.back to Vector3.front, depending on the initial orientation of your object.

Technical Discussion

Note that the script doesn't simply point the object at the camera. Instead, it makes the object point in the same direction as the camera's forward axis (that is, the direction the camera is looking in). This might seem intuitively wrong, but it's actually correct for the one-point-perspective world of realtime computer graphics.

Javascript- FogLayer.js

<javascript> /*

This script lets you enable and disable per camera.
By enabling or disabling the script in the title of the inspector, you can turn fog on or off per camera.
  • /

private var revertFogState = false;

function OnPreRender () { revertFogState = RenderSettings.fog; RenderSettings.fog = enabled; }

function OnPostRender () { RenderSettings.fog = revertFogState; }

@script AddComponentMenu ("Rendering/Fog Layer") @script RequireComponent (Camera) </javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox