5
$\begingroup$

This question is identical to Custom nonlinear distortion lens

With one difference: I'm only interested in a solution at the code level. Because that gives a fine-grained control.

How does one go about doing this?

Here is the setup:

enter image description here

For each square on that grid, a ray is shot out through each corner, returning a colour. The four corners are averaged, and the resultant colour is given to that pixel. (if there is more than a certain maximum allowed amount of variation between the 4 values, the square is cut up into 4 little squares, and so on, recursively)

That's the standard projection model I'm familiar with.

What I want to do is manually fire out rays myself.

I'm guessing that somewhere low down in the C code level, there is some routine that performs this operation.

But where? Can someone direct me? I would be very daunted to have to hunt it down myself through the Blender source code.

And can this be done in Python? Is there some command for firing a ray and retrieving the colour? If this is the case then I could in theory write my own ray projector, and save the resulting 2D RGB array to file.

$\endgroup$
1
  • 2
    $\begingroup$ It seems someone has implemented a patch which allows you to define your own distortion with a map. $\endgroup$
    – gandalf3
    Apr 8, 2014 at 6:50

2 Answers 2

3
$\begingroup$

I am not sure if it can be down in Python. But definitely possible in C.

Blender Cycles support non-planar lenses ala fisheye. You can find the user documentation for it on the wiki.

A walkthrough (and patch) from the developer who implemented this feature can be found on Dalai Felinto's website.

$\endgroup$
1
$\begingroup$

I'm not saying it's possible with python, but here's somewhere to start: 1,2. As a side note, blender's model is to shoot out one ray per square, unless anti-aliasing is enabled under the render panel. With antialising, it uses the specified amount of samples and mixing algorithm.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .