OpenGL Tutorial 15 - Stencil Buffer & Outlining

preview_player
Показать описание
In this tutorial I'll show you how the Stencil Buffer works in OpenGL, and how to use it in order to outline a model.

*Source Code & Models*

*OpenGL Documentation*

*Discord Server*

*Patreon*

*Timestamps*
0:00 Introduction & Properties
0:36 glStencilMask()
1:36 Two Other Functions
1:59 glStencilFunc()
2:35 glStencilOp()
3:01 Practical Uses
3:11 Theory of Outlining
4:03 Setting up Stencil Buffer
4:35 Applying Outlining Theory
5:25 Outlining Shaders and Shader Program
5:50 Finish Applying Outlining Theory
6:14 Showcase First Method
6:40 Second Method
6:58 Showcase Second Method
7:12 Second Method Fault
7:22 Third Method
7:58 Showcase Third Method & Ending

*References*

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

This is awesome thanks a lot you’re great

diahaidificbs
Автор

or we can use glm::scale(..) with the vertices we have to make it bigger.

osys
Автор

Hi, im a bit late but I hope someone will read this and help me out. I follow the tutorial and it works, but if i have other objects in my scene like a floor, the outline is rendered behind the floor

oskarkassander
Автор

Your tutorial is very clear and easy to understand, is it possible to do OpenGL in android using 3D assests models and also make it as a tutorial ??...

arthyv
Автор

Even though I have no plans to make this framework, I'm loving this video series.
I have a question about the outlines though. Is it possible to apply a 2D grow edge shader pass to the stencil buffer to have a consistant line thickness regardless of model distance? Or I imagine you could take the distance of the vertex from the camera and use that as a scaler for the normal displacement of the stencil model to get consistant thickness.

gemigames
Автор

I always see "outlining" as the example for stencil buffer usage. It's cool, but I was wondering if anyone can suggest other effects that can be done with stencil buffers. thanks for any suggestions.

jeffg
Автор

6:36 That's how Omega Zero looks like on 3D. I hate how Omega Zero doesn't have that in Megaman X DiVE.

Carter-the-GOATed
Автор

Could it be possible to detect hard edges and use the bisector between the normals to solve the second method fault ?

jorgevillarreal
Автор

For some reason that outline is being rendered below the model. Any ideas on how to fix it?

coderflowerdev
Автор

Can you please make an instruction how to implement a mirror using stencil buffer or can you share me any sources that help do this in the easiest way because I find stencil buffer somehow difficult to understand.

PhamAnhKhoa
Автор

Could you do a tutorial on how to import imgui into our projects ??

SAMUSTORM
Автор

So, what if I need more then single one stencil buffer at a time?

dmitrykolesnikovich
Автор

texture works with sword but not crow.. why?

manpotato
Автор

Where did the crow come from (who is the artist?) What is the license? (I checked the repo, I didn't see a special note) Thanks.

PaulEmsley
Автор

i didnt quite understand is the mesh is huge or my camera view is small

noname-nihp
Автор

For anyone who is like me and none of the methods work becasue, maybe you want to show a user imported model. You can make a new fbo, and draw each mesh with it's own unique flat color shader, then load that fbo texture into your post processing on top of the actual render and then apply an edge detector to the outline fbo, if the absolute value of the edge detector's output is above a threshold, you can draw a flat color instead of the render, this results in a mesh independant outline, that doesn't need any special meshes and doesn't have the gaps that the normal offset one has.

U_Geek
Автор

bro please i need help i make 3d game engine using opengl and c# i now i want to implement 3d mesh collision detection what should i do

abdousekhi
Автор

not to be that guy but first thanks to youtube recommendations lol

ArtyIF
Автор

I'm expecting the tutorial of Blender!! haha

clifflin