got it now: renders will follow soon:
Code: Select all
<albedo>
<shader>
<shader>
<![CDATA[
# 2D colored gradient shader V
def colorCalc(real x) vec3 :
vec3(
# color1 = red (0.75,0,0)
# color2 = green (0,0.75,0)
# compute color mix
# color1 \/ color2 \/
add(mul(0.75,x),mul(sub(1.0,x),0.00)),
add(mul(0.00,x),mul(sub(1.0,x),0.75)),
add(mul(0.00,x),mul(sub(1.0,x),0.00))
)
def eval(vec3 pos) vec3 :
colorCalc(dotj(getTexCoords(0)))
]]>
</shader>
</shader>
</albedo>
heres the z up gradient thingy with color:
Code: Select all
<albedo>
<shader>
<shader>
<![CDATA[
# 3D colored gradient shader Z (up) with center = 0.5
def colorCalc(real x) vec3 :
vec3(
# color1 = blue (0,0,0.75)
# color2 = green (0,0.75,0)
# compute color mix
# color1 \/ color2 \/
add(mul(0.00,x),mul(sub(1.0,x),0.00)),
add(mul(0.00,x),mul(sub(1.0,x),0.75)),
add(mul(0.75,x),mul(sub(1.0,x),0.00))
)
def eval(vec3 pos) vec3 :
colorCalc(div(mod(add(dotk(pos),div(0.6,2.0)),0.6),0.6))
]]>
</shader>
</shader>
</albedo>
edit: just notced there was some color clamping going on in the 3d gradient. fixed now