Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
576 views
in Technique[技术] by (71.8m points)

unity3d - Mapping equirectangular image on to rectangle in shader not working

I recently tried to get a regular image (with normal fov) out of a equirectangular one. My rudimentary approach to simply put the image on a sphere and then position a camera on the inside failed because the rectangular image wouldn't seamlessly wrap around the sphere. Now I tried using a shader to directly undistort the panorama onto a rectangle. Here is my current shader for that: (I used the Unity Shader Graph) Shader Setup

I'm not that good with maths an tried to follow this blog post. It provides the following equations: The Equations

I tried to replicate them in Shader Graph to determine the point at which the panorama should be sampled. However, when I try it out it seems like something is working, but the image is distorted, rotated and I can't zoom in properly. Distorted Image 1 Distorted Image 2

I'm using uv coordinates for the latitude and longitude. Could that be the problem?

question from:https://stackoverflow.com/questions/65601816/mapping-equirectangular-image-on-to-rectangle-in-shader-not-working

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...