I just figured out (with help from people at the C++ forum) how to create a new
Lens' type. Now I've discovered thatLenses’ don’t seem to work like I thought.
The `Lens’ I wanted to create was highly non-linear: so non-linear that the same point in space is potentially projected to different points on the film.
Now, I thought I would only have to implement the
do_extrude' method accordingly, but when I was playing with my copy ofFisheyeLens’ inserted into this code instead of the
CylindricalLens', I noticed that changes todo_extrude’ don’t really do anything. Only if I change `do_project’ does the picture actually change.
do_project' is hard to implement if the same point can appear in two places on the film. After all, I only get oneLPoint3’ argument to fill. Also, for my specific scenario (undistorting a complex (physical) projection scenario), this direction is much more difficult than the other.
So my thought is, would it work if I used a projected texture instead? That means, could I implement
do_extrude' the way I was going to (with a basically arbitrary mapping from world coordinates to points on the film), and then use that to project on some flat surface? Would I have to create another camera andOrthographicLens’ to film that surface?
I’ll try it out myself, but I’m really new to Panda3D and it will take a while. I would be grateful to hear if there are any pitfalls where I’m going or if the whole idea is doomed to fail.
PS: Also, any helpful comments and pointers to relevant documentation/code snippets etc. are greatly appreciated.