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

Publicado em: 30 Março 2021
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line NCurses 3D Render Engine Tutorial: pt 13 (Lighting and Depth testing!) duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário KayOS Code 30 Março 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 3,017 vezes e gostou 65 espectadores. Boa visualização!