Before it's assigned to me, there was a fragment shader in the codebase to handle this effect.
But the view angle can not be rotated.
So I try to "google" whether there is any information about it.
Then I found this page .
It's a way to project a sphere to a plane.
It's called "stereographic projection";
Φ = asin( cos(c) sin(Φ0) + (y sin(c) cos(Φ0) / r )
λ = λ0 + atan( x sin(c) / (r cos(Φ0) cos(c) - y sin(Φ0) sin(c) )
I can use the above equation to calculate the position correspond to the x,y coordinate on the plane.
After I adjust the fragment shader by the equation, the user can watch this planet at any angle.
It's quite interesting to try the OpenGL shader, I can generate such amazing results by a few lines of code.
By the way, if you would like to try such kind of effect by your self, you can download Insta360Player.
If I didn't find a way to implement the little planets effect, I will try to decompile it's apk.
No comments:
Post a Comment