Created
March 3, 2016 02:44
-
-
Save ikrima/84ee4200f11daaddff77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Color balls with spherical falloff | |
//Lerp between start to end colors | |
float distToSphere = distance(inPixelWpos, inSphereCenterWpos); | |
float alpha = saturate(distToSphere / sphereRadius); | |
float3 outColor = lerp(StartColor, EndColor, alpha); | |
//Determine falloff power to sphere radius | |
float falloff = saturate(falloffScale * (alpha - 0.5) + 0.5 - falloffBias); | |
float falloffPower = -(falloff * falloff * (3 - 2 * falloff)) + 1; | |
return float4(outColor, distToSphere > sphereRadius ? 0 : falloffPower); | |
//Gradient Remap based on luminosity | |
//Lerp between start to end colors | |
float distToSphere = distance(inPixelWpos, inSphereCenterWpos); | |
//float alpha = smoothstep(0, sphereRadius, distToSphere); | |
float alpha = saturate(distToSphere / sphereRadius); | |
//Calculate luminosity | |
float luminosity = saturate(dot(float3(0.299, 0.587, 0.114), inColor)); | |
float3 outColor = lerp(StartColor, EndColor, smoothstep(0,1,luminosity)); | |
//Determine falloff power to sphere radius | |
float falloff = saturate(falloffScale * (alpha - 0.5) + 0.5 - falloffBias); | |
float falloffPower = -(falloff * falloff * (3 - 2 * falloff)) + 1; | |
return float4(outColor, distToSphere > sphereRadius ? 0 : falloffPower); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment