Now that I have a terrain generator, I can start refining the rendering systems. Day 15 Even though the terrain generator was working, it was hard to see since the tops and sides of the blocks were the same bright green color. To make the shape of the terrain easier to see, and to make … Read more Creating Minecraft in One Week with C++ and Vulkan Week 3
I took a crack at recreating Minecraft in one week using a custom C++ engine and Vulkan. I was inspired by Hopson, who did the same using C++ and OpenGL. Hopson was, in turn, inspired by Shane Beck, who was inspired by Minecraft, which was inspired by Infiniminer, which was presumably inspired by real world mining.
In this post, I will describe a shader for Unity3D that recreates the look of a reflex sight. A reflex sight projects the image of it’s crosshair to some distance in front of the viewer. Red dot sights holographic sights are both types of reflex sights, they only differ in the crosshair used for aiming.
The distance of the crosshair may be finite, such as 100 meters, or it may be infinite. When you move your head side to side, the crosshair will appear to be in the distance. It does not look like a red dot painted on the glass. This video is an example of the effect in real life.
There are multiple ways to achieve this effect. One method is to use a separate object for the crosshair and use stencil masking so that it only draws it behind the lens. However I don’t like the idea of using two objects or using the stencil buffer for a minor effect.
My solution was to use a single object (the lens) and a shader effect to change the UVs of a crosshair texture. This is much simpler to implement. The resulting shader acts like a reflex sight focused to infinity.
I’ve been playing some roguelikes recently, so I wanted to try writing my own procedural dungeon generator. There are a lot of different ways to approach this problem, but I eventually decided to base mine off of TinyKeep’s algorithm, described here. I extended the algorithm to work in 3D, to create dungeons with multiple floors.
The code for this example available in this Github repo. I’m using Unity3D for this demonstration, but these concepts are, of course, usable in any game engine.
This is the first in a series of blog posts about how I wrote and optimized VkColors, a small compute program written using Vulkan. During the summer between university semesters, I found a post on the Code Golf Stack Exchange. The challenge was to generate an image with all possible RGB colors, arranged however the … Read more Optimizing a Vulkan Program Part 1: Introduction