From d3758892987d76749fdf1211ed27ff77f39b5b3b Mon Sep 17 00:00:00 2001 From: Charlie Jolly Date: Tue, 23 Mar 2021 09:21:56 +0000 Subject: Nodes: Add Refract and Faceforward functions to Vector Maths nodes Cycles, Eevee, OSL, Geo, Attribute Based on outdated refract patch D6619 by @cubic_sloth `refract` and `faceforward` are standard functions in GLSL, OSL and Godot shader languages. Adding these functions provides Blender shader artists access to these standard functions. Reviewed By: brecht Differential Revision: https://developer.blender.org/D10622 --- .../shaders/material/gpu_shader_material_vector_math.glsl | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_vector_math.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_vector_math.glsl index 0b65fdb229a..60ed098beb3 100644 --- a/source/blender/gpu/shaders/material/gpu_shader_material_vector_math.glsl +++ b/source/blender/gpu/shaders/material/gpu_shader_material_vector_math.glsl @@ -138,3 +138,15 @@ void vector_math_tangent( { outVector = tan(a); } + +void vector_math_refract( + vec3 a, vec3 b, vec3 c, float scale, out vec3 outVector, out float outValue) +{ + outVector = refract(a, normalize(b), scale); +} + +void vector_math_faceforward( + vec3 a, vec3 b, vec3 c, float scale, out vec3 outVector, out float outValue) +{ + outVector = faceforward(a, b, c); +} -- cgit v1.2.3