Ticket #2111: hqdofFix.patch
File hqdofFix.patch, 2.6 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/shaders/effects/postproc/HQDOF.xml
4 4 <require shaders="glsl"/> 5 5 <pass shader="glsl/hqdof"> 6 6 <define name="manualdof" value="true"/> 7 <define name="showFocus" value="false"/> 7 8 8 <define name="focalLength" value="1000 "/>9 <define name="fstop" value="200 "/>9 <define name="focalLength" value="1000.0"/> 10 <define name="fstop" value="200.0"/> 10 11 11 12 <define name="samples" value="3"/> 12 13 <define name="rings" value="3"/> … … 16 17 <define name="fdofstart" value="30.0"/> 17 18 <define name="fdofdist" value="40.0"/> 18 19 19 <define name="maxblur" value="2 "/>20 <define name="maxblur" value="2.0"/> 20 21 21 22 <define name="threshold" value="0.9"/> 22 23 <define name="gain" value="2.0"/> -
binaries/data/mods/public/shaders/glsl/hqdof.fs
53 53 ---------------------- 54 54 55 55 */ 56 #version 120 56 57 57 58 uniform sampler2D renderedTex; 58 59 uniform sampler2D depthTex; … … 66 67 uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below 67 68 //uniform float focalLength = 1000; //focal length in mm 68 69 //uniform float fstop = 200; //f-stop value 69 uniform bool showFocus = false; //show debug focus point and focal range (red = focal point, green = focal range)70 //uniform bool showFocus = false; //show debug focus point and focal range (red = focal point, green = focal range) 70 71 71 72 /* 72 73 make sure that these two values are the same for your camera, otherwise distances will be wrong. … … 119 120 float bdepth(vec2 coords, float blursize) //blurring depth 120 121 { 121 122 float d = 0.0; 122 float div = 0 ;123 float div = 0.0; 123 124 float kernel[9]; 124 125 vec2 offset[9]; 125 126 … … 218 219 float b = (a-fdofstart)/fdofdist; //far DoF 219 220 float c = (-a-ndofstart)/ndofdist; //near Dof 220 221 blur = (a>0.0)?b:c; 221 blur /= max((fDepth / 15 ) - 7, 1);222 blur /= max((fDepth / 15.0) - 7.0, 1.0); 222 223 } 223 224 else 224 225 { … … 233 234 blur = abs(a-b)*c; 234 235 } 235 236 236 return clamp(blur, 0 , 1);237 return clamp(blur, 0.0, 1.0); 237 238 } 238 239 239 240 varying vec2 v_tex; … … 283 284 vec3 samplecolor = color; 284 285 float samplediv = 1.0; 285 286 286 int ringsamples;287 float ringsamples; 287 288 288 289 for (int i = 1; i <= rings; i += 1) 289 290 {