Marscaleb Posted March 21 I'm trying to find some technical info on how doom render's its sky; I recall seeing someone describe this once, but I can't seem to find it. I don't see it in the Doom wiki. When Doom renders the sky, the sky texture isn't just "flat." The further the image is from the screen, the more it gets stretched. Does anyone have data for how much/when the image gets stretched? I am trying to recreate this effect, and it would be nice to have that data. 0 Quote Share this post Link to post
Foxpup Posted March 23 What you're seeing is pincushion distortion from mapping the cylindrical projection used in sky textures to the gnomonic perspective used to render the game world, so that the rendering of the sky visually matches the rest of the world. For example, step onto the balcony at the start of Doom 2 MAP01, and turn slowly while looking at the sky through the fence. Observe that the horizontal spacing between the fence posts changes as your view rotates due to perspective, and the sky distorts to match it (at least on the horizontal axis). The perspective mapping of the sky is done using the precomputed math table xtoviewangle[], which is generated in R_InitTextureMapping() using the tangent table. The effect is that each vertical column of pixels in the sky texture is stretched horizontally by a factor of 1/cos2(α) where α is the viewing angle relative to the centre of the screen. 4 Quote Share this post Link to post
Marscaleb Posted March 23 2 hours ago, Foxpup said: The effect is that each vertical column of pixels in the sky texture is stretched horizontally by a factor of 1/cos2(α) where α is the viewing angle relative to the centre of the screen. Ah, so the precomputed table is based on that formula? Interesting and useful to know. I was really just asking to know what the values are within that precomputed table, but at this point I'm not so sure seeing the raw numbers would mean much to me. Thank you for the response. 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.