Home Unity

Amplify Shader Techniques and Tutorials

polycounter lvl 7
Offline / Send Message
ken0y polycounter lvl 7
Hey,

I've recently just started playing around with Amplify Shader for Unity but the resources seem somewhat thin on the ground. 

I wanted to make a thread where we could share techniques etc. This may already exist but I haven't found it yet. If that is the case then I'd love to know where.

I'd like to start with a problem I am trying to solve.

Basically I am trying to map a unique gradient to each face based off of world normal position. I can map a solid colour to each face using the method described but things fall apart when I try to use a gradient via lerp.

I've been using this as a starting point (Shader Forge):


This is where I am at (Amplify Shader Editor):



But this is what I end up with when trying to map gradients to the normal direction. 


node setup:

https://imgur.com/a/9hQkc

Ideally, I'd like the gradient to be mapped relative to the scale of the object I'm not sure how.

Thanks





Replies

  • jStins
    Offline / Send Message
    jStins interpolator
    Good idea for a thread! I don't have a solution for your specific problem unfortunately, but I've found UE4 shader setups to be pretty useful / transferable to Unity via Amplify. 
  • RyanB
    Sounds like you want a tri-planar shader. 

  • ken0y
    Offline / Send Message
    ken0y polycounter lvl 7
    Hey and thanks for the replies! 

    @RyanB Do you think that triplanar projection could be used in conjunction with lerp gradients, rather than relying on world normal direction?

    Anyway, I made some progress:

    I've managed to produce a separate LERP gradient for world normal direction.

    I plan on using Triplanar projection to overlay a pattern on each lerp but when I do it changes the resulting emission:

    The patterned texture uses alpha so it should only really be showing the black pattern and therefore I'm not sure why it's affecting the overall luminance? 

    I've seen this happen quite a lot whilst I'm experimenting and would love to know the processes behind why these changes occur.

    Things I'd still like to figure out:

    - How to control gradient position and scale relative to the object's position and scale in local space. Basically I want the lerp min max of the lerp to reflect the object's scale even after moving the mesh.
    - How to maintain gradient whilst rotating (maybe something to do with transform matrices?)

    Thanks for the help :)


Sign In or Register to comment.