A bit more context, please. What is map and ray?

Please log in or register to post a reply.

Sorry! map as actually ray.dir, I forgot to modify it before posting! So it should be this…

vec3 ray.dir(x,y,z)…

m = 2 * sqrt( x\^2 + y\^2 + (z+1.0)\^2 );

U = x / m + 0.5;

V = y / m + 0.5;

Thanks.

That looks like a latitude/longitude style texture map.

If you convert the x,y,z, of the vert to latitude longitude and scale it to the range 0-1 it should work.

lat = atan2(z,y)

longitude = atan2(x,z)

At least that’s what I would try

That’s definitely not a lat-long map; it’s a “mirror-ball” map - a parallel projection of sphere reflecting the world. Anyway, the equations you posted are a little confused. Here is an article on the topic, and according to it the equations for using a mirror-ball map are:

m = sqrt(2.0 * (z + 1.0))

u = 0.5 * x/m + 0.5

v = 0.5 * y/m + 0.5

@Reedbeta

That’s definitely not a lat-long map; it’s a “mirror-ball” map

Is it really? The image looks lile it has the horizon at the edge of the circle. A mirror ball would have the horizon a bit in from the edge, where the angle of the balls surface is 45 deg. and at the edge, where the surface is parallell to the eye ray, the ground behind the ball would be visible.

@Reedbeta

u = 0.5 * x/m + 0.5

v = 0.5 * y/m + 0.5

This worked perfectly Reedbeta :)) Thank you

One more question. Is it possible to set the FOV for the skydome map separatetly from the rest of the model? What I mean is, viewing my model at FOV=35, the sky seems very close. Viewing it at FOV=75 looks much better, I can see the sun. But my model is also viewed at 75. So what I want to do is display the model at 35 but the skydome at 75. Is that possible?

Hmm, geon, you’re right - it looks more like a 180-degree fisheye or something than a true mirror-ball map, which contains the entire environment. Alienizer, that might be why you’re having a FOV problem - the map is supposed to be 180 degrees wide, but is being stretched over 360 degrees, hence looks bigger (closer) than it should be.

Alienizer, you might try using the fisheye equations from this article and see how well that works.

@Reedbeta

Actually, it’s a skydome. The shot was taken on the ground facing up (90 deg) to the sky, that’s why no ground is in the shot. The other equation did not work, but yours does!

It’s like this one…

http://www.barnabu.c…in-sketchup.JPG

Here is a big image of the skydome as oppose to the thumbnail I posted…

http://www.tutorialsforblender3d.com/Textures/Skys/SkyDome/SkyDome-Cloud-Medium-MidMorning.png

direct linking not allow, so here is the page…

None of the algo on this thread works for the following maps…

http://sw-in.narod.ru/hdrout.html

Any idea what the correct u,v mapping algo is for this one? Thanks!

Yes, that’s what I meant. ok then. what kind of map is best to use for all round good resolution?

@Alienizer

ok, but is that not accurate? I mean, the corners will look weird when rotating the cam?

There is no problem I’m aware of. It is used very commonly ingames.

- Upcoming Multiplatform Game Program...
- my new game 'squarecity' feedback w...
- Our first game - looking for feedbacks
- Network Emulation Tool
- Trouble with accessing GLSL array
- Fiction
- Game Programming Patterns: Bytecode
- Interactive WebGL Water Demo
- Skeletal Animation Tutorial with GP...
- Unreal Engine 4

Hi,

Can someone please help me get the proper UV mapping for a skydome such as this one…

https://encrypted-tb…yt50Wu7hvQBuwMs

I’ve tried the following but isn’t looking right!

m = 2 * sqrt(map.x*map.x + map.y*map.y + (map.z+1.0)*(map.z+1.0));

U = ray.dir.x/m + 0.5;

V = ray.dir.y/m + 0.5;

Thanks!