Question about ... raycasting

Started by
3 comments, last by Vanukoff 22 years, 9 months ago
Yea, I know raycasting (wolfenstein style) is outdated, but I am interested in it nonetheless. I have read some raycasting tutorials, and they all describe casting 320 (screen width) rays in a 60 degree (FoV) arc, finding the first intersection, and drawing a sliver, etc, etc ... They come across distortion, claiming it is due to mixing polar and cartesion coordinates, and fix it by multiplying all the scale factors with a sinus value. I have done some graphing, and feel the distortion actually comes in with the way the rays are initially cast. It seems to me that a better method is: Call the view point "O". A ray should be cast from "O" at -30 degrees, and its intersection with the viewing plane should be found (call it "PL"). Another ray should be cast from "O" at +30 degrees, and its intersection with the viewing plane should be found (call it "PR"). We should then interpolate 320 points from "PL" to "PR". Call these points "P0" through "P319" Now, each of our 320 rays to cast will be from "O" to each of "P0" - "P319". Seems to me this is a more accurate (maybe faster, since less trig is necessary) raycasting method, as our rays are cast equidistant on the viewing plane, whereas the former method does not cast equidistant rays. The former method casts equi-angular rays, which results in larger distances between rays that are farther from the centerline. I'm planning on writing a raycaster (for the hell of it), but before I proceed, I'd like to know which method to pursue. Thanks. Edited by - Vanukoff on July 18, 2001 10:44:39 PM
Advertisement
The second way''s how I wrote mine, have fun.


Mike
"Unintentional death of one civilian by the US is a tragedy; intentional slaughter of a million by Saddam - a statistic." - Unknown

Thanks. I shall proceed likewise.

assuming you are talking wolenstein, then there is another possibility. With a flat aslways horozontal viewing angle and floor/ceiling tiles that are always perpendicular then you can draw each tile as a simple scaled crossection.

to raycast each pixel is overkill. All you need to do is raycast the edges and fill in the rest by walking the texture.

Oh yeah, thanks. That''s what I was going to do. I was just talking about what kind of rays to cast. Either equidistant or equi-angular. Guess I over explained my question!

I understand that I''ll do have to cast 320 rays (one for each column of the screen), unless you have a way around that? But for each ray, I''ll just draw the scaled cross section. Correct?


This topic is closed to new replies.

Advertisement