diff --git a/shader/lighting/texture.frag b/shader/lighting/texture.frag index 3e0345791..d9c20bf51 100644 --- a/shader/lighting/texture.frag +++ b/shader/lighting/texture.frag @@ -6,7 +6,11 @@ in vec2 vTexPos; out vec4 fColor; void main() { - vec3 dField = ( texture(screenTexture,vTexPos).xyz - lightPos ) / lumRad.a; - vec3 c = pow (1 - min(1, dot(dField,dField)) , 2) * lumRad.rgb ; + vec3 distVec = texture(screenTexture,vTexPos).xyz - lightPos; + float dist = dot(distVec,distVec); + if (dist > lumRad.a) {discard;} + //vec3 dField = distVec / lumRad.a; + //vec3 c = pow (1 - min(1, dot(dField,dField)) , 2) * lumRad.rgb ; + vec3 c = (1 - dist / lumRad.a) * lumRad.rgb ; fColor = vec4(c,0); } diff --git a/src/Dodge/Render/Picture.hs b/src/Dodge/Render/Picture.hs index c1a41c4e0..f9b65da28 100644 --- a/src/Dodge/Render/Picture.hs +++ b/src/Dodge/Render/Picture.hs @@ -224,9 +224,9 @@ lightsForGloom w = mapMaybe getLS (IM.elems $ _lightSources w) ++ mapMaybe getTL where getLS ls | dist campos (fst2 $ _lsPos ls) > 1000 = Nothing - | otherwise = Just ( _lsPos ls, _lsRad ls , _lsIntensity ls) + | otherwise = Just ( _lsPos ls, (_lsRad ls)^2 , _lsIntensity ls) getTLS ls | dist campos (fst2 $ _tlsPos ls) > 1000 = Nothing - | otherwise = Just ( _tlsPos ls, _tlsRad ls, _tlsIntensity ls) + | otherwise = Just ( _tlsPos ls, (_tlsRad ls)^2, _tlsIntensity ls) campos = _cameraCenter w fst2 (V3 a b _) = V2 a b diff --git a/src/Framebuffer/Update.hs b/src/Framebuffer/Update.hs index 7ef2a56dd..5ce759faf 100644 --- a/src/Framebuffer/Update.hs +++ b/src/Framebuffer/Update.hs @@ -23,7 +23,7 @@ sizeFBOs -> IO RenderData sizeFBOs xsize ysize xfull yfull rdata = do resizeRBO (_rboBaseBloom rdata) xsize ysize - rdata' <- foldM (updateFBOTO2 xsize ysize linMinMagFilter GL_RGBA8 GL_RGBA16F) rdata [fboBase,fboCloud] + rdata' <- foldM (updateFBOTO2 xsize ysize minMagFilter GL_RGBA8 GL_RGBA16F) rdata [fboBase,fboCloud] >>= flip (foldM (updateFBOTO xsize ysize minMagFilter GL_RGBA8)) [fboColor,fboLighting,fboLightingHigh] rdata'' <- foldM (updateFBOTO xsize ysize linMinMagFilter GL_RGBA16F) rdata' @@ -43,7 +43,6 @@ resizeRBO rboName xsize ysize = do ysize' = fromIntegral ysize bindRenderbuffer Renderbuffer $= rboName renderbufferStorage Renderbuffer Depth24Stencil8 (RenderbufferSize xsize' ysize') - updateFBOTO :: Int -> Int @@ -88,7 +87,6 @@ resizeFBOTO2 (fboName,(toOld1,toOld2)) xsize ysize mmfilt inFormat1 inFormat2 = glTexStorage2D GL_TEXTURE_2D 1 inFormat1 xsize' ysize' textureFilter Texture2D $= mmfilt framebufferTexture2D Framebuffer (ColorAttachment 0) Texture2D toName1 0 - toName2 <- genObjectName textureBinding Texture2D $= Just toName2 glTexStorage2D GL_TEXTURE_2D 1 inFormat2 xsize' ysize'