Fog Layer

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
 
(Technical Discussion)
Line 11: Line 11:
 
You might want to change Vector3.back to Vector3.front, depending on the initial orientation of your object.
 
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- FogLayer.js==

Revision as of 18:26, 5 October 2006

Author: Joachim Ante

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.


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