I am trying to implement a custom camera with large FOV in blender. I know, that Cycles render engine allows to use a fisheye lense, by it in not enough for me, I need a specific camera with customizable distortion model (e.g. with some specific coefficients in Kannala-Brandt model).

One way to solve this problem is to prepare the rays corresponding to every pixel of my camera (this part is simple, and I know how to do it), cast these rays, trace their path and find colors/intensities for these rays and, as a result, to the corresponding pixels (this part I'm struggling with).

My question is, if there is functionality in Blender Python API to cover the second part, namely, given a ray (direction + starting point) to find color/intensity corresponding to this ray.

I tried to find the answer myself. After reading the docs, I figured that one can shoot a ray and find a place where this ray hits an object, but I have no idea what to do next and how to find the intensity/color and what to do if there are multiple hits with several objects.

I am sorry, if I misuse the terminology, I am completely new to Blender. I would be very grateful for any suggestions.

UPD: I googled some more, and found a project, which could be useful. However, if there is another way to achieve what I want, without modifying Blender's source code, it would be most welcome.

UPD2: I found a similar question with answers here, and it is a way to go, but if there is build-in functionality in Blender Python API, I would again very much appreciate it if you point me in the right direction.

  • $\begingroup$ AFAIK you cannot access anything like this (ray calculation is basically a separate process). OSL might be an option. However, Kannala-Brandt model sounds useful for some purposes so might be a good idea implementing this in C anyway. If you don't know where to start, you can ask your question over here: devtalk.blender.org or you can talk directly to the developers: blender.chat and ask for help... $\endgroup$ – brockmann Jun 22 '20 at 11:12
  • $\begingroup$ @brockmann Thanks for a prompt reply, I think contributing to the source code is a good option, I will definitely consider it. $\endgroup$ – Sergey Mishakin Jun 22 '20 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.