Rendering Multiple Objects // Ray Tracing series

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

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

  • @TheCherno
    @TheCherno  2 года назад +12

    Thank you all for watching! Got another episode coming next week 🎉 Check out Brilliant to learn all the math you need and support the series - visit brilliant.org/TheCherno to get started learning STEM for free (first 200 people will get 20% off their annual premium subscription)

    • @oamioxmocliox8082
      @oamioxmocliox8082 2 года назад +1

      ;)

    • @CodeParticles
      @CodeParticles 2 года назад +1

      @The Cherno, Absolute genius! I learned more about imgui tricks than multiple renderings, which is perfectly a good thing I love using ImGUI!! 👍👍

  • @maxkofler7831
    @maxkofler7831 2 года назад +62

    That Thunbnail though really caught me

    • @jarreed0
      @jarreed0 2 года назад +3

      It's from the "Ray tracing in one weekend" book

    • @maxkofler7831
      @maxkofler7831 2 года назад +5

      @@jarreed0 It isn't for the image itself, more for the face in the sphere🙃

  • @ezrakornfeld8436
    @ezrakornfeld8436 2 года назад +4

    Best thumbnail I’ve ever seen

  • @volodymyrkuksa1786
    @volodymyrkuksa1786 2 года назад +20

    15:55 - you should be able to use designated initializers (since C++20) in the initializer list to do this cleanly

  • @Jurasebastian
    @Jurasebastian 2 года назад +6

    moving camera has another benefit: you changes only one value instead multiple in for example case where you have triangle mesh

  • @mohamadbakr6474
    @mohamadbakr6474 2 года назад +3

    hope to see more of this type of videos thank you very much

  • @abdel4455
    @abdel4455 2 года назад +2

    My first thought for handling the naming for position was to convert the index to a string and concatenate it with "Position"

  • @kartoffellicht863
    @kartoffellicht863 2 года назад +5

    Im hyped for the triangle-ray intersection test

    • @kartoffellicht863
      @kartoffellicht863 2 года назад +2

      @@panjak323 sorry, im too stupid to learn it from paper. thats why I´m actually watching this series

    • @michaellundgren6949
      @michaellundgren6949 2 года назад +1

      Its just a ray and plane test, then you check if the intersection point of the plane is within the triangle

  • @oguzhantopaloglu9442
    @oguzhantopaloglu9442 2 года назад +3

    This series is amazing!

  • @pequod4557
    @pequod4557 2 года назад +1

    That thumbnail got me quite watching better caul saul even though I'm a hardcore better call sauler and breaking bader.

  • @Lameless
    @Lameless 2 года назад

    The hazel engine is good to work with, Thank you for making it.

  • @sasharzaev7647
    @sasharzaev7647 2 года назад +3

    Hey! Love your videos, they are so motivating and exciting, you're one of the best people I've ever known. Can you please suggest what is the best library to start from for creating program to visualize frame three-dimensional model of the body, display it on the stage with and without perspective, scale and rotate? Maybe there are some books that you would recommend, thanks so much in advance

  • @thedebapriyakar
    @thedebapriyakar 2 года назад +1

    this is definitely one of the thumbnails of all time

  • @abc123evoturbobonker
    @abc123evoturbobonker 4 месяца назад

    That car alarm, reee, had me trying to check outside.. n I cant really walk rn :D

  • @anon_y_mousse
    @anon_y_mousse 2 года назад +1

    If you really want to take your time with it, get a chunk of clay and mold it into a sphere. Then set it on some graph paper and use some analog hand calipers and measure all of the visible points on it. Then plot those in a file and write a for loop to draw each pixel to the screen. Done. 😂

  • @gwch3481
    @gwch3481 2 года назад

    finally he's here

  • @zxuiji
    @zxuiji 2 года назад +1

    3:10, there's a simpler way to see if it hits the object, any xy point of a hypotenuse can be normalised between 0 to 1, everyone follows that fine right? The same normalised point can be calculated with 3 lines of math on an integer angle, modulo being part of that math, once the relative xy integers are calculated just normalise them then multiply against the height & width for the actual points relative to the dimensions of the triangle, similar can be done with curves however an extra 2 lines are needed at minimum since you need to modulo the integer axis values by 3 to get the relative numbers to add to the original axis value, I'll show an example when I finish getting my trial library to a state where I can translate the math I worked out on paper to glsl.
    **Edit:** Realized I forgot to mention how this applies to object hitting, you multiply the normalised values on the object dimensions to get the hit box edge hit, then you just check if the outer hit diameter falls outside half the positions calculated for simple check, for nit picky check against the vertices you just need to check their positions are all greater or equal to the halfway point, if the halfway point falls inside the inner hit diameter then the nitpick check is not needed since it's guaranteed to be a hit

    • @zxuiji
      @zxuiji 2 года назад +1

      I just realised there's an even simpler way to do the nit pik part, all it requires is 2 vertice "textures", 1 for where vertices of the the object fall in the z axis, the other is a lookup table for the furthest out vertice falling in that space, every thing from there is just using the nearby indices to spread the hit on the display side of things, if NaN is stored in a "pixel" of the 1st texture then no vertice happens to fall into said "pixel", and just get's ignored, as for the dimensions of said "textures" the maximum should be relative to the smallest vertice position value used, so for example if you have just 1 vertice defined as 0.1, 0.2, 0.3 etc then you'll need at most 11 "pixels", if it's 0.01, 0.02, 0.03 etc then 100 "pixels", the point is to have at most what the largest value would be if you ignored the dot plus 2 extra for 0 & 1
      **Edit:** Correction, 4 "textures" minimum, I only considered from the front, which would only get one half of the vertices that need to check against, the extra 2 are the same but for the back of the model instead, there could be checks for other visible vertices if you create the same kind of "textures" for all 6 faces of the objects box, you just need adapt the checks according to the facing's axis, still faster than square rooting the ray then checking each individual vertice, better to just use lookup "textures" that are ignorant of the surrounding area since it only needs to know the ray's entry & exit points in normalised form

    • @anon_y_mousse
      @anon_y_mousse 2 года назад

      @@zxuiji Neat, but for simplicity's sake I would just use a rectangle around objects I want hit boxes for and make it as tight as possible to the model in question. Super fast even if it is inaccurate, and for most purposes I'd say good enough.

    • @zxuiji
      @zxuiji 2 года назад +1

      @@anon_y_mousse Well if you're doing ray math anyways then might as well let the physics engine lookup the vertice via the "texture" maps anyway it would probably cost at most 1 extra nanosecond instead of the flat box method

    • @anon_y_mousse
      @anon_y_mousse 2 года назад

      @@zxuiji If you have a ray tracing graphics card, if ray tracing is turned on, then sure. Otherwise, it's at least a good idea to know how to do both and have both as options in case the user has crappy hardware or chooses to use less power on say a laptop with limited battery life.

    • @zxuiji
      @zxuiji 2 года назад

      @@anon_y_mousse You don't need a RT enabled gfx card to do RT, the method is just slightly slower due to not having hardware built specifically for it, it's also useful for physics, RT is not solely for light, it just happens to be most prominent in light

  • @neo-mashiro
    @neo-mashiro 2 года назад +1

    I'm wondering how you made the thumbnail of this video? That's really cool! Are there any image tools for spherically distorting a part of the image? Please don't tell me it's rendered by adding your face as a texture on the sphere....

    • @skipfred
      @skipfred 2 года назад

      Photoshop..?

  • @ps5games821
    @ps5games821 2 года назад

    Thank you very much

  • @interrrp_with_three_rs
    @interrrp_with_three_rs 2 года назад

    cool thumbnail bro

  • @Howtheheckarehandleswit
    @Howtheheckarehandleswit 2 года назад

    I think you forgot to add this one to the playlist

  • @ch3dsmaxuser
    @ch3dsmaxuser 9 месяцев назад

    "scene.Spheres.Size() == 0" could be, instead, "scene.Spheres.empty()", or I'm missing something?

  • @xvoidee
    @xvoidee 2 года назад

    I hear that you have new keyboard! Keychron? :)

  • @nextlifeonearth
    @nextlifeonearth 2 года назад

    Why not just write the initialisation of the Sphere like `Sphere sphere{ .Position = { 0.f, 0.f, 0.f }, .Radius = 0.5f, .Albedo = { 1.f, 0.f, 1.f }};` ?
    You get the names, guaranteed the minimum amount of instructions without setting the defaults first etc.

  • @doctorwin64
    @doctorwin64 2 года назад

    Фотка на видео фановая)) Ян, хорошо получилось, юмор в роликах не помешает

  • @gostan2718
    @gostan2718 2 года назад +2

    Is Hazel 3D close source?

    • @stefanwullems
      @stefanwullems 2 года назад +1

      I think its another branch in the normal hazel repo

    • @niceowl
      @niceowl 2 года назад +2

      The actual, more advanced one is only for patreons. There is a public repo with code from the videos though

  • @Milk-yi9hg
    @Milk-yi9hg 2 года назад

    Yay

  • @PM-4564
    @PM-4564 2 года назад

    Does anyone know what VS theme he uses? And font?

  • @DV-ye6xb
    @DV-ye6xb 2 года назад

    Hey cherno should i also learn algebra for mathematics programming

    • @alexmathewelt7923
      @alexmathewelt7923 2 года назад +2

      Linear Algebra and Numerical Mathematics are really helpful. LA is all about Vectors, Matrices and the connection between geometry and algebraic equations. NM shows and proves methods to calculate solutions of equations on a computer

    • @DV-ye6xb
      @DV-ye6xb 2 года назад

      @@alexmathewelt7923 thanks

    • @alexmathewelt7923
      @alexmathewelt7923 2 года назад +1

      @@DV-ye6xb if u into RUclips lectures, "MIT Gilbert Strang Linear Algebra" is a really good source to understand basic concepts of LA

    • @DV-ye6xb
      @DV-ye6xb 2 года назад

      @@alexmathewelt7923 ok thank you so much

  • @PMA_ReginaldBoscoG
    @PMA_ReginaldBoscoG 2 года назад

    Be my guest, if you came here after watching Tom Scott's video about youtubers clapping at the beginning of a vlog.

  • @stuntfax9004
    @stuntfax9004 2 года назад

    First? Anyway ye nice vid btw explaining everything.

  • @snippletrap
    @snippletrap 2 года назад

    You rock Cherno! Also, tone your arms.

  • @KaiserCoaster
    @KaiserCoaster 2 года назад

    I'm not actually here to watch the video, just wanted to say I loved the thumbnail

  • @roxxel8167
    @roxxel8167 2 года назад

    So early...

  • @snipe2k18
    @snipe2k18 2 года назад

    LOL

  • @oamioxmocliox8082
    @oamioxmocliox8082 2 года назад

    ;)

  • @JoVariMB
    @JoVariMB 2 года назад

    and get tNice tutorials soft out.

  • @zxuiji
    @zxuiji 2 года назад

    Frankly I think graphics programming in general should abandon the concept of a scene, all there should be is -1 to 1 of the parent area, that's all the area that need since everything will scale according to the parent scale

    • @victorioussnake
      @victorioussnake 2 года назад +1

      A scene is just a collection of nodes (such as entities) commonly put in a tree structure. I don't know why you are mentioning area about something that is just a collection of things. If I have a collection of objects in a list do you try and find out the "area" of that list? How so? Especially as lists don't have an area.

    • @zxuiji
      @zxuiji 2 года назад

      @@victorioussnake as is an object, your point?

    • @victorioussnake
      @victorioussnake 2 года назад +1

      @@zxuiji you're talking about moving away from scenes because of reasons to do with area when scenes have nothing to do with area

    • @zxuiji
      @zxuiji 2 года назад

      @@victorioussnake scene and objects are both areas filled with stuff, there is no difference

    • @victorioussnake
      @victorioussnake 2 года назад +1

      @@zxuiji no an area is a boundary of space. A list is a collection of items