From da8b7fe4c35a6cde9eb72f4a136e9ae3f4ebde73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Wed, 16 Jun 2021 14:16:05 +0200 Subject: [PATCH] shader modifs --- assets/shaders/mask.fs | 5 ++++- assets/shaders/mask.vs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/shaders/mask.fs b/assets/shaders/mask.fs index 1260ff93..bd97a93d 100644 --- a/assets/shaders/mask.fs +++ b/assets/shaders/mask.fs @@ -4,6 +4,7 @@ precision mediump float; // Input vertex attributes (from vertex shader) varying vec3 fragPosition; +varying vec3 fragNormal; varying vec2 fragTexCoord; uniform sampler2D texture0; @@ -13,7 +14,9 @@ void main() { // Texel color fetching from texture sampler // NOTE: Implement here your fragment shader code - vec4 tmp = texture2D(texture0, fragTexCoord); + vec4 tmp; + tmp.rgb = texture2D(texture0, fragTexCoord).rgb; + tmp.a = alpha; diff --git a/assets/shaders/mask.vs b/assets/shaders/mask.vs index a321dcec..26dd04b1 100644 --- a/assets/shaders/mask.vs +++ b/assets/shaders/mask.vs @@ -98,6 +98,7 @@ uniform float radius; varying vec3 fragPosition; varying vec2 fragTexCoord; varying vec4 fragColor; +varying vec3 fragNormal; // NOTE: Add here your custom variables @@ -105,6 +106,7 @@ void main() { // Send vertex attributes to fragment shader fragPosition = vertexPosition + vertexPosition * vec3(cnoise(vec3(vertexNormal + vec3(frame))) * 0.5); fragColor = vertexColor; + fragNormal = vertexNormal; fragTexCoord = vertexTexCoord; // Calculate final vertex position gl_Position = mvp * vec4(fragPosition , radius);