Building my own 3D renderer

Discussion in 'Off Topic' started by KierenBoal, Oct 4, 2021.

Thread Status:
Not open for further replies.
  1. KierenBoal

    Joined:
    Jul 22, 2019
    Messages:
    292
    Likes Received:
    1,116
    KierenBoal
    Something y'all are probably not used to - but I figured I'd share it anyway, as this is an 'off topic' journey I've been on this past month!

    Kieren Boal's 3D Engine journey; for fun, of course! (CPU rendered, without the aid of any libraries or anything; pure CPU code rendered 3D!)

    So far, the code is 536 lines long, supports per-vertex colors, diffuse shaders, and .obj rendering.
    Supports backface culling, .obj loading, difuse per-vertex colors, painters algorithm and a few other various things to make it run.

    The things below are in order of milestones I've made going through making this engine.

    Gyazo links for animated GIFs of the things if you wish to watch.

    3D cube:
    upload_2021-10-4_15-17-38.png
    Literally vertex rendering.
    https://gyazo.com/92b834a0fbc86d9d26b2c3c6a0a74fd3

    Obj rendering:
    upload_2021-10-4_15-17-48.png
    No backface culling, draws the WHOLE mesh, regardless of anything, random colors per vertex

    Per-vertex culling: https://prnt.sc/1upkruh
    More obj rendering, but also culls the vertexs that are not directly facing the camera, saves a few (wireframe) polygons being rendered!
    https://gyazo.com/8d9a0a12cfc6eadcb47435101741e920

    Advanced vertex rendered:
    upload_2021-10-4_15-18-4.png
    Per-vertex random color removed, optimized the vertex drawing algorithm
    https://gyazo.com/d94de6881e7f6b42de46d2da2358119d

    HD support:
    upload_2021-10-4_15-18-11.png
    Similar to above, but HD support, for 1080p rendering. ~45fps
    https://gyazo.com/310cfba6c22ca7fa72d3ebcd2df69620


    Full polly (buggy) rendering:
    upload_2021-10-4_15-18-22.png
    Supports full vertex polygon rendering, but these random-*** lines keep appearing. Bug in the polygon filling algorithm.
    https://gyazo.com/1fdc1eeda84dbb2434daff35a2ffae9c

    Per-vertex colors rendering:
    upload_2021-10-4_15-18-28.png
    Same bugs as before, random-*** lines as part of the pollyfill.
    Also notice the buggy backfaces drawing over eachother
    https://gyazo.com/8a696fbb7913fcf5b55f671c7691659d

    Per-vertex colors, with the buggy lines fixed:
    upload_2021-10-4_15-18-45.png
    Buggy polyfil lines fixed; backface culling not yet fixed.
    https://gyazo.com/d775fadf2cedf3d5a2a0e1b4603831c8

    Importing of 'Quad' models:
    upload_2021-10-4_15-28-34.png
    Quads have a 4/3 ratio rather than a 3/3 ratio... so every 2nd tri is missing
    https://gyazo.com/f576c87ad27b0a9e6ec5d8fa88413931
    https://gyazo.com/f65540570a6f0d44d2c5f2145d471cd0

    Fixed 'Quad' models:
    upload_2021-10-4_15-28-21.png
    HD, fully quad model, no issues!
    https://gyazo.com/20d065bfabaf056a0e33ac62c86fc899
    Even spongebob
    https://gyazo.com/14252d7fc92e432cd364ec7a9fb3f285

    Lastly, fully HD, quad models, clipping and painters algorithm to avoid backface draws:
    upload_2021-10-4_15-28-45.png
    https://gyazo.com/8b708c2272444069a4dd2fc3e8b74cc6

    Thus concludes my current adventure into learning 3D stuff - its been a hell of a journey, and full of lots of pain; but has been a great learning experience!

    Cheers.
     
  2. Issel

    Joined:
    Aug 29, 2019
    Messages:
    129
    Likes Received:
    275
    Issel
    Very cool Kieren!
     
    BlockyBeach likes this.
  3. Rainbow_Pug_1000

    Joined:
    Apr 23, 2021
    Messages:
    45
    Likes Received:
    341
    Rainbow_Pug_1000
    Not only is @KierenBoal a great srmod, but he's also a great renderer master :D
    very cool :D
     
    BlockyBeach likes this.
Thread Status:
Not open for further replies.

Minecraft Central Store | Powered by Xenforo | Minecraft Central Rules
The MCC server is in no way affiliated with Mojang, AB. Nor should it be considered a company endorsed by Mojang, AB.