NNois Posted October 22, 2015 Share Posted October 22, 2015 (edited) 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 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 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 October 22, 2015 by NNois Quote Link to comment Share on other sites More sharing options...
mestela Posted October 22, 2015 Share Posted October 22, 2015 I went through a similar journey to hack up a stereo pano shader, should get you started. If you have a reference implementation with the correct maths, should be relatively easy to do: http://www.tokeru.com/mayawiki/index.php?title=HoudiniOculusWip Quote Link to comment Share on other sites More sharing options...
NNois Posted October 26, 2015 Author Share Posted October 26, 2015 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 ++ Noël Quote Link to comment Share on other sites More sharing options...
mestela Posted October 26, 2015 Share Posted October 26, 2015 Wait a sec, isn't that basically what Matt Ebb has already done? http://mattebb.com/weblog/houdini-fisheye-camera/ Just set the fov to 360, it gets that little planet effect: Quote Link to comment Share on other sites More sharing options...
NNois Posted October 26, 2015 Author Share Posted October 26, 2015 well sadly no, look how your trees are Squashed in Y, a proper stereographic projection don't do that Quote Link to comment Share on other sites More sharing options...
mestela Posted October 26, 2015 Share Posted October 26, 2015 A power curve to bias the y vales more towards the center of the image should fix that right? Haven't looked closely, but I reckon Matts code should get you 90% the way there. Quote Link to comment Share on other sites More sharing options...
NNois Posted October 27, 2015 Author Share Posted October 27, 2015 (edited) Well the problem is 3d isn't alone and i had to repro that in nuke where i do can get a 100% projection match. Had to invest time converting the math but seems pretty hard Edited October 27, 2015 by NNois Quote Link to comment Share on other sites More sharing options...
mestela Posted October 27, 2015 Share Posted October 27, 2015 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: fisheye_little_planet.hip Quote Link to comment Share on other sites More sharing options...
NNois Posted October 27, 2015 Author Share Posted October 27, 2015 Right, But notice how the center is "pinched" compared to the "right" one Fisheye mod: Stereoscopic Projection: Quote Link to comment Share on other sites More sharing options...
NNois Posted October 29, 2015 Author Share Posted October 29, 2015 (edited) 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)) ); 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 October 29, 2015 by NNois Quote Link to comment Share on other sites More sharing options...
mestela Posted October 29, 2015 Share Posted October 29, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.