Jump to content
  • Advertisement

Archived

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

Andos

Wolf3D raycast Fisheye bug

This topic is 5815 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

Hi there. I have just made a untextured Wolf3D Engine. First i want to say that i already know whats wrong but i need to know how to do correct it. I have the players position saved in ''PlayerDirection'' I have a constant Field Of Vision on 90 degrees. My app roams through the different angles and find the distance so the current vertical line can be drawed correctly with the correct lenth and colour. Works almost fine. You maby allready have guessed that i use a sin cos calculation to loop all the way untill it hits a wall right? And then you maby know this gives me a fisheye effect... I want this to be corrected but - how? I need the rays to be cast at the same "speed" if you understand what i mean. The outer rays have to travel with a bigger speed than the one in the middle. How do i calculate that?

Share this post


Link to post
Share on other sites
Advertisement
If I remember correctly, you need to add to the distance of the ray from the eye to the wall by the cosine of the angle from the center of the screen to the column being drawn.

Now say that 3 times really fast

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I can''t even read it 3 times
My eyes start to pop.

Share this post


Link to post
Share on other sites
Hi! Here comes some ASCII art


  
______________
| |
| |
| |
| |
| |
_______________
/|
d / |
/ | e
/a |
* viewpoint


Instead of using the length of d to determine the wall height
you should use the length of e. And it shouldn't be difficult to calculate since you know the length of d and the a angle.

[edited by - Jim Adams on December 6, 2002 1:01:38 PM]

Share this post


Link to post
Share on other sites
You ASCII works fine here...

Sorry but I ain''t that good at SIN and COS. How can i find e from your ASCII art if i have the angle and d?

Share this post


Link to post
Share on other sites
I''m sure you mean cos( a ) * d

This works fine but gives the walls a strange curved look... what can be wrong???

Share this post


Link to post
Share on other sites
It should be sin(a). Here is a better image, it could make things clearer : "http://www.extra.hu/jocof1/pic1.bmp"
You could send a screenshot, maybe it would help.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!