Heightmaps // Terrain Rendering episode #1

preview_player
Показать описание
This is the first episode of the 'Terrain Rendering' series. In this video we learn how to load and render heightmaps.

Timecodes:
00:00 Intro
00:30 Mesh overview
01:13 Heightmap
01:45 Framework overview
04:37 Create a Terrain class
06:21 Loading the heightmap file
08:36 Architecture
08:55 The TriangleList class
12:58 Vertex shader
13:38 Fragment shader
13:46 The Technique class
14:14 Add the shaders and TriangleList to the Terrain class
15:30 Getting the Y value from the heightmap
16:05 Points to triangles
18:05 Height based color
18:47 World scale
19:57 Conclusion

If you want to get the version of the code that was used for the video checkout the tag TERRAIN1.

Credits:

Feel free to comment below.

Instagram: @ogldev1
Twitter: @ogldev

Enjoy,

Etay Meiri

#opengl #ogldev #opengtutorials
Рекомендации по теме
Комментарии
Автор

Let's goo, been waiting for this 🔥

nicuukk
Автор

You just keep coming out with the hits man. Thanks again!

grengren
Автор

this is a solid introduction and im really grateful that you shared this knowledge, thank you OGLDEV.:))

sporkspork
Автор

Good video, simple, clear, step by step. ❤❤

wangyangshi
Автор

Clone the sources:

If you want to get the same version that was used in the video you can checkout the tag 'TERRAIN1'.

Build on Linux:
cd ogldev/Terrain1 && ./build.sh

Build on Windows:
Open the Visual Studio solution:
Build the project TerrainRendering\Terrain1

Things to try:

1. In this video I describe how to load the heightmap file from a raw file of floating points.
It is also common to store heightmaps in gray scale png/jpeg files. Add support for loading such

2. (Advanced) If you take a closer look at the TriangleList class you will find more stuff that can be shared
between OpenGL and other APIs such as DirectX (both APIs support the same topology types). Refactor the API specific
stuff (create/bind buffer handles, etc) into a derived class while leaving the common functionality of populating
the index/vertex vectors in the base class. This will make it ready for future porting to DirectX.

OGLDEV
Автор

Thank you for your helpful video and lesson, though I was wondering what file format should I use for the the heightmap? Can I use the Soil image loading library for reading the heightmap data? Thank you so much 👍

vkrak
Автор

@OGLDEV, Very advanced my friend! I hope you can also talk about barycentric coordinates for placement of objects and the actual elephant in the room so to speak, generating grids via Tessellation shaders! 👍👍

CodeParticles
Автор

Hi, any tips on how to separate the land and water mesh of the heightmap? I would like to render them completely differently and I am not sure how to split the verts properly between the two.

bogdan_mocanu
Автор

I can't believe I happened upon this. 🙏

oraz.
Автор

Hi, I saw you on reddit :) This is episode one but it seems you aleady have a lot written such as terrain functions etc.Did you build this code base up in earlier tutorials elsewhere? Or should I just make my own version of this.

AlbertRyanstein
Автор

hey, i got the book in the ttutorial but trenk, can I go through this to create some terrain or is it too old for only the book and opengl?

AlbertRyanstein
Автор

Pretty sure Trent was in highschool when he wrote that book.

zoeherriot
Автор

Any idea why I don't get anything to render after introducing Index Buffer and converting to the triangles instead of points? Was working perfectly up until that point. Could this be related to left/right hand coordinate system?

nerijusvilcinskas
Автор

Man, your code looks like you live in 1998 🤣
But your videos are amazing! 👍

PaulMetalhero