Jump to content

Stereographic projection lens shader ?!


Recommended Posts

Hi,

 

I need to create a lens shader in VOP but can't found any info/guide about how to create one.

 

What is the correct procedure or do someone has an example file somewhere to start with ?

 

This would be a lens shader similar to the "dome master" one on orbolt https://orbolt.com/asset/nhat::DomeMaster

But mine would be to produce Little Planet result like this

 

stereographic_projection_15.jpg

 

The two projection differs because the stereographic one (above picture) deform the picture because it's a polar projection shooted from the pole of a globe, so maybe this involve a 2 pass projection... I hope not

Stereographic_projection_in_3D.png

 

 

I know i can do that in post:

1. Shoot a Polar Projection of the scene

2. Map that to a sphere then

3. Shoot the sphere from the inside the cam placed on the north pole

 

My main problem is that it involve shooting extreme resolution pictures to cover the entire revolution.

 

 

 

Cheers

Edited by NNois
Link to comment
Share on other sites

Great !

Thank you very much for these CVEX example.

 

Now i managed to make my own fisheye and my own panoramic lens. So now i need to do the real work but i'm stuck...

 

My problem is implementing the stereographic projection http://mathforum.org/mathimages/index.php/Stereographic_Projectionwitch refers to "Points on a sphere"

I assume these points are the results of the panoramic lens who needs to be reprojected on a plane right ?

 

Can I do just that in a vex shader, projecting two times in one op ?

 

here's a ref of the projection

Comparison_panorama_stereograph.png

 

++

Noël

Link to comment
Share on other sites

Bit of warping worked.  The line where Matt calculates the radius:

float r = sqrt(x*x + y*y);

I changed so it goes through a power function, which should values towards the center if you raise to a power less than 1:

float r = pow(sqrt(x*x + y*y),warp);

Playing with the fov and warp values gives this image:

 

post-7292-0-61787600-1445921773_thumb.jp

 

 

fisheye_little_planet.hip

 

 

Link to comment
Share on other sites

Hi,

I've managed to implement the real Stereographic projection ;-)

(http://www.ipb.uni-bonn.de/fileadmin/publication/pdf/Steffen2005Fish.pdf)

i = set(
    (x+x)/(1+(x*x)+(y*y)),
    (y+y)/(1+(x*x)+(y*y)),
    (1-(x*x + y*y))/(1+(x*x)+(y*y))
    );

post-11365-0-82959400-1446081798_thumb.j

 

This is for the 180° dome, just multiply x and y before and you have a "zoom" factor.

 

I was just wondering, what could be the right math to get exactly the full 360 dome ?

 

testdomeshader_v3.hipnc

 

Thanks !

Edited by NNois
Link to comment
Share on other sites

Nice one!

 

Re 180 vs 360, not sure, you might have to go read some other implementations. Does the domemaster stuff have a stereographic projection? I ended up looking through their arnold/mentalray shader code for clues when I was trying to get answers to my stereo pano stuff.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...