• Advertisement

Archived

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

Doom Floors

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

I''ve searched everywhere for a fast (any) alogrithm to render floors and celings in my raycasting engine, without success, can anyone help?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
How exactly, are you doing it?

Share this post


Link to post
Share on other sites
The usual way I guess, the floor is ray-casted and the walls drawn on top, whatever I do I can't the floor movement to fit the wall movement. The FOV is correct, the scaling constant, view height, everything seems right but it just doesn't quite work.

I thought I would give somebody else's algoritms a go because I'm about to ditch mine.

[edited by - Neoteric on January 25, 2003 11:33:37 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Before you draw the walls, paint the lower half of the screen your floor color, and the upper part your roof color. That''s what wolfenstein 3d did, and just about every other raycaster I''ve seen does.

But, you say, Doom has better floors that that!

Yeah, because Doom didn''t use raycasting. I''m not sure why there''s this persistent rumor that it did.

Share this post


Link to post
Share on other sites
Ray casting was used to draw the textures onto the polygons after they came out of the tree, I assume floors were done similarly.

I think the problem is how I'm handling the fisheye on the ceiling, it seems to distort slightly at the far edges, Just need to figure out exactly what needs fixing. The math seems to work in my head and on paper, but not in practice. It's something obvious though.

(I apologise for the un-optimised speed, example moved to next post)




[edited by - Neoteric on January 29, 2003 11:55:17 AM]

Share this post


Link to post
Share on other sites
...the problem is better illustrated when the floor moves...

select the applet and use W,S,A and D to move.

[Edited by - Neoteric on July 1, 2004 9:53:25 AM]

Share this post


Link to post
Share on other sites
quote:

Ray casting was used to draw the textures onto the polygons
after they came out of the tree, I assume floors were done similarly.



I don''t think so, the walls were drawn using a column based rasterizer (similar to the final process of ray-casting in 2.5d worlds but not quite). The floors and ceilings were scanline rasterized, making use of the constant-z scanlines coz all the floors were flat.

Share this post


Link to post
Share on other sites
quote:
Original post by JuNC
I don't think so, the walls were drawn using a column based rasterizer (similar to the final process of ray-casting in 2.5d worlds but not quite). The floors and ceilings were scanline rasterized, making use of the constant-z scanlines coz all the floors were flat.


I stand corrected.

I was thinking of the beginning of the process, my floors work similarly, I think, but then again i've used sources from all over the place to put that togeather. .

The problem is the field of view is too large on the floor, it should be right, but I'm forgetting something.



[edited by - Neoteric on January 29, 2003 3:56:54 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
>...the problem is better illustrated when the floor moves...
the x of the walls have fisheye disortion

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
>...the problem is better illustrated when the floor moves...
the x of the walls have fisheye disortion


Wouldn't that make the walls bend when looking straight on? You're right though, they seem to compress around the screen edges. The column scale is worked out like this, with fisheye correction. Am I missing something?

ray_len = (ray_len/120) * Math.cos(ray_angle);




[edited by - Neoteric on January 30, 2003 3:04:59 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Neoteric
...the problem is better illustrated when the floor moves...

click here

select the applet and use W,S,A and D to move.


Eeek! please use a different texture for floor and walls so I can at least recognise something
Also wsad sux on azerty keyboards, please use numpad or arrows...


_____________
WINDOZE XP SI ?.??~!..

Share this post


Link to post
Share on other sites
quote:
Original post by Lode

Eeek! please use a different texture for floor and walls so I can at least recognise something
Also wsad sux on azerty keyboards, please use numpad or arrows...



Sorry, I kinda bashed that togeather in a rush.

I'll put a new one up tomorrow, if my computer comes back to life again. Either my motherboard or PSU is blown, don't know which yet.

EDIT: needs shading and perhaps lighting if I get time. That will make things lots easier to see.



[edited by - Neoteric on February 1, 2003 5:14:10 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
>ray_len = (ray_len/120) * Math.cos(ray_angle);
ray_len = (ray_len/120) * Math.cotan(ray_angle);

Share this post


Link to post
Share on other sites
hmm, let me say, you''re "heading" for a wrong direction
The Wolfenstein used raycasting, but Doom used simple polygon based rendering with BSP. The floors and celis are a bit tricky.

I spent years on reveal the "secret" of the Doom technique, and back in ''98 I managed to do my own Doom engine, which was as fast as the original (but with no sprite objects)

Turn on the noclipping mode (idclip or idspispopd) and walk through the walls and check out how the floors and ceils look like. I''d have never figured out the truth without the noclip mode


If is there any interest in the full story I may write an article on this with "illustrations". It''s now too difficult to briefly explain (my defective english)



Share this post


Link to post
Share on other sites
quote:
Original post by bmarci
hmm, let me say, you're "heading" for a wrong direction
The Wolfenstein used raycasting, but Doom used simple polygon based rendering with BSP. The floors and celis are a bit tricky.


I'll be heading onto a proper 3D engine next. As I see it there would hardly be any difference between implementing the two different texturing methods because that's very nearly what I'm doing, just "raycasting" was slightly faster for me being a noob and the specifics of this project kind of demand it. I'm doing things similarly to the way described here:

http://www.acs-home.de/rex3d/


quote:
I spent years on reveal the "secret" of the Doom technique, and back in '98 I managed to do my own Doom engine, which was as fast as the original (but with no sprite objects)

Turn on the noclipping mode (idclip or idspispopd) and walk through the walls and check out how the floors and ceils look like. I'd have never figured out the truth without the noclip mode



If is there any interest in the full story I may write an article on this with "illustrations". It's now too difficult to briefly explain (my defective english)



I'll give that a go, should be getting PSU replaced soon.

[edited by - Neoteric on February 3, 2003 11:52:21 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
ray_len = (ray_len/120) * Math.cotan(ray_angle);



ray_len = (ray_len/120) * Math.cotan(ray_angle);
..
ray_len = (ray_len/120) * (1/Math.tan(ray_angle));
..
ray_len = (ray_len/120) / Math.tan(ray_angle);

???

Thanks... but are you sure you ment cotangent? I'm quite sure that's not going to work with this system.

[edited by - Neoteric on February 4, 2003 5:48:46 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I am not sure that I understand your code,
maybe it is simpler if you stick to this:
use trigonometry ( I mean cos, sin, tan .. ) only to generate your view_to_world_matrix and later on only use linear eqations and Y_screen=Y/Z

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
I am not sure that I understand your code,
maybe it is simpler if you stick to this:
use trigonometry ( I mean cos, sin, tan .. ) only to generate your view_to_world_matrix and later on only use linear eqations and Y_screen=Y/Z



That''s what I''m doing, column scale is calcualted and then fisheye correction on top. I''m doing it wrong though because there is still x-fisheye, the walls compress at the sides of the screen.


ray_len = (ray_len/120) * - scale
Math.cos(ray_angle); - fisheye

It''s a standard way to do it from what i''ve read but it''s not working in this case.

I uploaded a better version.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Your floor rendering is correct, it''s your wall rendering that is flawed.

You shouldn''t use fisheye correction, because you really shouldn''t get a fisheye effect at the beginning to start with!
I assume you generate your rays by dx=cos(angle); dy=sin(angle);
This is wrong for a planar projection.

You need to find the first dx,dy on the screen (cos(playerangle-45),sin(playerangle-45)) and the last dx+dy on the screen (cos(playerangle+45),sin(playerangle+45)) and for each column get your dx and dy by interpolating between these! Sounds odd, but it will work, i''ve used this method to avoid fisheye in a voxel engine.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Your floor rendering is correct, it's your wall rendering that is flawed.

You shouldn't use fisheye correction, because you really shouldn't get a fisheye effect at the beginning to start with!
I assume you generate your rays by dx=cos(angle); dy=sin(angle);
This is wrong for a planar projection.

You need to find the first dx,dy on the screen (cos(playerangle-45),sin(playerangle-45)) and the last dx+dy on the screen (cos(playerangle+45),sin(playerangle+45)) and for each column get your dx and dy by interpolating between these! Sounds odd, but it will work, i've used this method to avoid fisheye in a voxel engine.




My eternal thanks, it works perfect.

There is a very small slippage of textures, it's almost unnoticeable, but that might be because I'm loosing accuracy somewhere. Oddly the floor is still fisheye corrected even though the method is the same.

I'll upload it shortly.

EDIT: here it is:

click here

[edited by - Neoteric on February 9, 2003 9:39:59 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
glad to see I could help
maybe i should bother registering a user here on gamedev.. nah.. being an anonymous poster suits me

anyway, is your FOV exactly 90 degrees on both the wall and floor rendering? looks like a slight difference.. could well be something else though..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Me too should use my user name, the other Anonymous Poster sounds so similar to me, that even I have problems to distinguish my posts . Maybe he writes better english

Share this post


Link to post
Share on other sites
:Runs off screaming:

Yeah, it''s as confusing as hell. One of you register as Anonymous_Poster(2)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hahaha yeah, I should do that

Share this post


Link to post
Share on other sites

  • Advertisement