implemented fragment shader parallax occlusion mapping & add some assets to test it

This commit is contained in:
2023-08-21 02:56:51 +10:00
parent 3020ea8a08
commit 73b58eb3e0
12 changed files with 156 additions and 39 deletions

View File

@@ -7,7 +7,7 @@ uniform mat3 u_normalMatrix;
varying vec3 v_normal;
#endif // normalFlag
#if defined(tangentFlag) && defined(binormalFlag)
#if (defined(tangentFlag) && defined(binormalFlag)) || (defined(bumpHeightFlag) && defined(bumpTextureFlag))
attribute vec3 a_tangent;
attribute vec3 a_binormal;
varying mat3 v_tbn;
@@ -35,6 +35,11 @@ uniform vec4 u_diffuseUVTransform;
varying vec2 v_diffuseUV;
#endif // diffuseTextureFlag
#ifdef bumpTextureFlag
uniform vec4 u_bumpUVTransform;
varying vec2 v_bumpUV;
#endif // bumpTextureFlag
#ifdef normalTextureFlag
uniform vec4 u_normalUVTransform;
varying vec2 v_normalUV;
@@ -104,6 +109,10 @@ void main()
v_diffuseUV = u_diffuseUVTransform.xy + a_texCoord0 * u_diffuseUVTransform.zw;
#endif // diffuseTextureFlag
#ifdef bumpTextureFlag
v_bumpUV = u_bumpUVTransform.xy + a_texCoord0 * u_bumpUVTransform.zw;
#endif // bumpTextureFlag
#ifdef normalTextureFlag
v_normalUV = u_normalUVTransform.xy + a_texCoord0 * u_normalUVTransform.zw;
#endif // normalTextureFlag