Home Unity

unity, strumpy shader editor question

mod
Offline / Send Message
rooster mod
hey folks

I'm trying to create a shader in strumpy shader editor and I'm way out of my depth..

I think it should be easy to make though, and I was hoping for some tips?

the first step is I want lights to affect the shader like 'area lights', or ambient- basically, they light the object purely by distance to the light, regardless of whether the surface is facing or not

secondly, I want to use a gradient ramp and apply it to this lighting method (specifying an image as the ramp)

can anyone here help with this idea?
thanks!
-Rich

Replies

  • seforin
    Options
    Offline / Send Message
    seforin polycounter lvl 17
    With the gradient ramp are you looking to have it control the color gradient like teamfortress/rim lighting based?
  • rooster
    Options
    Offline / Send Message
    rooster mod
    sort of yeah, so that bright colour = one end of the gradient, dark = the other end of the gradient. There's a demo shader which comes with struffy editor which uses a gradient ramp but with regular shading so I might be able to figure that out once I solve the lighting method
  • seforin
    Options
    Offline / Send Message
    seforin polycounter lvl 17
    hit me up on messenger and I'll help you out later if you want.
  • Farfarer
    Options
    Offline / Send Message
    It's doable, but I don't know if Strumpy exposes the variables needed. There's _LightPosition0 and it's w component is 1/range.

    I could probably knock it up in regular shader code for you if you need it?
  • rooster
    Options
    Offline / Send Message
    rooster mod
    hmm, maybe it's more complicated than I figured. Ideally I'd like the lights range and intensity to come into play.. can a shader pick those up too?

    I'd ideally prefer doing it in strumpy so I can tweak it.. I don't have a clue how to edit text shaders :(

    (ps- thanks for the offer :) I may still accept, but I'll keep trying with strumpy first)
  • Farfarer
    Options
    Offline / Send Message
    If you're not using shadows, then the light's attenuation value should do exactly what you need.

    As for intensity, you can probably do that with the luminosity of the light's colour... which you can get if you dot product the colour rgb against float3(0.22, 0.707, 0.071).

    Then multiply the two together and feed it into your ramp texture lookup as UV coordinates.
Sign In or Register to comment.