Realization Engine

Realization Engine is a 3D graphics engine/demo I have made using modern OpenGL, Java and LWJGL 3.0. I wanted to make something a little more realistic than my previous project, “Tile World 3”.

This page is work in progress, and will be updated when a make progress with this project

Downloads page

Download the latest version of the Realization engine demo from this page: Realization Engine downloads page


I have made a simple terrain using a height map and implemented multitexturing using a blend map. With terrain I refer to the “ground plane” that the player walks on. The terrain is generated by code. It is made of vertices that are placed evenly along the x and z-axis. The y-position of the vertices is determined by parsing the color value of a loaded “height map” image.

An example of a height map used to generate the terrain.

An example of a height map used to generate the terrain.

Very pixel in this height map image becomes a vertex in the terrain. A white pixel results in a vertex with a high y-value, and a black pixel results in a low y-value. To improve performance I have divided up the terrain in smaller chunks of 64×64 vertices, which is rendered separately. This way, only the visible parts of the terrain needs to be rendered.

To texture the terrain I use a method called multitexturing. I have four different ground textures and one “blend map” with determines with of the four textures that should be used in a given position on the terrain. This way multiple textures can be mixed together. This is done entirely in GLSL code on the GPU, which results in great performance.

An example of a blend map used

An example of a blend map used mix different ground textures


The render the sky I use a skybox. It is basically a very large cube that is rendered without any lighting or fog calculations. The cube is positioned with its center exactly where the camera is. Every side of the cube has its own texture. To render this I use a OpenGL cubemap texture, which I use to texture a unit cube. By doing this, the vertex coordinates can also be used as texture coordinates. It is of course important that the textures used have the right projection and that the seems between the textures match each other perfectly.

The six skybox images used.

The six skybox images used.


The water is made using a very large quad made of two triangles. This quad is textured using two different textures and some other effects. For every frame the world is rendered three times. Firstly everything above the water surface is rendered to a reflection texture. Then a refraction texture a rendered with everything below the water surface. Then the scene is rendered to the screen, and lastly the water plane is rendered to the screen using those reflection and refraction textures.

Before the reflection and refraction textures are used, they are distorted using two  DuDv-maps that are “sliding” over the water surface creating a rippling animation. To determine how the two textures should be mixed together I am using a simplified version of the “Fresnel effect”. I mix the textures based on the dot-pruduct between the water surface normal and the to-camera vector. This makes the reflection texture more visible and the refraction texture less visible for points far away, and vice versa.

There are also secular reflections from lights on the water surface. To make this effect look more realistic, I animate the normal of the water surface using two normal maps in a similar way to the DuDv maps mentioned earlier.

Specular reflections on the water surface.

Specular reflections on the water surface.

The DuDv-map used to create the ripeling effect on the reflection and refration textures

The DuDv-map used to create the ripeling effect on the reflection and refration textures

The normal-map used to animate the normal on the water surface to make the specular reflections look realistic.

The normal-map used to animate the normal on the water surface to make the specular reflections look realistic.

Entities, Collision detection and physics

Realization engine uses a concept with “entities”. An entity is an object in the world that has a 3D model and a texture associated with it. To improve performance while rendering, the model and the texture for one kind of entity is loaded, then all entities of that type is rendered. Then the next kind of entity is loaded…

There are different kinds of entities. The grass and the flowers for example is the most basic entity. It is just a textured model in the world. it has no collision box and it cannot move once placed. Trees and rocks have collision boxes around them which allows my physics engine to stop dynamic entities from colliding with them. Dynamic entities can move around in the world. The respond the physics, and have friction and moment of inertia. The player is a dynamic entitity.

Graphical user interface

LWJGL or openGL has no built in functions to render text or GUI objects. Therefore I have made my own systems for that.

To render text I load a texture containing all characters in the ascii-table. Then I use a pert of that texture and apply it to a quad-model. The same model is used for all characters, and which part of the texture to used is determined by GLSL code on the GPU. The font-texture acts as a mask while rendering. The fragment shader just checks the alpha-channel on the texture to determine if the current pixel should be colored or not. Since the texture is linearly interpolated automatically by the GPU, the font looks relatively good even at large sizes.

I have also made buttons. The buttons are an defined square with a position and a size. A text is rendered inside the square. The buttons check if the mouse is inside the square, if they are, the text is rendered slightly bigger in a different color.

There are also functionality to render images in the 2D-plane. The images can be half transparent. They can be positioned anywhere on the screen and also rotated. The images are automatically adjusted to look correct on different screen aspect-ratios.

Start menu.

Start menu.

Settings menu.

Settings menu.

Planned features

  • Multiple lightsourses
  • More objects in the world
  • Sound and music
  • Water
  • Particle systems
  • Maybe some actual gameplay/Things to do other than just walk around end explore

Videos of previous versions

version 10

In this version I have added a menu. I have also added a lot more content to the world, like trees, rocks and more flowers to make it more interesting. There is also a very simple physics engine that controls the behavior of moving entities. This is demonstrated by the (very unrealistic) sliding crates and barrels in the video.

Version 5

The first version that is actually something to show. It consists of a world of grass hills one can walk around on. There is animated grass and a skybox.

Leave a Reply

Your email address will not be published. Required fields are marked *

Warning: Undefined array key "rerror" in /customers/b/a/5/ on line 291

This site uses Akismet to reduce spam. Learn how your comment data is processed.