View Full Version : unity, strumpy shader editor question
04-03-2012, 09:50 AM
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?
04-03-2012, 12:02 PM
With the gradient ramp are you looking to have it control the color gradient like teamfortress/rim lighting based?
04-03-2012, 12:14 PM
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
04-03-2012, 12:26 PM
hit me up on messenger and I'll help you out later if you want.
04-03-2012, 03:26 PM
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?
04-03-2012, 03:36 PM
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)
04-04-2012, 01:05 AM
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.
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.