How do you change FOV? You just change the scale of the pixels! If you want to implement certain FOV's into your 3D engine, here is the formula for projection: 240/tan(FOV/2) Why does this work in providing different FOV's? The formula finds out what would be the edge of our vision and then makes that half the width of the Scratch window, 240 pixels. This leads to the table: FOV: 10º, Multiplier: 2,743.21 FOV: 15º, Multiplier: 1,822.98 FOV: 20º, Multiplier: 1,361.11 FOV: 30º, Multiplier: 895.69 FOV: 40º, Multiplier: 659.39 FOV: 60º, Multiplier: 415.69 FOV: 80º, Multiplier: 286.02 FOV: 100º, Multiplier: 201.38 FOV: 120º, Multiplier: 138.56 FOV: 140º, Multiplier: 87.35 FOV: 160º, Multiplier: 42.32 FOV: 170º, Multiplier: 21.00 FOV: 180º, Multiplier: 0.00 In the @MathMathMath tutorials, this multiplier was 100, leading to a FOV of 135º. (No instructions)
Credits: @MathMathMath for his rotation scripts @Ayarkay for the quadrilateral filler (repurposed as a triangle fill) @chiru3 for everything else Notes: After the failure of the first filled 3D engine, I have decided to make another one, this time with different workings. This is part 7, which is the full engine except there is no shading. How it works: 1) It finds the distances to each triangle in the scene and sorts them by distance (Painter's algorithm) 2) For each triangle: 2a) It initializes the triangle in 3D space. 2b) The triangle is moved such that the player is at the origin. 2c) The triangle is rotated such that the player's view is directly into the Z axis. 2d) The triangle is clipped so only visible parts are drawn. 2e) The resulting shape is projected onto the XY plane. 2f) The triangle is drawn to the screen. Notes: The previous one was around 1000 blocks (and didn't work), but this one is around 700 blocks so far (and works).