#### Archived

This topic is now archived and is closed to further replies.

# Question about ... raycasting

This topic is 6330 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
The second way''s how I wrote mine, have fun.

Mike

##### Share on other sites

Thanks. I shall proceed likewise.

##### Share on other sites
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.

##### Share on other sites

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?

1. 1
Rutin
38
2. 2
3. 3
4. 4
5. 5

• 11
• 12
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
633350
• Total Posts
3011467
• ### Who's Online (See full list)

There are no registered users currently online

×