NCurses 3D Render Engine Tutorial: pt 13 (Lighting and Depth testing!)

Veröffentlicht am: 30 März 2021
auf dem Kanal: KayOS Code
3,017
65

In this tutorial, we actually utilize the vertex and fragment shader interfaces we setup in the past couple tutorials. The brightness at a single point is calculated as the dot product between the surface normal and the vector from that position to the light. If both values are normalized, the result is a value between 0 and 1 representing the brightness. Of course, if the vectors are pointing the exact same way, the result is 1, if it's pointing away, the result is 0. Using that brightness value, we interpolate between a set of shades to get the character for that individual pixel!

Depth buffer issues: If you don't calculate the depth of a pixel, pixels that are in front will get overwritten if the triangles are written in the wrong order. To combat this, you interpolate between the three vertices depth values to get the depth value of the pixel (in a very similar way to what we did interpolating between attributes). Using that depth to render the pixel results in the correct pixel rendering operation.

github: https://github.com/youngbrycecode/Ren...

Concepts: passing data from vertex to fragment shader, uniforms, dot product

Chapters:
0:00 Introduction
0:29 Vertex Shader
4:30 Fragment Shader
7:05 Light Setup
7:50 Depth Adjustments
9:30 Update Models


Auf dieser Seite können Sie das Online-Video NCurses 3D Render Engine Tutorial: pt 13 (Lighting and Depth testing!) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer KayOS Code 30 März 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,017 Mal angesehen und es wurde von 65 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!