Skip to content

Commit

Permalink
Adding 1.1 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zpelgrims committed Mar 4, 2018
1 parent 774bd77 commit 298a0fa
Show file tree
Hide file tree
Showing 15 changed files with 351 additions and 5 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

**POTA** is an implementation of [Sparse high-degree polynomials for wide-angle lenses [2016]](https://cg.ivd.kit.edu/publications/2016/lens_sparse_poly/2016_optics.pdf) for the [Arnold renderer](www.solidangle.com). It renders images with high-order aberrations, at a fraction of the cost of tracing rays through lens elements. It is done by pre-calculating fitted polynomials, which serve as a black-box to transform the rays on the sensor to rays on the outer pupil. All credit goes out to the authors of the paper, I only wrote the implementation for Arnold.

**See the full documentation [here](http://zenopelgrims.com/polynomial-optics-arnold/)**
**Read the full documentation [here](http://zenopelgrims.com/polynomial-optics-arnold/).**


![pota_comparison_thinlens_polynomial_optics_zeiss_biotar](https://raw.githubusercontent.com/zpelgrims/pota/master/tests/website_comparison_images/pota_arnold_camera_shader_comparison_biotar_thinlens.gif)
Expand All @@ -9,19 +10,20 @@
***

**Compile instructions:**

Base requirement: Arnold >5.0.2.0

>OSX:
```
open makefile #change arnold sdk path
open makefile ### change arnold sdk path
mkdir bin
make
```

>Windows
```
using the "x64 native tools command prompt for VS 2017"
### using the "x64 native tools command prompt for VS 2017"
cl /LD /I ...\Arnold-5.0.2.0-windows\include /EHsc /O2 pota.cpp /link /LIBPATH:...\Arnold-5.0.2.0-windows\lib ai.lib
```
Binary file added releases/pota-osx-1.0-ai5.0.2.0.zip
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

houdini.icon STRING "SHOP_surface"
houdini.label STRING "pota"
houdini.shader_type STRING "Lens"
houdini.help_url STRING "http://www.zenopelgrims.com/polynomial-optics-arnold"
houdini.order STRING "lensModel sensor_width wavelength dof fstop focus_distance extra_sensor_shift vignetting_retries aperture_blades backwards_samples minimum_rgb bokeh_exr_path"
# houdini.order STRING "lensModel sensor_width wavelength dof fstop focus_distance extra_sensor_shift vignetting_retries aperture_blades backwards_samples minimum_rgb bokeh_exr_path"
houdini.order STRING "lensModel sensor_width wavelength dof fstop focus_distance extra_sensor_shift vignetting_retries aperture_blades proper_ray_derivatives"


[attr lensModel]
Expand Down Expand Up @@ -136,3 +138,4 @@
# linkable BOOL FALSE
#
# houdini.label STRING "Bokeh EXR Path"
# houdini.type STRING "file:image"
Binary file added releases/pota-osx-1.1-ai5.0.2.0/bin/pota.dylib
Binary file not shown.
108 changes: 108 additions & 0 deletions releases/pota-osx-1.1-ai5.0.2.0/bin/pota.mtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
[node pota]
desc STRING "Polynomial optics camera shader"
maya.name STRING "camera"
maya.id INT 0x00070506
maya.classification STRING "shader/surface"
maya.type STRING "camera"
maya.translator STRING "pota"

c4d.classification STRING "generic"

houdini.icon STRING "SHOP_surface"
houdini.label STRING "pota"
houdini.help_url STRING "http://www.zenopelgrims.com/polynomial-optics-arnold"


[attr lensModel]
maya.name STRING "aiLensModel"
desc STRING "Lens Model"
default STRING "petzval"

houdini.label STRING "Lens Model"


[attr sensor_width]
maya.name STRING "aiSensorWidth"
min FLOAT 0.1
max FLOAT 100
default FLOAT 36
desc STRING "Width of the sensor in mm. Default value is the width of a full frame sensor."

houdini.label STRING "Sensor Width (mm)"


[attr wavelength]
maya.name STRING "aiWavelength"
min FLOAT 390.0
max FLOAT 700.0
default FLOAT 550.0
desc STRING "Wavelength in nanometers."

houdini.label STRING "Wavelength (nm)"


[attr dof]
maya.name STRING "aiDof"
default BOOL true
desc STRING "Enable Depth of Field"
linkable BOOL FALSE

houdini.label STRING "Enable Depth of Field"


[attr fstop]
maya.name STRING "aiFstop"
min FLOAT 0.0
max FLOAT 64.0
default FLOAT 2.8
desc STRING "F-Stop"

houdini.label STRING "f-stop"


[attr focus_distance]
maya.name STRING "aiFocusDistance"
min FLOAT 0.0
max FLOAT 1000000.0
default FLOAT 150.0
desc STRING "Focus distance in cm"

houdini.label STRING "Focus Distance (cm)"


[attr extra_sensor_shift]
maya.name STRING "aiExtraSensorShift"
min FLOAT -10.0
max FLOAT 10.0
default FLOAT 0.0
desc STRING "Additional Sensor shift (mm)"

houdini.label STRING "Additional Sensor shift (mm)"


[attr vignetting_retries]
maya.name STRING "aiVignettingRetries"
min INT 1
max INT 50
default INT 15
desc STRING "Number of times a ray will be tried to be shot in a random direction, in case the previous iteration got vignetted."

houdini.label STRING "Number of times a ray will be tried to be shot in a random direction, in case the previous iteration got vignetted."


[attr aperture_blades]
maya.name STRING "aiApertureBlades"
default INT 0
min INT 0
max INT 8
desc STRING "Number of aperture blades. < 3 is perfectly circular."

houdini.label STRING "Aperture Blades"


[attr proper_ray_derivatives]
maya.name STRING "aiProperRayDerivatives"
default BOOL true
desc STRING "Enabling this option will trace 3 camera rays instead of 1 to calculate the proper ray derivatives, which are needed for efficient texture lookups. If left unchecked, texture I/O will suffer, but the camera shader speed will be faster."

houdini.label STRING "Proper ray derivatives"
Binary file added releases/pota-windows-1.0-ai5.0.2.0.zip
Binary file not shown.
61 changes: 61 additions & 0 deletions releases/pota-windows-1.0-ai5.0.2.0/ae/aiPotaTemplate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import mtoa.ui.ae.templates as templates
import pymel.core as pm
import maya.cmds as cmds
import mtoa.ui.ae.utils as aeUtils

class aiPotaTemplate(templates.AttributeTemplate):

def filenameEditBokeh(self, mData) :
attr = self.nodeAttr('aiBokehEXRPath')
cmds.setAttr(attr,mData,type="string")

def LoadFilenameButtonPushBokeh(self, *args):
basicFilter = 'All Files (*.*)'
ret = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2, cap='Select sample_bokeh file location',fm=0)
if ret is not None and len(ret):
self.filenameEditBokeh(ret[0])
cmds.textFieldButtonGrp("filenameBokehGrp", edit=True, text=ret[0])

def filenameNewBokeh(self, nodeName):
path = cmds.textFieldButtonGrp("filenameBokehGrp", label="Bokeh AOV EXR path", changeCommand=self.filenameEditBokeh, width=300)
cmds.textFieldButtonGrp(path, edit=True, text=cmds.getAttr(nodeName))
cmds.textFieldButtonGrp(path, edit=True, buttonLabel="...",
buttonCommand=self.LoadFilenameButtonPushBokeh)

def filenameReplaceBokeh(self, nodeName):
cmds.textFieldButtonGrp("filenameBokehGrp", edit=True, text=cmds.getAttr(nodeName) )


def setup(self):
self.beginLayout("Polynomial Optics", collapse=False)
self.addControl("aiLensModel", label="Lens Model")
self.addControl("aiSensorWidth", label="Sensor Width (mm)")
self.addControl("aiWavelength", label="Wavelength (nm)")
self.addControl("aiDof", label="Enable depth of field")
self.addControl("aiFstop", label="F-stop")
self.addControl("aiFocusDistance", label="Focus distance (cm)")
self.addControl("aiExtraSensorShift", label="Extra Sensor shift (mm)")
self.addControl("aiVignettingRetries", label="Vignetting retries")
self.addControl("aiApertureBlades", label="Aperture blades")
self.addControl("aiProperRayDerivatives", label="Proper Ray Derivatives")

self.endLayout()

"""
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.beginLayout("AOV shader", collapse=False)
self.addControl("aiBackwardSamples", label="Backwards samples")
self.addControl("aiMinimumRgb", label="Minimum RGB")
self.addCustom("aiBokehEXRPath", self.filenameNewBokeh, self.filenameReplaceBokeh)
self.endLayout()
"""



templates.registerTranslatorUI(aiPotaTemplate, "camera", "pota")
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@

houdini.icon STRING "SHOP_surface"
houdini.label STRING "pota"
houdini.shader_type STRING "Lens"
houdini.help_url STRING "http://www.zenopelgrims.com/polynomial-optics-arnold"
houdini.order STRING "lensModel sensor_width wavelength dof fstop focus_distance extra_sensor_shift vignetting_retries aperture_blades backwards_samples minimum_rgb bokeh_exr_path"
# houdini.order STRING "lensModel sensor_width wavelength dof fstop focus_distance extra_sensor_shift vignetting_retries aperture_blades backwards_samples minimum_rgb bokeh_exr_path"
houdini.order STRING "lensModel sensor_width wavelength dof fstop focus_distance extra_sensor_shift vignetting_retries aperture_blades proper_ray_derivatives"


[attr lensModel]
Expand Down Expand Up @@ -136,3 +138,4 @@
# linkable BOOL FALSE
#
# houdini.label STRING "Bokeh EXR Path"
# houdini.type STRING "file:image"
61 changes: 61 additions & 0 deletions releases/pota-windows-1.1-ai5.0.2.0/ae/aiPotaTemplate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import mtoa.ui.ae.templates as templates
import pymel.core as pm
import maya.cmds as cmds
import mtoa.ui.ae.utils as aeUtils

class aiPotaTemplate(templates.AttributeTemplate):

def filenameEditBokeh(self, mData) :
attr = self.nodeAttr('aiBokehEXRPath')
cmds.setAttr(attr,mData,type="string")

def LoadFilenameButtonPushBokeh(self, *args):
basicFilter = 'All Files (*.*)'
ret = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2, cap='Select sample_bokeh file location',fm=0)
if ret is not None and len(ret):
self.filenameEditBokeh(ret[0])
cmds.textFieldButtonGrp("filenameBokehGrp", edit=True, text=ret[0])

def filenameNewBokeh(self, nodeName):
path = cmds.textFieldButtonGrp("filenameBokehGrp", label="Bokeh AOV EXR path", changeCommand=self.filenameEditBokeh, width=300)
cmds.textFieldButtonGrp(path, edit=True, text=cmds.getAttr(nodeName))
cmds.textFieldButtonGrp(path, edit=True, buttonLabel="...",
buttonCommand=self.LoadFilenameButtonPushBokeh)

def filenameReplaceBokeh(self, nodeName):
cmds.textFieldButtonGrp("filenameBokehGrp", edit=True, text=cmds.getAttr(nodeName) )


def setup(self):
self.beginLayout("Polynomial Optics", collapse=False)
self.addControl("aiLensModel", label="Lens Model")
self.addControl("aiSensorWidth", label="Sensor Width (mm)")
self.addControl("aiWavelength", label="Wavelength (nm)")
self.addControl("aiDof", label="Enable depth of field")
self.addControl("aiFstop", label="F-stop")
self.addControl("aiFocusDistance", label="Focus distance (cm)")
self.addControl("aiExtraSensorShift", label="Extra Sensor shift (mm)")
self.addControl("aiVignettingRetries", label="Vignetting retries")
self.addControl("aiApertureBlades", label="Aperture blades")
self.addControl("aiProperRayDerivatives", label="Proper Ray Derivatives")

self.endLayout()

"""
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.addSeparator()
self.beginLayout("AOV shader", collapse=False)
self.addControl("aiBackwardSamples", label="Backwards samples")
self.addControl("aiMinimumRgb", label="Minimum RGB")
self.addCustom("aiBokehEXRPath", self.filenameNewBokeh, self.filenameReplaceBokeh)
self.endLayout()
"""



templates.registerTranslatorUI(aiPotaTemplate, "camera", "pota")
Binary file added releases/pota-windows-1.1-ai5.0.2.0/bin/pota.dll
Binary file not shown.
Loading

0 comments on commit 298a0fa

Please sign in to comment.