DungeonMasters

 Computer Graphics C++, OpenGL

December 2023

If you're just here for the demo, scroll to the bottom!

I. Introduction

Two of my peers and I created a procedurally generated dungeon scene. We used the OpenGL real-time pipeline to render it. We were taught this rendering technique in CSCI 1230: Computer Graphics at Brown University, but the rest of the technical features we learned and implemented ourselves. The source code can be found here.

II. Algorithm

User selects a number for the size parameter

A max width and max length for the scene is determined, linearly dependent on size. Size number of rooms are placed within this width and length.

All rooms are logically connected using Prim's algorithm, which finds a minimum spanning tree between the rooms.

The A* algorithm is used to turn these logic connections into ‘physical’ connections by creating hallways between each logically connected room.

Walls are placed by analyzing the location of each tile's neighboring tiles.

III. My contribution

I was responsible for many parts of this project, the most important of which is normal mapping.  Normal mapping simulates the fine surface details of brick walls and stone floors. This technique works in the fragment shader, where based on the pixel position and normal, colors are sampled from a special image whose RGB values represent normals. These colors are then converted to new, altered normals, which are used in the Phong lighting model to find the final pixel color. Because normal mapping works on a per-pixel basis, it’s far more computationally efficient than actually increasing the number of vertices, which makes it particularly suitable for real-time rendering. 


Other features I implemented:

IV. Results

dungeonmasters-demo.mp4

Video demonstration

Low value for size parameter

Moderate value for size parameter

High value for size parameter

Normal mapping toggled off

Normal mapping toggled on