Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Ray Casting

    Beginners
    13
    70
    11538
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dave
      Dave Fuze Team last edited by

      Unbelivably awesome. My jaw is on the floor...

      1 Reply Last reply Reply Quote 0
      • F
        faz808 F last edited by

        I thought I could finally put this to bed … (or my wife did !) - but then I found this ,,,

        http://www.wolfenvault.com/resources.html

        Sorry Gothon, but I'm not finished yet ...

        1 Reply Last reply Reply Quote 1
        • F
          faz808 F last edited by

          Did some graphics work. Phew !!!
          Wolfy ID: X66M3MND15

          pianofire 1 Reply Last reply Reply Quote 2
          • pianofire
            pianofire Fuze Team @faz808 last edited by

            @faz808 Oh that is so cool!

            1 Reply Last reply Reply Quote 0
            • xevdev
              xevdev F last edited by

              Looking slick.
              It runs pretty fast .
              I'm amazed.
              How far can you scale the textures ?

              1 Reply Last reply Reply Quote 0
              • xevdev
                xevdev F last edited by xevdev

                Dumb question when I can just try it myself.

                1 Reply Last reply Reply Quote 1
                • xevdev
                  xevdev F last edited by

                  Love this.
                  Looked 2 steps into the code changed the images to a bit bigger about x 2
                  Changed the 64,64 to 128,128
                  And got this

                  Retrocade_media 1 Reply Last reply Reply Quote 5
                  • Retrocade_media
                    Retrocade_media F @xevdev last edited by

                    @xevdev
                    E1M1 quietly plays in my head
                    Seriously though this ray tracing program is amazing, the stuff that can be done with this is so awesome!

                    xevdev 1 Reply Last reply Reply Quote 0
                    • xevdev
                      xevdev F @Retrocade_media last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • F
                        faz808 F last edited by

                        I'm not sure if 128 x 128 is realistic. There would be a lot more graphic work. It took me nearly three hours to do the red brick wall at 64 x 64 !
                        Try clear(grey) - about line 118. Looks better I think.

                        1 Reply Last reply Reply Quote 0
                        • xevdev
                          xevdev F last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • xevdev
                            xevdev F last edited by

                            1 Reply Last reply Reply Quote 4
                            • F
                              faz808 F last edited by

                              Well done. Looks great at 128 x 128.

                              1 Reply Last reply Reply Quote 0
                              • PB____
                                PB____ last edited by

                                This all is very impressive, I like where it is going, looks great :)

                                1 Reply Last reply Reply Quote 0
                                • Gothon
                                  Gothon F last edited by

                                  This is some great work. The brick texture looks really good. I went on to try and do the floor casting.

                                  Turns out that the floor is a little different from the wall. drawImage() and drawQuad() can only read axis parallel rectangles from the source image, but the floor is 2D rotated relative to the player camera. I was only able to get it to work by using drawImageEx() to rotate the floor in an off-screen buffer before doing the floor casting loop. This is easiest and most efficient if the entire floor is in one giant off-screen texture.

                                  The entire floor is only 24x24 tiles, so to do this with a 32x32 texture for each floor tile, I only need a 768x768 image for the whole floor texture. The rotated floor may be sqrt(2) wider than the original, so I actually use a 1088x1088 image for the destination buffer. (Which I only now realize is 8 pixels taller than maximum :-P) For the textures themselves I found some good 16x16 assets in the media library, and I tiled 4 of them to make a 32x32.

                                  While doing it this way means that I can't enlarge the floor textures or the map without writing more complex code to do the floor from multiple images, there are several advantages too. One thing is the floor is drawn very quickly as it is just scaling lines from the rotated image buffer. There is only 1 floor and its position is fixed so there is no loop to look through the tiles for the nearest floor. Additionally there is memory for each tile to have a unique texture. This I demonstrate by drawing some randomly positioned colored circles on the floor.

                                  "ray casting w floor textures" is pending for approval now with ID: NYKDXMND9L

                                  mario.bodemann F 2 Replies Last reply Reply Quote 3
                                  • xevdev
                                    xevdev F last edited by

                                    Well done. Can't wait to see it.

                                    1 Reply Last reply Reply Quote 0
                                    • F
                                      faz808 F last edited by

                                      Fantastic job. Can this be added to the red brick/eagle version or would this be too difficult?
                                      I've got a door of sorts - actually just red brick (looking for a door texture). "A" opens "B" closes.
                                      wolfy-door ID: MYK73MND15

                                      1 Reply Last reply Reply Quote 1
                                      • F
                                        faz808 F last edited by

                                        Textured door - "A" opens "B" closes.
                                        wolfy-door2 ID: PL873MND15 (pending)

                                        1 Reply Last reply Reply Quote 1
                                        • mario.bodemann
                                          mario.bodemann F @Gothon last edited by

                                          @Gothon Oh that is great, I haven't thought about rotating a big floor texture and then taking lines out of this one... Great job.

                                          I'm curious: this means you are rotating the floor for every "probe" from the camera? And how do you get the perspective right?

                                          1 Reply Last reply Reply Quote 0
                                          • Gothon
                                            Gothon F last edited by Gothon

                                            @faz808 Image-Editor images and code can be copy/pasted between projects, so yes we can merge the programs.

                                            @mario-bodemann I am actually rotating the floor once every frame (opposite the angle of the view angle). Each horizontal line of the floor is parallel to the camera plane, so I only need to do a perspective calculation once per scan line, the rest is just a line copy and scale performed by drawImage()

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post