Restore the foam to the Rembrandt water shader
Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
This commit is contained in:
parent
65dbc4cc0b
commit
6e8f1b7fee
3 changed files with 12 additions and 8 deletions
|
@ -38,7 +38,7 @@ varying vec4 waterTex1; //moving texcoords
|
|||
varying vec4 waterTex2; //moving texcoords
|
||||
varying vec3 viewerdir;
|
||||
varying vec3 normal;
|
||||
varying vec3 Vnormal;
|
||||
varying vec3 rawNormal;
|
||||
varying vec3 VTangent;
|
||||
varying vec3 VBinormal;
|
||||
|
||||
|
@ -65,7 +65,7 @@ void main(void)
|
|||
vec3 E = normalize(viewerdir);
|
||||
|
||||
vec3 Normal = normalize(normal);
|
||||
vec3 vNormal = normalize(Vnormal);
|
||||
vec3 vNormal = normalize(rawNormal);
|
||||
|
||||
const float water_shininess = 240.0;
|
||||
|
||||
|
@ -171,7 +171,8 @@ void main(void)
|
|||
|
||||
vec3 N2 = normalize(mix(N0, N1, mixFactor) * waveRoughness);
|
||||
Normal = normalize(N2.x * VTangent + N2.y * VBinormal + N2.z * Normal);
|
||||
vNormal = normalize(mix(vNormal + N0, vNormal + N1, mixFactor) * waveRoughness);
|
||||
//vNormal = normalize(mix(vNormal + N0, vNormal + N1, mixFactor) * waveRoughness);
|
||||
vNormal = normalize(N2.x * vec3(1.,0.,0.) + N2.y * vec3(0.,1.,0.) + N2.z * vNormal);
|
||||
|
||||
if (normalmap_dds > 0){
|
||||
Normal = -Normal; //dds fix
|
||||
|
|
|
@ -13,6 +13,7 @@ varying vec4 waterTex2;
|
|||
varying vec3 viewerdir;
|
||||
varying vec3 lightdir;
|
||||
varying vec3 normal;
|
||||
varying vec3 rawNormal;
|
||||
|
||||
varying vec3 VTangent;
|
||||
varying vec3 VBinormal;
|
||||
|
@ -37,6 +38,7 @@ void rotationmatrix(in float angle, out mat4 rotmat)
|
|||
void main(void)
|
||||
{
|
||||
mat4 RotationMatrix;
|
||||
rawNormal= gl_Normal;
|
||||
normal = gl_NormalMatrix * gl_Normal;
|
||||
VTangent = normalize(gl_NormalMatrix * tangent);
|
||||
VBinormal = normalize(gl_NormalMatrix * binormal);
|
||||
|
|
|
@ -46,7 +46,7 @@ varying vec4 waterTex2 ; //moving texcoords
|
|||
varying vec3 viewerdir ;
|
||||
varying vec3 lightdir ;
|
||||
varying vec3 normal ;
|
||||
varying vec3 Vnormal ;
|
||||
varying vec3 rawNormal ;
|
||||
varying vec3 VTangent ;
|
||||
varying vec3 VBinormal ;
|
||||
|
||||
|
@ -147,8 +147,8 @@ void main(void)
|
|||
//vec3 H = normalize(L + E);
|
||||
|
||||
vec3 Normal = normalize(normal) ;
|
||||
vec3 vNormal = normalize(Vnormal) ;
|
||||
const float water_shininess = 128.0 ;
|
||||
vec3 vNormal = normalize(rawNormal) ;
|
||||
const float water_shininess = 240.0 ;
|
||||
|
||||
// float range = gl_ProjectionMatrix[3].z/(gl_FragCoord.z * -2.0 + 1.0 - gl_ProjectionMatrix[2].z);
|
||||
|
||||
|
@ -334,7 +334,8 @@ void main(void)
|
|||
N0.g += ddySum;
|
||||
vec3 N2 = normalize(mix(N0, N1, mixFactor) * waveRoughness);
|
||||
Normal = normalize(N2.x * VTangent + N2.y * VBinormal + N2.z * Normal);
|
||||
vNormal = normalize(mix(vNormal + N0, vNormal + N1, mixFactor) * waveRoughness);
|
||||
//vNormal = normalize(mix(vNormal + N0, vNormal + N1, mixFactor) * waveRoughness);
|
||||
vNormal = normalize(N2.x * vec3(1.0, 0.0, 0.0) + N2.y * vec3(0.0, 1., 0.0) + N2.z * vNormal);
|
||||
if (normalmap_dds > 0){ //dds fix
|
||||
Normal = -Normal;
|
||||
vNormal = -vNormal;
|
||||
|
|
Loading…
Reference in a new issue