HLSL Shaders A scene to demo various shader effects


For this coursework, no starting point was given. Our task was to create a scene featuring certain effects in HLSL. In addition, importing models was forbidden, only the Utah teapot was allowed to be used. It was interesting to see other people's work, they focused on different areas, making some very interesting scenes. My work was focused on rendering to texture effects and water effects.

HLSL_Terrain

Cube Mapped Sky Box

A cube mapped texture (.dds) is rendered on the inside of a huge cube. The cube moves with the camera, this prevents the edges being reached.

BumpMappedTerrain

Bump Mapped Terrain

A simple bump mapping technique (normal mapping) is used followed by a height map to modify the flat (tessellated plane) model. The height map is also used to interpolate between two textures. This creates an effect of rocky mountains and mossy rocks.

Height map texture here.
Rocky texture here.
Mossy texture here.

particle_Trees

Particle Trees

The particle trees were simple. The trees were created using the same particle system as in the particle fire effects. However, the movement code was removed, and textures changed.

HLSL_Flying_Creature

Flying Creature

The bird was deformed from a teapot using lerp, smoothstep, and rotations to reshape the vertices. The texture is procedurally generated from a modified marble texture effect. It uses a texture as a source of noise for calculating veins of colour. The modifications include: an alteration of the vein effect to make the veins thinner, an alternative colour, and their patterns changed.

HLSL_Texture_Fire

Fire Texture

The fire is procedurally generated and rendered to texture. It is generated by using a texture with a noisy effect as a source of noise. Then, it is deformed using cos and sin to "wobble" it. Next, a single dimensional texture is used as a palette of colours. The colour is taken out of the texture based upon where the current pixel is on the shader, i.e. its distance from the top and edge. However, the appearance of the fire can be changed by adjusting the input parameters:

BurnSpeed - changes the "updraft" of the fire, this makes the texture scroll quicker.
SideFadeSharpess - changes the colour texture lookup parameters, which adjusts the width and shape of the fire, from thin to wide. The colour palette finishes on black, then the discard function is used to remove it from the final render. This gives it's fire shape.
WobbleScale - changes the parameters on the cos and sin functions resulting in the fire gaining more "wobbles" to it.

Finally, the texture is rendered to a screen aligned quad, and then bill-boarded. The smoke above the fire is a particle system (faint white, easier to see on the video). At the time, I was well aware that a particle based fire would take less time and lead to a better looking outcome, however, I had done this in a previous coursework, so I wanted to try a different effect.

HLSL_Land_Vechicle

Land Vehicle

This vehicle was once a teapot. Now, it's a hover teapot with a turret. It has been deformed using lerp, smoothstep and rotations to move the vertices. The metallic effect is done by having high amount of specular and reflections added.
Also, a particle system was used below it to provide a hovering effect (clearer in the video).

HLSL_Land_Creature

Land Creature

This creature started life as two teapots. It was deformed to make a spider like shape. It has parallax bump mapping, a normal map and a height map. The patches of colour are done via shader. Furthermore, notice the top of the teapot, on the creature's larger half, has been removed using the discard function.

HLSL_Jet_Jetting_Particle_Fire

Jet with Jetting Fire

The fighter jet started off as a teapot, which was deformed using lerp and smoothsteps. The shiny effect is a reflection, specular, and a texture all combined into one effect. It has a particle based fire effect jetting out of it. In addition, the teapot's spout has been removed using the discard function, then the missile has been ensconced in the resulting opening.

HLSL_Missile

Missile fired by jet

Here is the jet, it has just dropped the missile. This missile falls along its path, it hits the land vehicle causing an explosion. The missile itself is a loaded model with a texture. Thankfully, we didn't have to make that out of a teapot as well.

HLSL_Texture_Explosion

Explosion Texture

The explosion was an interesting effect to implement. Similar to the fire effect, it uses a palette texture and a noise texture. The interesting part is, it uses a basic third degree pulse function to create the movement of the explosion. Its appearance can be altered via parameters:

Flammability - this adjusts the speed which the fire moves away from the centre (the higher the faster).
Pressure - thicker packing aka more rings of pressure waves around the centre.
Intensity - increases the size of the explosion.
Noisiness - increases the noise function's effect, making the fire more "crinkly" and appear more electrical.

HLSL_Water

Water

I was very pleased with the water effect, it had taken multiple attempts to come up with an attractive effect. Eventually, I came up with this: It gets noise from a texture, this is then combined with time, which causes it to move. Next, the normal of the current pixel is forced upwards. Now, offset the surface normal using the moving noise. Finally, add reflections from the skymap. The water's appearance can be changed via its parameters:

waveSpeed - increases the speed of the waves (scrolling).
noiseSpeed - changes the speed of noise movement (rippling).
fadeExp, fadeBias - alters the water's colour, reflection and transparency.