Skip to content

UPENN Class CIS5600 for MSE: Computer Graphics and Game Tech. This course covers the technical aspects of 3D Modeling including viewing transformations, polygon and mesh data structures, keyframe animation, and interactive manipulation. You will write a series program assignments in C++ that build up to a 3D game final project.

Notifications You must be signed in to change notification settings

jvrieger/Mini-Minecraft-Group-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CIS 4600 Final Project - Mini Minecraft Milestone 3

Task Division

The project team implemented three core features:

  • Additional Biome, Procedurally Placed Assets, Post-process Camera Overlay: Julia Rieger
  • Day and night cycle, Water Waves(with Normal deformation): Paprika Chen
  • Shadow Mapping, Distance Fog, Greyscale image file as height map: Cecilia Chen

Feature Descriptions

Shadow Mapping (Cecilia Chen)

Implementation Details

Create another framebuffer and texture to store the generated depth map. Use the depth matrix derived from a dynamic orthographic projection, along with the light direction and lookAt center, to create real-time shadows.

Challenges

  1. Unresolved Issues with Shadows at Night During nighttime, the shadows appear to shift and have weird gaps. Additionally, the shadows are not very smooth at all times.

  2. Dynamic Shadow Map Instead of using a static mesh and fixed world center, our generated world consists of dynamically generated terrain with a large range.

    Solution: Adjust the orthographic projection box and the focus of the lookAt center.

Distance Fog (Cecilia Chen)

Implementation Details

Pass the position of the camera to the shader, and calculate the distance to determine the fog factor. Mix the fog color and the diffuse color based on the fog factor.

Greyscale image file as height map (Cecilia Chen)

Implementation Details

Using QFileDialog and QImage to import the greyscale image file. Based on the color value of each pixel in the image, update the chunk around the palyer's position. Regenerate VBO data for those modified chunks.

CIS 4600 Final Project - Mini Minecraft Milestone 2

Task Division

The project team implemented three core features:

  • Cave Systems: Julia Rieger
  • Texturing and Texture Animation: Paprika Chen
  • Multithreaded Terrain Generation: Cecilia Chen

Feature Descriptions

Texturing and Texture Animation (Paprika Chen)

Implementation Details

Feature: Separate rendering for opaque and transparent blocks

Method: Used two VBOs and two index buffers to render opaque blocks first, followed by transparent blocks for correct blending.

Feature: Animated UVs for LAVA and WATER blocks

Method: Calculated UVs based on block type and texture atlas; applied a time-based offset in the shader for animation.

Feature: Face culling optimization

Method: Added only visible faces to VBOs by checking neighboring block types for transparency or emptiness.

Feature: Transparency and blending

Method: Enabled OpenGL blending with GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA for proper handling of transparency.

Challenges

  1. Texture Gap between blocks
    Encountered visible gaps between block textures due to mipmapping and filtering issues.

    Solution: Switched texture filtering from GL_LINEAR_MIPMAP_LINEAR to GL_NEAREST to ensure precise texture alignment and eliminate gaps.

  2. Unsolving Problem: Water walls

    There are water walls between chunks when looking at several angles, but will disappear if changing viewing angles or diving into water. It is not because of the rendering orders between OPAQUE and TRANSPARENT buffer.

Cave Generation (Julia Rieger)

Implementation Details

This feature creates cave systems under our terrain using 3D Noise functions. It also sets up a post process pipeline to add screen tinting when underwater/underlava, and edits the physics of water/lava traversal.

I started with making some finetuning updates to the top terrain, modifying my 2D noise functions so the biome interpolation was much smoother and the terrain itself looked more realistically "minecraft," to do this I referenced noise function research from https://rtouti.github.io/graphics/perlin-noise-algorithm. I used this working 2D noise, and modified it to work as 3D noise (sampling 8 surflets instead of 4, and using trilinear interpolation). This gerenated nice, smooth, and snaking cave systems. To identify cave systems in our terrain, look under water that pokes through the grassland biome. I conveniently marked the cave entrances with this surface water for ease of identification. Caves lie from y = 26-140, lava lies from y = 1-25, and a layer of bedrock lies at y = 0.

Challenges

  1. Modifying 2D noise to be 3D noise
    When first testing the cave systems, I had sharp segmentations per each chunk. This is because I used a 2D noise function that didn't interpolate smoothly, so modeling my 3D noise function after a smoother 2D noise function solved this challenge.

  2. Post process issues, shader bugs
    I struggled with implementing a frame buffer and post process shader in mygl, and had to do a lot of research on how to implement a post process pipeline to correctly implement this. I also had to collaborate with my teammembers to understand the player physics/uniform variables for this portion of the project.

Multithreaded Terrain Generation (Cecilia Chen)

Implementation Details

This feature implements multithreaded terrain generation by calling std::thread and use mutex to avoid conflicts within the shared memories.

I rewrote the checkExpansion method to make new chunks generation and new VBO generation more efficient by using Multithreaded technique. It checks the terrain offset between the prevPosition and the currentPosition, and do generations only for the new chunks and unload chunks out of range. I also create a

