diff --git a/ae/aiZoicTemplate.py b/ae/aiZoicTemplate.py old mode 100755 new mode 100644 index 6c0b1ee..855e7be --- a/ae/aiZoicTemplate.py +++ b/ae/aiZoicTemplate.py @@ -37,8 +37,12 @@ def setup(self): self.addControl("aiFocalDistance", label="Focus distance (cm)") self.addSeparator() self.addControl("aiOpticalVignetting", label="Optical Vignetting") + self.addControl("aiHighlightWidth", label="Highlight Width") + self.addControl("aiHighlightStrength", label="Highlight Strength") self.addSeparator() self.addControl("aiUseImage", label="Enable Image based bokeh") self.addCustom('aiBokehPath', self.filenameNew, self.filenameReplace) + self.addSeparator() + self.addControl("aiExposureControl", label="Exposure") templates.registerTranslatorUI(aiZoicTemplate, "camera", "zoic") diff --git a/ae/aiZoicTemplate.pyc b/ae/aiZoicTemplate.pyc index 0e414e8..1022026 100644 Binary files a/ae/aiZoicTemplate.pyc and b/ae/aiZoicTemplate.pyc differ diff --git a/bin/.nfs00000000015c2b8c0000160e b/bin/.nfs00000000015c2b8c0000160e old mode 100755 new mode 100644 diff --git a/bin/zoic.mtd b/bin/zoic.mtd old mode 100755 new mode 100644 index 80940a1..f3cbcd0 --- a/bin/zoic.mtd +++ b/bin/zoic.mtd @@ -60,6 +60,22 @@ default FLOAT 0 desc STRING "Sometimes referred to as the cat-eye effect, this is a lens imperfection that is not caused by the glass but by the outer edge of the lens, also known as the exit aperture. When the main aperture is fully open, light coming into the camera from steep angles will be blocked partially by the edge of the lens. This creates cat-eye like bokeh shapes near the edges of an image. It should be noted that this lens effect is purely mechanical and can not be confused with lens distortion." + [attr highlightWidth] + maya.name STRING "aiHighlightWidth" + min FLOAT 0.0 + softmax FLOAT 0.2 + max FLOAT 1.0 + default FLOAT 0.0 + desc STRING "Width of the highlight on the inner side of the bokeh in relationship to the origin in image space. This is a percentage of the lens radius." + + [attr highlightStrength] + maya.name STRING "aiHighlightStrength" + min FLOAT 0.0 + softmax FLOAT 20.0 + max FLOAT 100.0 + default FLOAT 0.0 + desc STRING "Strength of the highlight on the inner side of the bokeh in relationship to the origin in image space. This is a multiplier on the weight of the rays." + [attr useImage] maya.name STRING "aiUseImage" default BOOL false @@ -69,3 +85,14 @@ maya.name STRING "aiBokehPath" default STRING "" desc STRING "Path to bokeh image. No need to convert to .tx" + + + [attr exposureControl] + maya.name STRING "aiExposureControl" + min FLOAT -100.0 + softmin FLOAT -5.0 + softmax FLOAT 5.0 + max FLOAT 100.0 + default FLOAT 0.0 + desc STRING "Multiplier on the ray weight." + diff --git a/bin/zoic.so b/bin/zoic.so old mode 100755 new mode 100644 index 0efa6fe..d474eae Binary files a/bin/zoic.so and b/bin/zoic.so differ diff --git a/src/arnoldCamera.pro b/src/arnoldCamera.pro old mode 100755 new mode 100644 diff --git a/src/arnoldCamera.pro.user b/src/arnoldCamera.pro.user old mode 100755 new mode 100644 diff --git a/src/imageReader.cpp b/src/imageReader.cpp old mode 100755 new mode 100644 diff --git a/src/imgs/wip/testScene_lights.ass b/src/imgs/wip/testScene_lights.ass index 5916528..a21246a 100644 --- a/src/imgs/wip/testScene_lights.ass +++ b/src/imgs/wip/testScene_lights.ass @@ -1,4 +1,4 @@ -### exported: Sun Feb 21 14:14:25 2016 +### exported: Mon Feb 22 13:20:38 2016 ### from: Arnold 4.2.11.0 linux clang-3.6.0 glibc-2.12 oiio-1.5.20 rlm-11.3.1 2015/10/27 15:51:25 ### host app: MtoA 1.2.4.3 Maya 2016 @@ -6,7 +6,7 @@ options { - AA_samples 20 + AA_samples 10 outputs "RGBA RGBA defaultArnoldFilter@gaussian_filter defaultArnoldDriver@driver_exr.RGBA" xres 960 yres 350 @@ -33,7 +33,7 @@ options fps 24 } -zenoCamera +zoic { name perspShape sensorWidth 3.5999999 @@ -42,9 +42,9 @@ zenoCamera useDof on fStop 1.39999998 focalDistance 115 - opticalVignetting 3.80952382 - useImage on - bokehPath "/home/i7210038/qt_arnoldCamera/arnoldCamera/imgs/collected_real/bokeh_31.jpg" + opticalVignetting 8 + useImage off + bokehPath "/home/i7210038/qt_arnoldCamera/arnoldCamera/imgs/collected_real/bokeh_18.jpg" matrix 0.312334925 0 -0.949972034 0 0.153605282 -0.986840844 0.0505028479 0 diff --git a/src/imgs/wip/testScene_lights.exr b/src/imgs/wip/testScene_lights.exr new file mode 100644 index 0000000..edd0016 Binary files /dev/null and b/src/imgs/wip/testScene_lights.exr differ diff --git a/src/releases/zoic_linux_v1.0/ae/aiZoicTemplate.py b/src/releases/zoic_linux_v1.0/ae/aiZoicTemplate.py old mode 100755 new mode 100644 diff --git a/src/releases/zoic_linux_v1.0/bin/.nfs00000000015c2b8c0000160e b/src/releases/zoic_linux_v1.0/bin/.nfs00000000015c2b8c0000160e old mode 100755 new mode 100644 diff --git a/src/releases/zoic_linux_v1.0/bin/zoic.mtd b/src/releases/zoic_linux_v1.0/bin/zoic.mtd old mode 100755 new mode 100644 diff --git a/src/releases/zoic_linux_v1.0/bin/zoic.so b/src/releases/zoic_linux_v1.0/bin/zoic.so old mode 100755 new mode 100644 diff --git a/src/testScene_lights.ma b/src/testScene_lights.ma old mode 100755 new mode 100644 diff --git a/src/zoic.cpp b/src/zoic.cpp old mode 100755 new mode 100644 index 02e5ced..8b1c3a7 --- a/src/zoic.cpp +++ b/src/zoic.cpp @@ -59,13 +59,6 @@ */ -/* CATEYE IDEA - - Cateye effect gives the inner edges of the spheres a brighter rim, so give more weight to the samples on the opposite corner of the screen. - I think I can easily do this by scaling the weight of the samples based on the relationship between the screen space coordinates. - -*/ - /* TODO Make a standard for this optical vignetting thing, not just random values @@ -102,8 +95,11 @@ bool debug = false; #define _fStop (params[4].FLT) #define _focalDistance (params[5].FLT) #define _opticalVignetting (params[6].FLT) -#define _useImage (params[7].BOOL) -#define _bokehPath (params[8].STR) +#define _highlightWidth (params[7].FLT) +#define _highlightStrength (params[8].FLT) +#define _useImage (params[9].BOOL) +#define _bokehPath (params[10].STR) +#define _exposureControl (params[11].FLT) struct imageData{ @@ -594,9 +590,12 @@ node_parameters { AiParameterBOOL("useDof", true); AiParameterFLT("fStop", 1.4f); AiParameterFLT("focalDistance", 110.0f); // distance from lens to focal point - AiParameterFLT("opticalVignetting", 0.0f); //distance of the opticalVignetting virtual aperture - AiParameterBOOL("useImage", true); + AiParameterFLT("opticalVignetting", 20.0f); //distance of the opticalVignetting virtual aperture + AiParameterFLT("highlightWidth", 0.2f); + AiParameterFLT("highlightStrength", 10.0f); + AiParameterBOOL("useImage", false); AiParameterStr("bokehPath", ""); //bokeh shape image location + AiParameterFLT("exposureControl", 0.0f); } @@ -694,29 +693,28 @@ camera_create_ray { // find hypotenuse of x, y points. float pointHypotenuse = sqrt((opticalVignetPoint.x * opticalVignetPoint.x) + (opticalVignetPoint.y * opticalVignetPoint.y)); - float opticalVignetApertureRadius = camera.apertureRadius * 1.0f; // if intersection point on the optical vignetting virtual aperture is within the radius of the aperture from the plane origin, kill ray - if (ABS(pointHypotenuse) > opticalVignetApertureRadius){ + if (ABS(pointHypotenuse) > camera.apertureRadius){ // set ray weight to 0, there is an optimisation inside Arnold that doesn't send rays if they will return black anyway. output->weight = 0.0f; } - // testing cateye technique, adding weight to opposite edges to get nice rim on the highlights, this will need to be more complicated - //if (input->sy < 0){ - // output->weight *= 1 + (input->sx * output->origin.x + input->sy * output->origin.y) / 2; - //} - //else{ - // output->weight *= 1 + (input->sx * output->origin.x - input->sy * output->origin.y) / 2; - //} + // inner highlight,if point is within domain between lens radius and new inner radius (defined by the width) + // adding weight to opposite edges to get nice rim on the highlights + else if (ABS(pointHypotenuse) < camera.apertureRadius && ABS(pointHypotenuse) > (camera.apertureRadius - _highlightWidth)){ + output->weight *= _highlightStrength * (1 - (camera.apertureRadius - ABS(pointHypotenuse))) * sqrt(input->sx * input->sx + input->sy * input->sy); + } } } - - // vignetting - // float dist2 = input->sx * input->sx + input->sy * input->sy; - // output->weight = 1.0f - .5*dist2; - + // control to go light stops up and down + if (_exposureControl > 0){ + output->weight *= 1.0 + (_exposureControl * _exposureControl); + } + else if (_exposureControl < 0){ + output->weight *= 1.0 / (1.0 + (-_exposureControl * -_exposureControl)); + } // not sure if needed, but can't hurt. Taken from solidangle website. // ---------------------------------------------------------------------------------------------- diff --git a/src/zoic.os b/src/zoic.os index c0a2de5..f8bdb48 100644 Binary files a/src/zoic.os and b/src/zoic.os differ