OpenGL Tutorial 27 - Normal Maps

preview_player
Показать описание
In this tutorial I'll show you what normal maps are and how you can use them to vastly increase the quality of your meshes!

*Source Code*

*Derivation*

*OpenGL Documentation*

*Discord Server*

*Patreon*

*Timestamps*
0:00 Introduction & Theory
1:39 Modifying Texture Class
2:05 Fragment Shader & Results
2:15 Problem with Different Spaces
2:38 TBN Matrix
3:02 TBN Calculation
3:46 Applying the TBN Matrix
4:55 Ending

*References*

#opengl #opengltutorial #computergraphics #cpp #visualstudio #3dgraphics #normalmaps
Рекомендации по теме
Комментарии
Автор

Your channel is growing so fast man, all the best!

shinystick
Автор

-Small mistake! As Charles van Noland pointed out, the bricks look sunken in rather than popping out (honestly didn't see this untill it was pointed out haha). A quick fix to this is to inverse the bitangent by putting a negative sign in front of it ;)-

Ok... I discovered the actual problem... STANDARDIZATION :'( The normal map was inverted on the y axis as for the DirectX way of doing textures, while the OpenGL one is the opposite... So the real solution is to manually flip the textures in an image editing software :/

VictorGordan
Автор

Would you consider covering PBR in a video? I absolutely love your content!! Thank you!

Dxtrity
Автор

How are normal maps applied to the surface with a) averaged vertex normals, and b) face-weighted vertex normals, or on a surface in general? Are the pixels on normal map get added, multiplied to/with the normals of the surface?

MustafaBerkeGureltol
Автор

I have a couple issues with this tutorial:

1. Why are you using a geometry shader if you don't need one? Geometry shaders generally have a lot of overhead on them. So using them for no reason just slows the application down.

2. You should use pre-calculated tangents and bitangents. Actually, you only need the tangent and then you can use a cross product to get the bitangent in the shader.

3. You should calculate the TBN matrix in the vertex shader instead of the geometry shader of the given reasons.

rachit
Автор

i know u moved the light, cam, etc into the nomal but i think thats slower, u see, the shader dimension is different then the cpu code dimension, bcuz they're executed in PARALEL on gpu (basically less instructions, more FPS). also on frag it only runs on the visable fragments so yeah, ima go with TBN * norm_map

AcceleratedVelocity
Автор

How do you do apply a normal map on a sphere?

Gille-mmcr
Автор

Hey Victor, when trying to load the normal texture, program crashes with error “nvoglv64.pdb not loaded”. I copied your texture and fragment shader code and still get the same error 🙁.

diahaidificbs
Автор

Looks like your XY normalmap values (red/green) are backwards, causing your lighting to look like the brick is sunken into the mortar.

CharlesVanNoland
Автор

Pls upload about bullet physics in the next tutorials.

sneper
Автор

pls upload about bullet physics in next tutorials.

sneper
Автор

"The fragment shader runs many times more than the geometry shader, it is preferable to [do it on the geometry shader]"
Dangerous baseless claim. Have you benchmarked it ? I could give a few arguments as to why you should avoid geometry shaders in the first place.

Tangents can and should probably be precomputed in the first place. That's a memory-speed tradeoff that is often taken. Most 3D formats will provide them for you anyway and most model loaders are able to compute them too.

Remainders on normal matrices could have been great also.

So yeah, the video is just as outdated as the tutorial on learnopengl.com is... since it's mot much more than just parroting. Well you're probably learning at the same time that you're doing these tutorials. But what a pity, I believe you can do better than that; if I wanted to follow the learnopengl.com tutorial, I might as well go see the original one because I don't see much added value here.

willyjacquet