@m_magalhaes Thank you, that Python fresnel example was extremely helpful. I got very close with the following:

```
import os
import math
import cmath
import c4d
from c4d import plugins, bitmaps, utils
#warning Please obtain your own plugin ID from http://www.plugincafe.com # I didn't
PLUGIN_ID=1027090
class complexShader(plugins.ShaderData):
def __init__(self):
#if a Python exception occurs during the calculation of a pixel colorize this one in red for debugging purposes
self.SetExceptionColor(c4d.Vector(1,0,0))
def Output(self, sh, cd):
if cd.vd: #if shader is computated in 3d space
pi = math.pi
u = cd.p[0]
v = cd.p[1]
tt = cd.t # /28.0
osc = math.sin(2*pi*tt)
min_y = -2*pi
max_y = 2*pi
min_x = -2*pi
max_x = 2*pi
# to view correctly when applied to a plane in c4d, have x axis pointing right, z axis pointing up, and y axis pointing at the camera
x = c4d.utils.RangeMap(u, 0, 1, min_x, max_x, clampval = True)
y = c4d.utils.RangeMap(1-v, 0, 1, min_y, max_y, clampval = True)
z = x + y*1j
out = cmath.exp(z)
angle = cmath.phase(out)/pi % 2.0 # wrap it at pi to match Mathematica's color mapping (mathematica: -pi = cyan, 0 = red, pi = cyan)
hue = c4d.utils.RangeMap(angle, 0.0, 2.0, 0, 1, clampval = True)
colorHSV = c4d.Vector(hue, 1.0, 1.0)
colorRGB = c4d.utils.HSVToRGB(colorHSV)
return c4d.Vector(colorRGB[0],colorRGB[1],colorRGB[2])
else: #if shader is computated in 2d space
return c4d.Vector(0.0)
def FreeRender(self, sh):
#Free any resources used for the precalculated data from InitRender().
return
def RegisterComplexShader():
IDS_COMPLEX_SHADER=10001 #string resource, must be manually defined
return plugins.RegisterShaderPlugin(PLUGIN_ID, plugins.GeLoadString(IDS_COMPLEX_SHADER), 0, complexShader, "", 0)
if __name__=='__main__':
RegisterComplexShader()
```

This works on a plane. However, when I apply the same material to the Python generator, it returns the error color (red):

I'm assuming this is because the geometry generated in the Python generator doesn't have UVs. Is that correct? If so, what is the proper way to add them? If not, why does it work on the plane but not the Python generator (which contains the same code as my first post).

Here's the sample .c4d file and the .pyp plugin in case anybody wants to test it for themselves. I was testing this on R19:

https://drive.google.com/file/d/1UJAsaYsEdKJKwafTau8-LDkLETSzgRNW/view?usp=sharing