Category Archives: Graphics Assignment

Assignment complete (so far)



So I managed to complete a scene graph, create a geometry shader and pixel shader with animations.

Most of the assignment was taken up with fixing errors and things not working.

I managed to get the tree loading in but not into the real project.

There isn’t any terrain generation yet or lights. These are still to come.

For the lava I used 2 textures, 1 is the black rocks on top and under that there’s 2 of the same texture that both move in opposite directions on the Y axis and at the same time along the X axis. A time variable to move the UV along the X axis for the top lava.

At the same time I used 3 sine waves over time to morph the lava geometry to make it appear like waves.

For the GLOW I made a screen texture and researched an easy-to-use glow
filter. The geometry shader was a simple flat quad and the pixel shader used a formula to determine the brightness of the pixels around it and made it glow. For performance, the glow only applies to every 4th pixel:




I got a tree to import

That’s right, children. Witness my tree with normal maps and specular!

2013-04-05 15_50_17-AIE OpenGL Window


2013-04-05 16_15_10-AIE OpenGL Window


Next step: generated ground.


I changed my mind, so now I’ll be doing the “midpoint displacement” method (maybe “Diamond-square algorithm” because Wikipedia says it’s better).

The Idea I have is to combine the perlin noise function with the diamond method to make a hill and then add the Volcano in the middle of this. Maybe add water over the middle part.

Here’s a diagram:

diagram volcano


So if you imagine the land bumps up over the water surface, and the lava is just above the water. Hopefully, the volcano height and lava hEight will be right enough that it doesn’t stick out of the edges of the volcano.

This changes my original idea of the volcano going in under the height of the lava. Now the lava will just need to be above the water a bit and be only the radius of the volcano.

Time To You Em El. (UML)

To plan for the scene I’ll need to come up with a list of objects that will be needed and then put them into a class diagram.

  • Scene
  • Terrain (including volcano)
  • Lava mesh
  • Smoke particle
  • Lava bubble
  • Soot particle
  • Sky clouds
  • Tree
  • Light
  • Camera
  • Action (not really)

That’s basically it. Now let’s figure out how these relate to each other:


So basically the whole scene will be held in “Scene” and then the scene will be made up of a bunch of scene nodes parented to the root scene node. The UML shows how they all derive from each other

I think from here I can start coding. Which I’ll talk about in the next post.

I done some photos

For my assignment, I’m doing a cloudy scene.

It turns out today is a cloudy day.

I took photos for reference.

photo 3 photo 1 photo 2The tree and the cars are good examples.

Basically the shadows are like “projector shadows” (just under the thing) and get darker the closer they are to contact (see in the car example).

This is probably similar to “skylight” effects. Basically what the blue colour of the sky does to shadows of things. Then there’s the light from the sun that casts the main solid shadow.

The thing is, though, you don’t really see the skylight make these sorts of shadows. I think it’s because the sun light almost over-writes this because it’s so bright. But maybe more realistic lighting might take this into consideration. Secondary lighting also (like sunlight bouncing off objects) probably add to this.

Silly sun. You so bright.

So yeah, this means that despite me wanting to actually do shadow maps, I might not be able to because they’d look out of place. Maybe I could get extra marks for a sexy inclusion shadow shader or something. HMMMMMM?


Probably should start my assignment

Ignore this intro

Hello blog. Hi Jimmy, said the blog. Wait…

Because I really hate reading boring articles and get distracted easily, I’m going to try and make all my posts as interesting as possible, and coenside this with the comments in my code.

I know a guy called Coen actually.

Organising the assignment

The first thing that needs to happen is getting a Visual Studio solution set up to run this game. This is probably the most fun part because it;s easy and you can’t cause bugs that take hours to complete.

Wrong. I have to do planning first.

  1. Come up with game idea
  2. Do planning and UMLs
  3. Prepare solution
  4. Write main code and get engine running without errors
  5. Create classes for objects and nodes etc.
  6. Create terrain using classes and generation
  7. Add lava and lava effects
  8. Add textures
  9. Add particles
  10. Add fine details like fog, extra shadows
  11. Tweaking things so they look special (the good kind)

My understanding of this ass iron mint

Basically make a demo scene with a camera that I can control to show it the F off.

It has to have:

  • A light
  • A camera
  • An FBX model
  • A shadow
  • Generated terrain
  • Particles
  • Basic scene graph
  • Everything textured and lit with lights properly

What I do

I’m planning on making a volcano scene. I was and still am inspired by the volcano level (Eridium Blight) in Borderlands 2. Here’s some pictures:



I sat there in Borderlands 2 for probably 30 minutes looking at the detail that went into this lava and I noticed the following:

  • The lava has a layer underneith that has a water/blur effect on it
  • There’s soot floating through the air that lands on your face (like snowflakes)
  • There’s smoke coming out of the lava
  • There’s heat waves
  • The lava texture flows in one direction rather than just sits there
  • The lava has a glow effect on it
  • There’s hot looking particles bubbling out of the lava
  • The lava mesh is slightly wavey and not just static

This is a lot better than the deadful lava in Starcraft II:

shit lava

OH GOD IT BURNS MY EYES. Not in a lava burn way, but a “I can’t stand to even look at it” way. It’s low resolution, doesn’t animate, and looks flat. It doesn’t even appear like it’s bright. It looks more like a Persian rug is coming up to destroy all my units and buildings.

My scene won’t actually have an erupting volcano, but I do want some particles coming out of it like black smoke, soot and bubbles of lava. Also snow-like soot like on Borderlands.

I now have the lava down pat. The next thing is the scene generation.

I plan on having a hight map generation using perlin noise, over the top of another map that contains the volcano’s “norm” shape. Something similar to the following:

rings of deth

Combined would look something like this:


Then, I’d add a plane of lava just around the lowest Y area and make sure the 2 hight maps together don’t go too low. You will notice that the centre of the volcano ring overlay is darker than the outside. This is the key to having the lava only in the volcano. It might even have a few rocks pointing out of the lava, which would be okay.


I don’t plan on generating the volcano ring (at this state, although it’d be possible because I just made it with an oval gradiant in Fireworks) but If I just use the image I could play around with the shape of the volcano, maybe give it some natural looking veins or something.

Lights and stuff

The light source will be a skylight coming from the sky, and an orange one coming from the volcano. This will ensure the inside of the volcano’s walls are lit up by the lava. There will also be a general diffuse colour around the rocks.

Because I want to do shadow maps, I’ll be adding in blurred shadows. This is because The scene is going to be cloudy.

FBX models

I’ve combed for trees. I thought that I could randomly place a set number of dead trees around the map (avoiding the volcano) using circle maths for distance. These should be textured, lit and cast shadows. Naturally.

Advanced features

For my advanced bit, I’m adding in advanced shadows because shadows are kick-ass like unicorns. So the light source is going to be a sun. Again, the scene is dark and cloudy, so I want to try and blur the shadows a bit to appear like ones in a cloudy-ish sky.

Other notes

The camera will just be a normal one much like the AIE Framework camera. WASD will move it, and the mouse will aim it. Nothing too fancy.

The scene will be set up using a scene graph. This will be represented by simply having all the trees as children to the landscape. It won’t be dramatically noticable but it will be made like that.

I’ll add a transparent, cloudy plane as the sky. If I have time (and can figure it out), I’ll add a skybox.

There will be a sort of fog in the game. This will make the landscape nicer and hopefully cut off the edges of the map so you can’t see the box where the hills are. The only issue with the fog would be the lighter parts of the map should shine through more than the darker ones. This will be a challenge. For example, looking at the sun through fog.