How I Made a Raytracer in Python

Поделиться
HTML-код
  • Опубликовано: 10 окт 2024
  • code: github.com/Gpo...
    The best video I've made in 6 months.
    Advanced programming projects (affiliated): app.codecrafte...
    My microphone (affiliated): tinyurl.com/2h...
    RUclips growth tool (affiliated): vidiq.com/l4fp...

Комментарии • 23

  • @gustavoalberto8660
    @gustavoalberto8660 Год назад +7

    Amazing! This project has everything to become something bigger, like a simulator or something like that

  • @ThankYouESM
    @ThankYouESM Месяц назад

    I love this and years ago planned to create a Pythonic Wave Function Collapse solution from a single gigantic RGBA image which the alpha channel very much minimizes the size also from flipping and rotations for placing the 32x32px chunks copied from. To most likely shrink the size even further... could also double layer those RGBA images, but... will need to train the data to make that main image hopefully smaller than 500mb. 32x32px chunks pre-calculated to fill the screen as being fully raytraced should be fast enough to develop AAA games in Python with just the built-in imports.

  • @ctbdjc
    @ctbdjc Месяц назад +3

    i'm surprised most of the 6 months wasn't spent rendering

  • @artiartem
    @artiartem 8 месяцев назад +2

    Cool video, but I saw that your reflections are a little strange. I can suggest you change a couple of lines of code in the main.py file.
    Line 55: reflection_ray = Ray(intersect + ray.direction.reflect(normal)*shadow_bias, ray.direction.reflect(normal))
    Line 63: reflection_ray = Ray(intersect + reflection_ray.direction.reflect(normal)*shadow_bias, reflection_ray.direction.reflect(normal))
    The result will be much better!

    • @Gpopcorn
      @Gpopcorn  8 месяцев назад +1

      This ended up working, thanks!

  • @ItsThies
    @ItsThies 2 месяца назад

    for optimization you can implement that pygame doesn't update the image each pixel but each row or only after the full picture is rendered!

  • @SCPokSecondaccound
    @SCPokSecondaccound Год назад +7

    I fixed your reflection formula I think...
    def reflect(self, normal: Vector) -> Vector:
    dot_product = self.dot(normal)
    reflected_vector = self - normal * (dot_product * 2)
    return reflected_vector

  • @DaDogeDev
    @DaDogeDev 5 месяцев назад +1

    AMAZING WALLPAPER STAHP DRIP/10 and also the project is cool ig

  • @guiguifishy
    @guiguifishy Год назад +1

    Hi I’m so confused it’s been six month I was on a side project (a raytracer in python) and I only see your video now. Btw would you know a way to make the code faster and still run on the cpu (a bit like back face culling)

  • @kaihenthe
    @kaihenthe 4 дня назад

    pre-1.45K sub gaming

  • @hattyot4018
    @hattyot4018 Год назад +1

    Loved the video

  • @stephwliu
    @stephwliu 10 месяцев назад

    Great video, so funny

  • @dijik123
    @dijik123 Год назад

    Amazing

  • @tingexd5268
    @tingexd5268 Год назад +1

    New vid 👀

  • @dreamyangel1858
    @dreamyangel1858 Год назад

    have you heard of mojo for python ? Maybe your project could go on one day

  • @ljubisaknezevic9040
    @ljubisaknezevic9040 Год назад +3

    Puberty finally hit?

    • @inxendere
      @inxendere Год назад

      This dude is going places. He's probably like 14 or 15 and he's making a python ray tracer.

    • @fhudufin
      @fhudufin Год назад +3

      @@inxendere raytracers arent rocket science bro

  • @ljubisaknezevic9040
    @ljubisaknezevic9040 10 месяцев назад

    rip channel

    • @Gpopcorn
      @Gpopcorn  10 месяцев назад

      not yet…

  • @Benjamin_Stroup
    @Benjamin_Stroup 3 месяца назад +1

    Why do people make it so hard to learn? I'm trying to learn how to create a ray tracer. You go way too fast and you don't cover everything you need to cover. Someone, please give me a link to a good video that goes over how to ray trace. Thank you

    • @Maxwell_Nexten
      @Maxwell_Nexten 3 месяца назад +2

      The reason he didn't cover everything is that this is not a tutorial; it's more like a showcase.

    • @TacticalAllRounder
      @TacticalAllRounder 2 месяца назад

      Just look at the src code. It's crystal clear.