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.
    • 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
        • F
          faz808 F last edited by

          Combining the 2 progs together gives some interesting effects. Have a look at the eagle blocks. I think I can see how to do windows.
          wolfy-door3. ID: 5PHR7MND15

          1 Reply Last reply Reply Quote 1
          • Dave
            Dave Fuze Team last edited by

            This is by far one of the most exciting things I've ever seen.

            Hats off to everyone. This is impressive, we're all here at the office just jaws on the floor.

            So very excited to see the progress. The fact that this is now almost a big group project is just awesome. We're getting tears in our eyes! :)

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

              @Gothon As a ceiling is basically an inverted floor, could it be possible to add a ceiling with a modified floor code?

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

                @faz808 Yes, the ceiling is basically the same.

                If you copy the code from the floor loop into the ceiling loop, you need to make p positive by changing p = int(y - h/2) to p = -int(y - h/2) or p = int(h/2 - y). And you also need to adjust the y texture coordinate by 2 tiles by replacing ..., offset.y + ... with ..., offset.y + 64 + ...

                This will mirror the floor onto the ceiling. To have a different ceiling you will need to make image buffers for the ceiling and fill them with something different and replicate the rotation code.

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

                  Also, since the ceiling and floor loops were using different step sizes, I have noticed some line banding occurs when the loop uses step 2. I have fixed this by using 0 for the sourceH parameter instead of 1. The choice of doing smaller or larger step size is a minor trade-off between speed and visual quality, banding shouldn't be dependent on it. Just make sure the last parameter, the height is at least the step size so that you don't leave any gaps.

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

                    Ceiling works fine until you rotate the camera. Floor goes one way and ceiling goes the opposite. Not sure how to fix this !
                    I've kept the offset.y + 64 to offset.y + 32 as this brings the ceiling down to the correct height.
                    +64 seems to lift the ceiling above the blocks creating a gap.
                    wolfy-ceiling ID: NXYKVQKD15

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

                      Sorry gothon, removed the "fun" parts in the floor texture. Now rotation problem gone !.
                      wolfy-ceiling2 ID: NXA57ZQD15

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

                        This really is becoming jaw dropping.
                        I've said it before but I'll say it again - thanks Fuze. What a brilliant piece of software for would-be programmers.

                        1 Reply Last reply Reply Quote 3
                        • Dave
                          Dave Fuze Team last edited by

                          @faz808 So glad you're having fun with it! Thank you for being a part of the community!

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

                            Very neat. I'm hoping that we get support for textured polygons at some point to help with making things like this so we don't have to use as much processing.

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

                              New texture added. wolfy-ceiling3 ID: XDXS2MND15

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