Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Anarkavre

Members
  • Content count

    125
  • Joined

  • Last visited

2 Followers

About Anarkavre

  • Rank
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Anarkavre

    The Definitive Guide to Visplanes

    I have not seen it, but I will read it. I was curious how they worked for use in my ray-casting engine. Once I learned everything, I thought the knowledge may benefit others. I was planning on writing this article for a few months. I had the figures, notes, and a rough draft, but I only wrote the full article today. I wasn't aware of anything that went in depth and I wanted to try to explain it as simple as possible.
  2. Visplanes have always seemed mysterious, so I planned to write an article explaining them that was simple to understand. I went through all the related code and everything can be categorized into three stages: Generation, Mapping, and Rendering. I will explain the code for these three stages with simple explanations and visuals. Just a warning, parts of this require knowledge of algebra, geometry, and trigonometry, so brush up on those for a full understanding. So with that, let’s delve into the mysterious visplanes. Generation Each frame R_ClearPlanes is called in R_RenderPlayerView to reset data related to clipping, visplane generation, and texture mapping. I will come back to the part related to texture mapping in a later section. R_FindPlane is called in R_Subsector for both the floor and the ceiling. This checks to see if a visplane already exists with the same height, pic, (different for floor and ceiling) and light level of the subsector. If it cannot find one, it creates a new one with the height, pic, and light level of the subsector. R_CheckPlane is called in R_StoreWallRange for both the floor and ceiling if they are visible. This checks if the plane selected earlier can be merged with the area it wants to render. If there is no vertical divide, the area is merged with the visplane. If it cannot be merged, a new visplane is created. As the linesegs are rendered in R_RenderSegLoop, the top and bottom of the of visplane are marked for both the floor and ceiling if they are visible. Mapping R_DrawPlanes is called in R_RenderPlayerView to draw all visplanes that were generated. If the visplane is for a sky, it will draw the sky as columns like the walls and the sprites since it does not have to be projected the same way as floors and ceilings. If the visplane is for a floor or ceiling, it will convert the columns into spans of pixels to be drawn. Figure 1 - Floor as columns Figure 2 - Floor as spans It does it this way because the strip of the floor or ceiling is at a constant depth and it helps save on perspective calculations that can be done once and used for the entire span. R_MakeSpans is called in R_DrawPlanes for each visplane drawn. It performs the conversion from columns to spans. When a span is ready to be drawn, R_MapPlane is called in R_MakeSpans. It performs the necessary perspective calculations for the span and caches them so they can be reused. The mathematics behind this is simple algebra, geometry, and trigonometry. We can find the distance to the strip of floor or ceiling using similar triangles and some known variables. We know the distance of the floor or ceiling from the player's view, the distance of the projection plane y the span is on from the center y of the projection plane, and the distance from the player to the projection plane. The distance from the player to the projection plane can be easily calculated. The player field of view is 90° which makes it a 45°–45°–90° triangle. The projection plane would be along the hypotenuse of this triangle. Figure 3 - Field of view and projection plane We can find the distance from the player to the projection plane using trigonometry. projectionplanedistance = (viewwidth / 2) / tan(90 / 2) = viewwidth / 2 The distance can then be calculated. distance = planeheight * projectionplanedistance / dy The step used for texture mapping can also be calculated. We know that the distance to the projection plane is equal to half of the width of the projection plane. This also applies for the distance to the strip of floor or ceiling. step = distance / projectionplanedistance We need to know the step in the x and y directions of world space. We can find these using trigonometry. xstep = step * cos(viewangle - 90) ystep = -step * sin(viewangle - 90) The last thing we need before rendering can happen is the point in world space where the strip of floor or ceiling begins. This can be found using trigonometry and some known variables. We know the player view x, player view y, the player view angle, the view angle of the projection plane x where the span starts, and the distance to the strip of floor or ceiling. x = viewx + (distance / cos(xviewangle) * cos(viewangle + xviewangle) y = -viewy - (distance / cos(xviewangle) * sin(viewangle + xviewangle) Rendering R_DrawSpan or R_DrawSpanLow is called in R_MapPlane depending on the graphic detail mode set. It draws the span by stepping over the strip of floor or ceiling in texture space and sampling the texture at each discrete point. Figure 4 - Sampling points Figure 5 - Sampling points zoomed That is all there is to visplanes. They aren't very mysterious after all. I wrote a little demo that lets you watch a floor be drawn. You can also turn, move, and strafe. You can think of it as being a room with walls infinitely far away, so the visplane starts at the horizon which is the center y of the projection plane. The demo isn't exactly how Doom works, but it uses all the same mathematics that I explained. I hope you enjoyed this article and learned something from it. If I made any mistakes or errors, please let me know so that I may make corrections.
  3. Anarkavre

    Doom on Halt and Catch Fire

    Did anyone else see Doom on the last episode of Halt and Catch Fire? There is a scene of a game conference and Cameron, one of the main characters, makes her critique of Doom. She has a negative opinion at first, but then her opinion becomes more positive when in a later scene she plays a game of deathmatch against Gordon, another main character. I had a feeling that Doom would eventually be mentioned or shown when there was a season set in the '90s.
  4. Anarkavre

    Eclipse

    I saw it in Gatlinburg, Tennessee. It was amazing when it was fully eclipsed.
  5. Anarkavre

    So, how do you appreciate Indian culture

    Tikka Masala with Naan is my favorite Indian dish.
  6. Anarkavre

    Do you miss the old Doomworld?

    I miss the days of the Doom community from 1998 to the early 2000s, but that is mostly nostalgia on my part. Though I am happy it lives on through Doomworld, considering how many old Doom websites have died. These days I mostly lurk the forums and occasionally go on IRC, but my heart is still with this community. As far as the new site design goes, I am getting used to it. I liked the old design, but probably because I was used to it for so long. The same will most likely happen with this design as has happened with the many past designs.
  7. Anarkavre

    20 Years of Doom 64.

    My favorite Doom 64 memory is when I rented it around the time it was released, popped the cartridge into the N64, pushed the power switch, and watched the awesome opening sequence with the eerie music. That briefly showed the mood and the atmosphere of the game and sticks with me to this day. It is one of my favorite video game openings.
  8. Anarkavre

    $9 PocketCHIP "Great for Doom LANs!"

    I own 2 CHIPs and 2 PocketCHIPs and as fraggle said, they are nice. I installed Chocolate Doom and OpenArena. They recently released a new image with 3D support. The GPU it has supports OpenGL ES 1.1 and 2.0.
  9. Anarkavre

    idgames Maintainer Ty Halderman Passes Away At 69

    RIP Ty. Thank you for all of your contributions to Doom and its community. I still remember visiting and browsing the /idgames archive at ftp.cdrom.com and submitting some of my own WAD files there when I was younger. Those were the days.
  10. Anarkavre

    Screenshot from DW in 1999

    I remember that design. Those were the days. I remember.
  11. Anarkavre

    Doom 3: BFG Edition for NVIDIA SHIELD devices

    An Android port of Doom 3: BFG Edition has been released for NVIDIA's SHIELD ANDROID TV and SHIELD TABLET devices. The port is available for purchase on Google Play.
  12. An Android port of Doom 3: BFG Edition has been released for NVIDIA's SHIELD ANDROID TV and SHIELD TABLET devices. The port is available for purchase on Google Play.
  13. Linguica is a genius! http://imgur.com/a/3aTvw
  14. Anarkavre

    Wickland

    Wickland looks pretty cool. It's like Q3A and UT with a mix of Heretic and Hexen.
  15. Anarkavre

    Doomworld Steam Curator

    Just to keep that thread on topic about Steam Curators in general. I will leave it up to the moderators to decide.
×