Challenges

  1. Water Wall in between Terrains

    Encountered water walls in between different Terrains (4*4 chunks). This is caused by the incorrect link of neighbors and the old VBO data from the previous tick. I rewrote the setNeighbors functions and call it everytime before generating new VBO data. Also, in order to solve the terrain wall, I regenerate VBO data for chunks in boundaries.

  2. Random Crashing and Missing Chunks

    The program randomly crashed at first and I hardly figured it out. It turns out that it was segmentation caused by setNeighbors. I rewrote the setNeighbors functions and ensure there is a chunk at the position before linking its neighbors.

Compile and Run Instructions

If you can't run the project successfully, try to do Build -> Clean, and then Build -> Rebuild Project. The post process functions are implemented using Mac software, if you have compatability issues please edit the m_frameBuffer.resize(width() * devicePixelRatio(), height() * devicePixelRatio(), 1.f) to be m_frameBuffer.resize(width(), height(), devicePixelRatio()). If this fix doesn't work, please comment out m_frameBuffer.bindFrameBuffer() and renderPostProcess(). Sorry for the trouble!

CIS 4600 Final Project - Mini Minecraft Milestone 1

Task Division

The project team implemented three core features:

  • Procedural Terrain: Julia Rieger
  • Efficient Terrain Rendering and Chunking: Cecilia Chen
  • Game Engine Tick Function and Player Physics: Paprika Chen

Feature Descriptions

Game Engine Tick Function and Player Physics (Paprika Chen)

Implementation Details

This feature manages the game's main update loop and handles the player's physics and movement, including collision detection and environment interaction.

To implement player physics, I integrated a tick function that updates player velocity and position each frame, accounting for gravity and friction. Collision detection was achieved by casting rays in each axies (xyz) from the corners of the player’s block collision volume to detect terrain and prevent overlap, which allows smoother wall sliding. But instead of using the corners of the player's 2x1 collision volume, I used the corners of the bottom block of the player's collision volume, so that the bottom face of that cube can represent the bottom block, while the upper face of that cube can represent the upper block. In this way, I simplified the collision detection algorithm.

Challenges

  1. Block Modification Visualization
    When blocks were deleted or added, the physics correctly updated, but the visual display remained unchanged. This issue was resolved by updating the VBO data after any block modification to ensure the display reflected the current state.

  2. Grid Marching for Collision Detection
    When determining the maximum walkable distance along an axis, the initial implementation calculated distances slightly too large, causing the player to get stuck in collision volumes. The issue stemmed from an extra step in grid marching; stopping just before this step fixed the problem, preventing overlap with collision boundaries.

Procedural Terrain (Julia Rieger)

Implementation Details

This feature manages the game's "random" terrain, including landmark features such as mountains, waterways, plains, and cliffs.

To implement the terrain, I first called the function generateChunkBiome(*cPtr) in the instantiateChunkAt() function, which gets called for each chunk rendered. This loops through every x z value in the chunk to calculate its interpolated height based on a smoothstepped perlin noise function to determine interpolation between grasslands and mountains. It then iterates through every y value up to that chosen height and determines the correct block type for that specific x y z block. The grassland's height is determined by computing an fbm offset added to a perlinNoise function divided by a large number, over 2 octaves, in the range ~138-199. The mountain's height is determined by generating fractal noise by layering perlinNoise with decreasing amp and increasing freq over 6 octaves, for the range of ~200-255.

Challenges

  1. Smooth interpolation between biomes
    When first testing the biome spread over around 20 chunks, I struggled with a smooth interpolation between the two biomes. This was fixed with dividing the noise samples by a large number, and tweaking various parameters to achieve a more gradual transition between grassland, mountain, and water regions.

  2. Smooth noise effects over chunks
    This is a challenge I am still struggling with, and will likely perfect over the course of the project. I have attempted to tweak parameters so that the block heights between chunks interpolate more smoothly and gradually, to avoid steep falloffs. I mostly struggle with this in the grassland biome, because the stark dropoffs are much more obvious than in the mountainous regions.

Efficient Terrain Rendering and Chunking (Cecilia Chen)

Implementation Details

This feature improves the efficiency of rendering terrain in the game, by only creating VBO data for block faces and rendering 3*3 terrain area around the player.

To implement the rendering technique, I made Chunk inherit from Drawable and wrote its createVBO function. To only render the faces that lie on the boundary between an EMPTY block and a filled block, the algorithm goes over each blocks in a chunk and detect its 6 neighbor blocks to check which faces to render. To implement new chunk generation, I created a function in terrain.cpp, which takes a vec2 player position as parameter. By calling hasChunkAt relative to the vec2, the function detects where need to create new chunks. Then in mygl.cpp, the player positon is also used to calculate the range where terrains need to be render.

Challenges

  1. VBO data generation
    Initially, when I testing with the test cases, I failed to render any faces and spend a lot time to figure out that it is the binding problem with the shader. And after I move to testing the larger scene, I encountered a problem that some faces of chunk disappeared. This was fixed by rechecking the boundary cases of creating faces data.

  2. Chunk edge detection and expansion
    At first, some new chunks are failed to generate when the player moving towards the -x direction. This was resolved after I rewrite the chunk expansion function.

Compile and Run Instructions

If you can't run the project successfully, try to do Build -> Clean, and then Build -> Rebuild Project.

About

UPENN Class CIS5600 for MSE: Computer Graphics and Game Tech. This course covers the technical aspects of 3D Modeling including viewing transformations, polygon and mesh data structures, keyframe animation, and interactive manipulation. You will write a series program assignments in C++ that build up to a 3D game final project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published