camera = bpy.data.cameras["Camera"]
scene = bpy.context.scene
f = camera.cycles.fisheye_lens
# based on exaplanations in https://blender.stackexchange.com/a/38210 and https://docs.blender.org/manual/en/latest/render/cameras.html#camera
pixel_aspect_ratio = bpy.context.scene.render.resolution_x / bpy.context.scene.render.resolution_y
if camera.sensor_fit == 'VERTICAL':
# the sensor height is fixed (sensor fit is horizontal),
# the sensor width is effectively changed with the pixel aspect ratio
h = camera.sensor_height
w = pixel_aspect_ratio * h
else: # 'HORIZONTAL' and 'AUTO'
# the sensor width is fixed (sensor fit is horizontal),
# the sensor height is effectively changed with the pixel aspect ratio
w = camera.sensor_width
h = w / pixel_aspect_ratio
camera_ob = bpy.data.objects["Camera"]
p = camera_ob.matrix_world.inverted() * p
p.normalize()
# Calculate our angles
phi = math.atan2(p.y, p.x)
l = (p.x**2 + p.y**2)**(1/2)
theta = math.asin(l)
# Equisolid projection
r = 2.0 * f * math.sin(theta / 2)
u = r * math.cos(phi) / w + 0.5
v = r * math.sin(phi) / h + 0.5
x = u * scene.render.resolution_x
y = v * scene.render.resolution_y
camera = bpy.data.cameras["Camera"]
scene = bpy.context.scene
f = camera.cycles.fisheye_lens
# based on exaplanations in https://blender.stackexchange.com/a/38210 and https://docs.blender.org/manual/en/latest/render/cameras.html#camera
pixel_aspect_ratio = bpy.context.scene.render.resolution_x / bpy.context.scene.render.resolution_y
if camera.sensor_fit == 'VERTICAL':
# the sensor height is fixed (sensor fit is horizontal),
# the sensor width is effectively changed with the pixel aspect ratio
h = camera.sensor_height
w = pixel_aspect_ratio * h
else: # 'HORIZONTAL' and 'AUTO'
# the sensor width is fixed (sensor fit is horizontal),
# the sensor height is effectively changed with the pixel aspect ratio
w = camera.sensor_width
h = w / pixel_aspect_ratio
camera_ob = bpy.data.objects["Camera"]
p = camera_ob.matrix_world.inverted() * p
p.normalize()
# Calculate our angles
phi = math.atan2(p.y, p.x)
l = (p.x**2 + p.y**2)**(1/2)
theta = math.asin(l)
# Equisolid projection
r = 2.0 * f * math.sin(theta / 2)
u = r * math.cos(phi) / w + 0.5
v = r * math.sin(phi) / h + 0.5
x = u * scene.render.resolution_x
y = v * scene.render.resolution_y