bezo97 / IFSRenderer

3D IFS fractal renderer and editor
https://ifsrenderer.z97.io/
GNU General Public License v3.0
52 stars 7 forks source link

Tilted fisheye projection #36

Open bezo97 opened 1 month ago

bezo97 commented 1 month ago

Some planetarium domes have their projectors set up with an offset/angle away from the center. Adding an extra parameter to the fisheye projection would solve the issue. I'm not too familiar with the math so it might take a while. Here's a resource to start off with that looks useful.

The request comes from @vitos1k in this forum discussion.

vitos1k commented 1 month ago

i've succesfully added tilting into the ifs_kernel.comp.shader into project_fisheye section It works as intended, but for now with hardcoded tilting values, because i'm not sure where to add 3 parameters (TiltX, TiltY, TiltZ) in the interface. And i'm not quite sure where in the code should i initialize those parameters

On the video bellow you can see that center of interest is tilted 30 degrees down

https://youtu.be/obu7SuASQsI

bezo97 commented 1 month ago

@vitos1k That's great, you did the difficult part! Send a Pull Request and I'll finish up the rest for the next release

bezo97 commented 1 month ago

@vitos1k After merging your PR #38 I did a tiny optimization to do the tilting on cpu instead of the shader, so it is now included in the projection matrix when the type is fisheye - see 3ac7717 Also I added sliders to the camera panel. I'm not sure if its the best there.. Let me know if you have any feedback, you can try it on the dev branch

image

vitos1k commented 1 month ago

@vitos1k After merging your PR #38 I did a tiny optimization to do the tilting on cpu instead of the shader, so it is now included in the projection matrix when the type is fisheye - see 3ac7717 Also I added sliders to the camera panel. I'm not sure if its the best there.. Let me know if you have any feedback, you can try it on the dev branch

image

Looks good, and works as intended! Thanks alot! Yeah, it's better to calculate tilting once, before rendering, in projection matrix, rather than for each point in the shader, nicely done! Sliders in camera panel are most logical placement imho