Unity Manual>Frequently Asked Questions>Upgrading your Unity Projects from 2.x to 3.x>Rendering upgrade details
Unity 3 brings a lot of graphics related changes, and some things might need to be tweaked when you upgrade existing Unity 2.x projects. For changes related to shaders, see Shader Upgrade Guide.
Unity 2.x had one rendering path, which is called Forward in Unity 3. Major changes in it compared to Unity 2.x:
See Shader Upgrade Guide for more details. Largest change is: if you want to write shaders that interact with lighting, you should use Surface Shaders.
!!ATIfs
assembly shaders).
OnPreCullObject
and RenderBeforeQueues
attribute.
texture.GetNativeTextureID()
instead.
_ObjectSpaceCameraPos
and _ObjectSpaceLightPos0
(added _WorldSpaceCameraPos
and _WorldSpaceLightPos0
).
LightmapMode
tag in shader texture property does nothing now.
GrabPass
(i.e. refractive glass shader) now always grabs texture of the size of the screen.
#pragma multi_compile_vertex
and #pragma multi_compile_fragment
are gone.
Offset [_Var1], [_Var2]
).
TRANSFER_EYEDEPTH/OUTPUT_EYEDEPTH
to UNITY_TRANSFER_DEPTH/UNITY_OUTPUT_DEPTH
. They also work on a float2 in Unity 3.
_Light2World0
, _World2Light0
built-in shader matrices.
_FirstPass
built-in shader float.
Fog { Mode [_MyFogMode] }
). To use global fog mode, write Fog { Mode Global }
.
BlendColor
color from ShaderLab.
RenderTexture.SetBorderColor
).
ColorMaterial Ambient, Diffuse, Specular
support (ColorMaterial AmbientAndDiffuse & Emission left). Support for the removed ones varied a lot depending on the platform causing confusion; and they didn't seem to be very useful anyway.
_CameraToWorld
and _WorldToCamera
matrices now do what you'd expect them to do. Previously they only contained the rotation part, and camera-to-world was flipped on Y axis. Yeah, we don't know how that happened either :)
Shader.ClearAll()
. Was deprecated since 2007, time to let it go.
#pragma target 1.1
in the shader.
Page last updated: 2010-09-25