Skip to main content
GameDev.net gamedev.net
🔒 Locked

texture mapping formulas

Started by tibo May 22, 2003 at 11:16 AM 0 replies 400+ views
Original Post
tibo
tibo
sorry i started this topic asking the formula for spherical mapping, because mine didn't work. But it was just a coding bug (x instead of z). Anyway here it is if people are intersted void SphereMap(x,y,z,radius,u,v) double x,y,z,r,*u,*v; { *v = acos(z/radius) / PI; if (y >= 0) *u = acos(x/(radius * sin(PI*(*v)))) / TWOPI; else *u = (PI + acos(x/(radius * sin(PI*(*v))))) / TWOPI; } cya [edited by - tibo on May 22, 2003 12:33:02 PM]
higherspeed
higherspeed
I looked at the subject a while ago. There are ways to map a sphere onto a plane and the other way round that are far quicker than using the main method I''ve seen. I suppose the standard way is used, because that is how all the sphere maps are created. Of course it doesn''t matter if it is calculated while loading the game, but for dynamic effects it could be worth it.

On the other hand my methods may have produced a little more warping and loss of definition over some areas of the sphere.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.