|
I am using a vertex shader, that relies on the position of the Camera.. I am unable to get the camera used in Scene Editor.. is there a way to get teh camera position in the Shader Lib, without setting it as a variable? ( like a pre-defined one, that includes the scene editor camera ); Otherwise I'd like to know how I can grab the Camera GameObject from the Scene Editor
(comments are locked)
|
|
Have you checked the Vertex shaders that are included with Unity? Their source code can be downloaded here: http://unity3d.com/support/resources/assets/built-in-shaders Perhaps you could review the source of the built-in Vertex shader to see how they overcome this problem? after reviewing all of those sources, the built-in shaders seem to have no indication of having any direct access to any camera position.
Jun 15 '10 at 10:01 AM
N1nja
I'm not going to pretend I understand vertex sahders, but if the built-in vertex shaders don't use the current camera's position, why do you need it?
Jun 16 '10 at 01:11 AM
qJake
(comments are locked)
|
|
Hi, take a look at this: link text unity sets those state variables according to the current camera, object and lights. Since the model*view matrix transforms objects from local to eye space, you can assume that the camera is located at (0,0,0). Bye!
(comments are locked)
|

Fixed your title so people know it's for ShaderLab and not an editor script.