diff options
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index d2c9ad7cfd1..633112095a7 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1415,6 +1415,16 @@ void mtex_nspace_tangent(vec4 tangent, vec3 normal, vec3 texnormal, out vec3 out outnormal = normalize(outnormal); } +void mtex_nspace_world(mat4 viewmat, vec3 texnormal, out vec3 outnormal) +{ + outnormal = normalize((viewmat*vec4(texnormal, 0.0)).xyz); +} + +void mtex_nspace_object(mat4 viewmat, mat4 obmat, vec3 texnormal, out vec3 outnormal) +{ + outnormal = normalize((viewmat*(obmat*vec4(texnormal, 0.0))).xyz); +} + void mtex_blend_normal(float norfac, vec3 normal, vec3 newnormal, out vec3 outnormal) { outnormal = (1.0 - norfac)*normal + norfac*newnormal; @@ -2124,6 +2134,20 @@ void node_fresnel(float ior, vec3 N, vec3 I, out float result) result = fresnel_dielectric(I, N, (gl_FrontFacing)? eta: 1.0/eta); } +/* gamma */ + +void node_gamma(vec4 col, float gamma, out vec4 outcol) +{ + outcol = col; + + if(col.r > 0.0) + outcol.r = compatible_pow(col.r, gamma); + if(col.g > 0.0) + outcol.g = compatible_pow(col.g, gamma); + if(col.b > 0.0) + outcol.b = compatible_pow(col.b, gamma); +} + /* geometry */ void node_attribute(vec3 attr_uv, out vec4 outcol, out vec3 outvec, out float outf) |