Ok...
Let's suppose we have this real life example:
We have a transparent (glass) cube inside a transparent glass sphere. We are in the middle of the cube, tied to a chair, we can only rotate the head left/right, up down. We are blindfolded to an eye, and we assume that we rotate only that eye, not the head (to eliminate the small distance changes).
Now, we draw some points/images on the cube, and on the sphere, in such a way that from our eye it would appear as they are both at the same position (ie. the point on the cube will obscure the point on the sphere). Of course, the points on the cube will be slightly bigger, to adjust the prespective correction.
Now, according to what you guys say, even if we rotate our head, in any arbitrary direction, the points on the cube will ALWAYS obscure the coresponding points on the sphere?
Skydome vs. GLUQuadrics
Quote:Original post by Raduprv
Now, according to what you guys say, even if we rotate our head, in any arbitrary direction, the points on the cube will ALWAYS obscure the coresponding points on the sphere?
Yes. Assuming the size of the projection surface (your retina in this case) is very small (point-like) compared to the distance to the sphere/box. The box, sphere, or whatever other convex and symmetric shape you might choose, are just ways to store a 360° irradiation map around a single point in space. Other than for inherent aliasing differences (those I outlined above), all those shapes will be perfectly equivalent.
Oh yes, and for this experiment to work, you need to close one eye, as it will break down with stereo view (unless the distance to the box is very large compared to the distance between your eyes).
Ok, if you both say so, then I will believe you. My original problem has to do with the fact that the sky boxes I've seen in various games don't look convincing enough. I guess I will have to play with a skydome when I will have some time, and see if I can notice those artefacts I notice in skyboxes (and also draw some lines and stuff, to help me visualise the math stuff.
And BTW, thanks all of you for your patience :)
And BTW, thanks all of you for your patience :)
Your welcome for Hi-jacking my thread!! :D BTW now that is all decided... why would my textures be messed up on my skydome? Here is the code to render it.
This is some code I looked at on the net, and it renders the wireframe ok, but textures no? I am using a 512x512 texture? Do I need somekind of fisheyed looking texture for a skydome? thanks
void CSkyDome::GenerateSkyDome(float radius, float dtheta, float dphi, float hTile, float vTile){ // Used to calculate the UV coordinates float vx = 0.0f; float vy = 0.0f; float vz = 0.0f; float mag = 0.0f; int theta = 0; int phi = 0; int n = 0; if (Vertices) { delete []Vertices; Vertices = NULL; NumVertices = 0; } // Initialize our Vertex array NumVertices = (int)((360/dtheta)*(90/dphi)*4); Vertices = new VERTEX[NumVertices]; // Generate the dome for (phi=0; phi <= 90 - dphi; phi += (int)dphi) { for (theta=0; theta <= 360 - dtheta; theta += (int)dtheta) { // Calculate the vertex at phi, theta Vertices[n].x = radius * sinf(phi*DTOR) * cosf(DTOR*theta); Vertices[n].y = radius * sinf(phi*DTOR) * sinf(DTOR*theta); Vertices[n].z = radius * cosf(phi*DTOR); // Create a vector from the origin to this vertex vx = Vertices[n].x; vy = Vertices[n].y; vz = Vertices[n].z; // Normalize the vector mag = (float)sqrt(SQR(vx)+SQR(vy)+SQR(vz)); vx /= mag; vy /= mag; vz /= mag; // Calculate the spherical texture coordinates Vertices[n].tx = hTile * (float)(atan2(vx, vz)/(PI*2)) + 0.5f; Vertices[n].ty = vTile * (float)(asin(vy) / PI) + 0.5f; n++; // Calculate the vertex at phi+dphi, theta Vertices[n].x = radius * sinf((phi+dphi)*DTOR) * cosf(theta*DTOR); Vertices[n].y = radius * sinf((phi+dphi)*DTOR) * sinf(theta*DTOR); Vertices[n].z = radius * cosf((phi+dphi)*DTOR); // Calculate the texture coordinates vx = Vertices[n].x; vy = Vertices[n].y; vz = Vertices[n].z; mag = (float)sqrt(SQR(vx)+SQR(vy)+SQR(vz)); vx /= mag; vy /= mag; vz /= mag; Vertices[n].tx = hTile * (float)(atan2(vx, vz)/(PI*2)) + 0.5f; Vertices[n].ty = vTile * (float)(asin(vy) / PI) + 0.5f; n++; // Calculate the vertex at phi, theta+dtheta Vertices[n].x = radius * sinf(DTOR*phi) * cosf(DTOR*(theta+dtheta)); Vertices[n].y = radius * sinf(DTOR*phi) * sinf(DTOR*(theta+dtheta)); Vertices[n].z = radius * cosf(DTOR*phi); // Calculate the texture coordinates vx = Vertices[n].x; vy = Vertices[n].y; vz = Vertices[n].z; mag = (float)sqrt(SQR(vx)+SQR(vy)+SQR(vz)); vx /= mag; vy /= mag; vz /= mag; Vertices[n].tx = hTile * (float)(atan2(vx, vz)/(PI*2)) + 0.5f; Vertices[n].ty = vTile * (float)(asin(vy) / PI) + 0.5f; n++; if (phi > -90 && phi < 90) { // Calculate the vertex at phi+dphi, theta+dtheta Vertices[n].x = radius * sinf((phi+dphi)*DTOR) * cosf(DTOR*(theta+dtheta)); Vertices[n].y = radius * sinf((phi+dphi)*DTOR) * sinf(DTOR*(theta+dtheta)); Vertices[n].z = radius * cosf((phi+dphi)*DTOR); // Calculate the texture coordinates vx = Vertices[n].x; vy = Vertices[n].y; vz = Vertices[n].z; mag = (float)sqrt(SQR(vx)+SQR(vy)+SQR(vz)); vx /= mag; vy /= mag; vz /= mag; Vertices[n].tx = hTile * (float)(atan2(vx, vz)/(PI*2)) + 0.5f; Vertices[n].ty = vTile * (float)(asin(vy) / PI) + 0.5f; n++; } } } // Fix the problem at the seam for (int i=0; i < NumVertices-3; i++) { if (Vertices.tx - Vertices[i+1].tx > 0.9f) Vertices[i+1].tx += 1.0f; if (Vertices[i+1].tx - Vertices.tx > 0.9f) Vertices.tx += 1.0f; if (Vertices.tx - Vertices[i+2].tx > 0.9f) Vertices[i+2].tx += 1.0f; if (Vertices[i+2].tx - Vertices.tx > 0.9f) Vertices.tx += 1.0f; if (Vertices[i+1].tx - Vertices[i+2].tx > 0.9f) Vertices[i+2].tx += 1.0f; if (Vertices[i+2].tx - Vertices[i+1].tx > 0.9f) Vertices[i+1].tx += 1.0f; if (Vertices.ty - Vertices[i+1].ty > 0.8f) Vertices[i+1].ty += 1.0f; if (Vertices[i+1].ty - Vertices.ty > 0.8f) Vertices.ty += 1.0f; if (Vertices.ty - Vertices[i+2].ty > 0.8f) Vertices[i+2].ty += 1.0f; if (Vertices[i+2].ty - Vertices.ty > 0.8f) Vertices.ty += 1.0f; if (Vertices[i+1].ty - Vertices[i+2].ty > 0.8f) Vertices[i+2].ty += 1.0f; if (Vertices[i+2].ty - Vertices[i+1].ty > 0.8f) Vertices[i+1].ty += 1.0f; }}
This is some code I looked at on the net, and it renders the wireframe ok, but textures no? I am using a 512x512 texture? Do I need somekind of fisheyed looking texture for a skydome? thanks
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement