Jump to content
  • Advertisement

Archived

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

Vanukoff

Question about ... raycasting

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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?


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!