Jump to content

Shader Based On Normals


Recommended Posts

Hi Everybody....

I am trying to create a Terrain Shader. I have written Displacement shader, and facing a problem while writing surface shader. I want to shade the surface based on the slope, say Green for Horizontal surface and Red for vertical surface. Polygon Normal's Y component varies from 0 to 1 for Horizontal To Vertical. So I have a Spline which has Normal.Y as the input. It is giving me result, but the shader is changing as I move the camera. I tried all space combinations inside Vops. But not working. What can be the problem???

----iamjaideep80

Jaideep Khadilkar

TD, Sciclone Motion Graphics

Link to comment
Share on other sites

Hi Everybody....

I am trying to create a Terrain Shader. I have written Displacement shader, and facing a problem while writing surface shader. I want to shade the surface based on the slope, say Green for Horizontal surface and Red for vertical surface. Polygon Normal's Y component varies from 0 to 1 for Horizontal To Vertical. So I have a Spline which has Normal.Y as the input. It is giving me result, but the shader is changing as I move the camera. I tried all space combinations inside Vops. But not working. What can be the problem???

----iamjaideep80

Jaideep Khadilkar

TD, Sciclone Motion Graphics

This is just guessing:

The Colors change because the normal you use depends on the camera.

You could add a explicit normal attribute reference this in your shader.

Georg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...