From 5d7fe43f64e904d5873d6c2f6e53b90e82753c7b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Dec 2010 02:40:25 -0600 Subject: Add CameraCoCRatio to make DoF depending on screen resolution. --- indra/newview/app_settings/settings.xml | 14 +++++++++++++- indra/newview/pipeline.cpp | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ef3803aed6..10799a6ed8 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1380,7 +1380,19 @@ 0.05 - + CameraCoCRatio + + Comment + Ratio of circle of confusion to vertical resolution for DoF effect. + Persist + 1 + Type + F32 + Value + 54 + + + CertStore Comment diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 31200675fc..717c97c6d4 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6161,8 +6161,9 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) subject_distance *= 1000.f; F32 fnumber = gSavedSettings.getF32("CameraFNumber"); F32 focal_length = gSavedSettings.getF32("CameraFocalLength"); - F32 coc = gSavedSettings.getF32("CameraCoC"); + F32 coc_ratio = gSavedSettings.getF32("CameraCoCRatio"); + F32 coc = coc_ratio/mScreen.getHeight(); F32 hyperfocal_distance = (focal_length*focal_length)/(fnumber*coc); -- cgit v1.2.3 From ec9ba94b69e259347f71fbbcec2f0f8fe43a47a7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Dec 2010 03:52:57 -0600 Subject: DoF tweaks -- halo hiding, etc. --- .../shaders/class1/deferred/postDeferredF.glsl | 14 +++++++++----- indra/newview/pipeline.cpp | 5 ++--- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 77e3e41ea4..02712e0a5b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -73,12 +73,14 @@ void main() { //pixel is behind far focal plane float w = 1.0; - float fd = far_focal_distance; + float fd = (depth[0]-far_focal_distance)*0.5+far_focal_distance; float sc = far_focal_distance - depth[0]; - sc /= -far_focal_distance; + sc /= near_focal_distance-far_focal_distance; + + sc = sqrt(sc); sc = min(sc, 8.0); - + while (sc > 1.0) { dofSample(diff,w, fd, sc,sc); @@ -104,8 +106,10 @@ void main() { //pixel is in front of near focal plane //diff.r = 1.0; float w = 1.0; - float sc = depth[0] - fd; - sc = min(-sc/fd*16.0, 8.0); + float sc = near_focal_distance-depth[0]; + sc /= near_focal_distance; + sc *= 8.0; + sc = min(sc, 8.0); fd = depth[0]; while (sc > 1.0) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fa156c85e3..f0446b024c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6174,8 +6174,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) //adjust focal length for zoom F32 fov = LLViewerCamera::getInstance()->getView(); - F32 default_fov = LLViewerCamera::getInstance()->getDefaultFOV(); - focal_length *= default_fov/fov; + focal_length *= 1.f/fov; F32 near_focal_distance = hyperfocal_distance*subject_distance/(hyperfocal_distance+subject_distance); @@ -6197,7 +6196,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) if (channel > -1) { mScreen.bindTexture(0, channel); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } gGL.begin(LLRender::TRIANGLE_STRIP); -- cgit v1.2.3 From 6cfb2c81a82693789da582492418efecf628e426 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Dec 2010 15:30:00 -0600 Subject: Get rid of CameraCoC and adjust focal length and fnumber for every day use. --- indra/newview/app_settings/settings.xml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 10799a6ed8..4e5ad60513 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1353,7 +1353,7 @@ Type F32 Value - 8.0 + 11.0 CameraFocalLength @@ -1365,19 +1365,7 @@ Type F32 Value - 50 - - - CameraCoC - - Comment - Camera circle of confusion for DoF effect (in millimeters) - Persist - 1 - Type - F32 - Value - 0.05 + 35 CameraCoCRatio -- cgit v1.2.3