diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-09-23 08:27:34 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-09-23 08:27:48 -0300 |
commit | fbabef6da388c60a982601ff205e6e9a09b1eada (patch) | |
tree | 5bebeda681a8729abced50fa163348149473b3c7 /drivers | |
parent | 210ebb5cdbecd326c1b0edd35cfda94e3a74c6d9 (diff) |
Fixes to rim parameter in shader
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index af4044224c..0eb26ae58f 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -889,7 +889,7 @@ float GTR1(float NdotH, float a) -void light_compute(vec3 N, vec3 L,vec3 V,vec3 B, vec3 T,vec3 light_color,vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float rim,float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse, inout vec3 specular) { +void light_compute(vec3 N, vec3 L,vec3 V,vec3 B, vec3 T,vec3 light_color,vec3 attenuation,vec3 diffuse_color, vec3 transmission, float specular_blob_intensity, float roughness, float rim,float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse, inout vec3 specular) { #if defined(USE_LIGHT_SHADER_CODE) //light is written by the light shader @@ -964,9 +964,9 @@ LIGHT_SHADER_CODE #endif #if defined(TRANSMISSION_USED) - diffuse += light_color * diffuse_color * mix(vec3(light_amount),vec3(1.0),transmission); + diffuse += light_color * diffuse_color * mix(vec3(light_amount),vec3(1.0),transmission) * attenuation; #else - diffuse += light_color * diffuse_color * light_amount; + diffuse += light_color * diffuse_color * light_amount * attenuation; #endif @@ -987,14 +987,14 @@ LIGHT_SHADER_CODE vec3 H = normalize(V + L); float dotNH = max(dot(N,H), 0.0 ); float intensity = pow( dotNH, (1.0-roughness) * 256.0); - specular += light_color * intensity * specular_blob_intensity; + specular += light_color * intensity * specular_blob_intensity * attenuation; #elif defined(SPECULAR_PHONG) vec3 R = normalize(-reflect(L,N)); float dotNV = max(0.0,dot(R,V)); float intensity = pow( dotNV, (1.0-roughness) * 256.0); - specular += light_color * intensity * specular_blob_intensity; + specular += light_color * intensity * specular_blob_intensity * attenuation; #elif defined(SPECULAR_TOON) @@ -1003,7 +1003,7 @@ LIGHT_SHADER_CODE float mid = 1.0-roughness; mid*=mid; float intensity = smoothstep(mid-roughness*0.5,mid+roughness*0.5,dotNV) * mid; - diffuse += light_color * intensity * specular_blob_intensity; //write to diffuse, as in toon shading you generally want no reflection + diffuse += light_color * intensity * specular_blob_intensity * attenuation; //write to diffuse, as in toon shading you generally want no reflection #elif defined(SPECULAR_DISABLED) //none.. @@ -1047,7 +1047,7 @@ LIGHT_SHADER_CODE float speci = dotNL * D * F * vis; - specular += speci * light_color * specular_blob_intensity; + specular += speci * light_color * specular_blob_intensity * attenuation; #endif #if defined(LIGHT_USE_CLEARCOAT) @@ -1193,7 +1193,7 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino light_attenuation*=mix(omni_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow); } - light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb*light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); + light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,omni_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); } @@ -1227,7 +1227,7 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi light_attenuation*=mix(spot_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow); } - light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb*light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); + light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb,light_attenuation,albedo,transmission,spot_lights[idx].light_params.z*p_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); } @@ -1859,7 +1859,7 @@ FRAGMENT_SHADER_CODE specular_light*=mix(vec3(1.0),light_attenuation,specular_light_interp.a); #else - light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb*light_attenuation,albedo,transmission,light_params.z*specular_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); + light_compute(normal,-light_direction_attenuation.xyz,eye_vec,binormal,tangent,light_color_energy.rgb,light_attenuation,albedo,transmission,light_params.z*specular_blob_intensity,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); #endif |