RayTracing Requirements


To create a environment for raytracing:

  • floating-point variables, used in position of player, distance calculation and mathematics equations.
  • sin/cos functions, to determine the angles and fov
  • vertical scanlines is the best option as you write segments in columns.


    • each column will have a ceiling, center and floor. ceiling is governed by the distance from the player. floor is the inverse of the ceiling. 

choosing floating-point type. Modern systems use at least a 32bit float, however systems like HLSL do still use half-precision floats a.k.a. 16bit floats. each constists of a [SIGN 1bit][EXPONENT 5/8bit][FRACTION 10/23bit]. To use on a GameBoy a custom type / struct has to be defined or a UINT32/UINT16 has to be specified in a way that it can be used. Defining a Macro can ease the use of matching method to fill the struct by splitting (for ex.) the sign bit if a signed field is used to check if a value is lower than zero or check if the last bit is set.

(int)val < 0 || val >> 16  == 0x01   

to create a 32bit float:

  • define struct:
    • int sign : 1; int exponent : 8; int fraction : 32;
  • define methods:
    • ADD
    • SUBtract
    • CMPare
    • MULtiply
    • DIVide
  • additional methods:
    • floatToInt() ret UINT32 (default floor)
  • setFloat32(UINT32/CUST_STRUCT ref, UINT32 significant, UINT32 base)
    • ref = existing global/variable
    • significant = number without decimal
    • base = decimal point position
  • setFloat32(UINT32/CUST_STRUCT ref, UINT16 value, UINT16 precision)
    • ref = existing global/variable
    • value = numbers before decimal point
    • precision = numbers after decimal point

Files

gammu.gb 32 kB
Sep 28, 2021
gammu-master-0.1.zip 9.8 kB
Sep 28, 2021

Get [GameBoy] Technical Demo - Vertical Scanlines/RayCasting

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.