Jump to content

Gradient based of normal


MadMax50

Recommended Posts

Hey !

I am trying to achieve a gradient based on my normal direction. For example if my Normal is set to (0,0,1), i want a black and white falloff in that direction.

I already made this happen (sort of), but my issue is when I inverse the Normal like (0,0,-1),  my color turns black. 

Is there anyway to fix this?

Thanks!

Normal_Gradient.hip

Link to comment
Share on other sites

When you negate your Normals, your color values are going from 0 to -1.

You need to check the sign ( + or - ) of each vector component of the Normal. If it is negative, you need to take the compliment of the Position component [ ex. (1-P.x) ]  then do absolute value.

grad.thumb.JPG.d5a8c3ef9743e5c2efc731080eebc464.JPG

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...