About Me

Hi. I'm Josh Ols. Lead Graphics Developer for RUST LTD.

Contact:
crunchy.bytes.blog[at]gmail[dot]com

View Joshua Ols's profile on LinkedIn

Meta
« Parallax/POM + Detail Mapping Gotchas | Main | Unity Shader Gotcha #10 - Exclude PrePass »
Saturday
Oct112014

Unity Shader Gotcha #11 - World Normals

So it turns out that Unity's WorldNormalVector() and WorldReflectionVector() macros only return world-space vectors for the shader's generated forward base pass, and not its forward add pass. So say you wanted to try to do some sort of direct lighting trick that relies on world space normals, it would work for the directional light in the forward base pass, but then fail for lights in the forward add pass. 

As a result of this limitation, and the fact that Unity seems to have abandoned surface shaders for their new Standard shader, we at RUST LTD are officially abandoning surface shaders for Alloy development. Going forward, we will be using our own framework built on top of raw vertex, fragment, geometry, etc shaders. This is more complex to maintain and develop, but gives us maximum control to add and optimize new features. 

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (13)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Response: aliasy
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Response: Amir Mojiri London
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Response: Superior Muscle X
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Response: agen poker
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Response: eye derm x Reviews
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals
  • Response
    Crunchy Bytes - Journal - Unity Shader Gotcha #11 - World Normals

Reader Comments (2)

Unity seems to have abandoned surface shaders for their new Standard shader"
I think that you are wrong in this one. I have read plenty of times that they are not dropping surface shaders in Unity5. Aras (Unity Dev) mentioned that in different forum topics that they are going to add support for extended gbuffer and other illumination-related stuff for surface shaders.

Other than that, dropping surface shaders is basically a good move since building your own solution always gives better controll over things.
January 8, 2015 | Unregistered Commentervarfare
Yeah, this post was made long before they added the APIs to access the new lighting features from Surface shaders. Still, we've made the move to raw shaders, and yes the greater degree of control has made so many things so much simpler.
January 8, 2015 | Registered Commentern00body

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.