Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Anonymous's avatar
Anonymous
13 years ago

Executing Barrel Warp by dependent texture lookup

I am currently working on the barrel warp part of Oculus integration and am trying to use dependent texture lookup instead of computing the distortion in the shader in realtime:

1) Encode the distortion function into a 2D texture.
2) In the shader, first lookup the distorted coordinate from here, then lookup the output color from the scene render target using this result.

It seems to me that this has various advantages over computing the distortion directly in the shader:

1) Since the distortion texture needs to be computed only once, more complicated distortion formulas can be used. For example use a real polynomial, instead of limiting to just even powers. Also correction for astigmatism or similar conditions might be possible.
2) Due to the pre-calculation it is known exactly which pixels will be looked up from the scene render target. So it is possible to optimize clipping.
3) The distortion texture could be combined with other fullscreen post-processing distortion filters
4) In theory this can be done without shader capabilities

Has anyone else experimented with this and can share his experiences?

2 Replies