X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=shaders%2Fmodel_character_view.fs;h=6330f9bf13ebf5635c694ae3d6cfdbaeaf41813b;hb=137d40d96fe923600d8378b8e138e3c276f27ff4;hp=a85e124d8a862947ce3b26f2da13a7f2551459fc;hpb=409edea2cf6271956137918e4e0b4f1c2addf620;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/shaders/model_character_view.fs b/shaders/model_character_view.fs index a85e124..6330f9b 100644 --- a/shaders/model_character_view.fs +++ b/shaders/model_character_view.fs @@ -9,29 +9,18 @@ in vec3 aWorldCo; #include "common_world.glsl" #include "motion_vectors_fs.glsl" +#include "depth_compare.glsl" -void main() -{ +void main(){ + depth_compare_dither(); compute_motion_vectors(); - vec3 vfrag = texture( uTexMain, aUv ).rgb; + vec3 qnorm = aNorm; + vec3 diffuse = texture( uTexMain, aUv ).rgb; + vec3 composite = world_compute_lighting( diffuse, qnorm, aWorldCo, 1.0 ); - // Lighting - vec3 halfview = uCamera - aWorldCo; - float fdist = length( halfview ); - halfview /= fdist; - fdist -= 0.08; + float dist = distance( aWorldCo, uCamera ) - 0.08; + float opacity = clamp( dist*dist, 0.0, 1.0 ); - vec3 qnorm = normalize(floor(aNorm*2.0)*0.5) + vec3(0.001,0.0,0.0); - - vec3 total_light = newlight_compute_ambient(); - vec3 world_light = newlight_compute_world_diffuse( qnorm ); - - float world_shadow = newlight_compute_sun_shadow(); - total_light += world_light * world_shadow; - - vfrag = apply_fog( vfrag * total_light, fdist ); - - float opacity = clamp( fdist*fdist, 0.0, 1.0 ); - oColour = vec4(vfrag,opacity); + oColour = vec4( composite, opacity ); }