4
\$\begingroup\$

I'm using the formula I've found here to map procedural texture on to a quad sphere.

For example I'm working with a 3d panoramic cube map that I've generated with a simplex noise.

Each face of the cube will be seamless. That's not the point.

My problem is that the corners of each face will have the typical distortion after mapping it onto the quad sphere.

Therefore I want to "manipulate" or prepare the texture ( in this case, the heightmap ) of each face individually with a curvilinear pincushion distortion.

  1. Am I assuming right that the curvilinear pincushion distortion will compensate the distortion effect on the quad sphere ?
  2. Can someone point me to a formula of the curvilinear distortion or the corresponding calculation of the formula I've linked ?

enter image description here

A: original texture. B: what my texture should look like after preparing.

note that B is only a sketch !

\$\endgroup\$
  • 1
    \$\begingroup\$ If you want to achieve what is seen on B rihgt, you can simply use planar mapping, but this isn't going to be seamless. As you see the texture edges don't match the cubesphere edges. \$\endgroup\$ – akaltar Jul 20 '15 at 13:56
  • \$\begingroup\$ I've solved this problem by directly generating the noise textures the way they should be projected onto the sphere. \$\endgroup\$ – Ace Jul 21 '15 at 8:51
  • \$\begingroup\$ If that would be an answer to your question, then please make it an answer and elaborate on the technique you used. Also if you are working with a subset of textures, noise in the example, then you should have added that to your question. \$\endgroup\$ – akaltar Jul 21 '15 at 12:36
  • \$\begingroup\$ I have an animated gif demonstrating a similar distortion in this answer — is that the kind of thing you're looking for? In this example it's not an exact analytical solution, just a tweak to subjectively improve the uniformity of the sphere projection in terms of area per grid cell. The angular distortion at the corners remains the same. If that's useful to you I can post the formula I used. \$\endgroup\$ – DMGregory Nov 25 '15 at 6:46
1
\$\begingroup\$
  1. No, Pincushion distortion is not actually the inverse of Barrel distortion. (Proof below)

  2. This paper seems to be shooting for exactly what you want: http://sprg.massey.ac.nz/pdfs/2003_IVCNZ_408.pdf (Formulas inside)

nice paper

Proof as promised: By contradiction for simplicity.

Extracting the relevant fact about Barrel (and/or Pincushion) distortion:

(2): $$R_{skew} = f_k(R_{flat})$$

We construct an equation we can solve for our correction constant "j" in terms of the distortion constant "k":

(3): $$R_{flat} = f_j(f_k(R_{flat}))$$

(4): $$R_{{flat}}=R_{{flat}}(R_{{flat}}^2k+1)(R_{{flat}}^2j(R_{{flat}}^2k+1)^2+1)$$

Which we can then re-arrange to isolate "j":

(5): $$j=\frac{-k}{R_{{flat}}^6 k^3+3 R_{{flat}}^4 k^2+3 R_{{flat}}^2 k+1}$$

Which depends on the independent variable, and thus is not a constant. Therefore a Pincushion or Barrel distortion does not compensate its complement distortion.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.