DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured...

19
DirectX 11 Graphics Programming Coursework Presentation By Mark Thompson, Student ID: 1101100

Transcript of DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured...

Page 1: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

DirectX 11

Graphics Programming

Coursework Presentation By Mark Thompson, Student ID: 1101100

Page 2: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Welcome to Pandora! (*cough* Borderlands Reference)

Page 3: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Outline

Three main features:

Cel shading, terrain and water.

Controls:

Space Toggle Wireframe

Return Toggle Cel-Shading

WASD Camera Movement

LMB Hold Camera Rotation

Escape Exit application

Page 4: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Main Feature: Cel shading

Aim: recreate Borderlands aesthetic

(Hence the Pandora reference.)

Demonstrates:

Multi-staged post process.

2D orthographic rendering.

Shader:

Kernel matrix filtering method.

Controllable line threshold and thickness.

Page 5: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Main Feature: Cel shading

Rendering stages:

1) Textured scene.

Render the scene to

texture. Can be done

using no light (better for

increased detail.

2) Scene outline.

Using the rendered

scene texture, use the

cel-shader to apply a

kernel filter to each pixel

which will determine

geometry edges.

3) Result.

Multiply the two textures

to produce the cel

shaded effect.

Page 6: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Target

Main Feature: Cel shading

Result

Page 7: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Main Feature: Terrain

Aim: create realistic looking terrain.

Demonstrates:

Height and slope based alpha blended multi-texturing.

Distance based tessellation.

Externally loaded height map.

Skybox using cube map texture.

Shader:

Controllable height and slope texturing levels.

Controllable alpha blending transition speed.

Use hull and domain shaders for tessellation.

Page 8: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Pipeline process overview:

Main Feature: Terrain

Vertex

Shader

Hull

Shader

Domain

Shader

Pixel

Shader

1) Pass through

Data is passed straight to the

hull shader so that it can

setup the patch data for

tessellation.

2) Setup

Sets a uniform tessellation

factor for each patch edge

based on the distance

between the camera and

patch. Also generates control

points for the domain shader.

Tessellator

3) Tessellation

Takes the hull shader output

and subdivides the patches

according to the tessellation

factors.

4) “Vertex Shader”

Essentially acts as the vertex

shader but instead of acting

per vertex it acts on a

weighted average using the

new points generated by the

tessellator.

5) Colouring

Handles the slope based

multi-texturing and alpha

blending. Additionally handles

both normal and cel-shaded

lighting calculations.

Page 9: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Main Feature: Terrain

Target Result

Page 10: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Main Feature: Water

Aim: create realistic looking water.

Demonstrates:

Reflection.

Refraction.

Vertex manipulation.

Normal mapping.

Shader:

Alter the reflection and refraction textures through colouring,

brightness and blending.

Controllable normal map sampling displacement and animation

speed.

Controllable waves through amplitude, speed, direction and

wavelength.

Page 11: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Main Feature: Water

Reflection

Render the scene to a texture using the cameras inverted view matrix. Use a clipping plane to prevent rendering anything below the water. Apply optional reflection dimming.

Refraction

Render the render the scene to a texture using the cameras normal view matrix. Use a clipping plane to prevent rendering anything above the water. Apply optional colour addition.

Waves

Create multiple sine waves - amplitude, direction, frequency, wavelength – and combine to produce the wave effect.

Bump Mapping

Applying a bump map greatly increases graphical fidelity by simulating rippling water.

Page 12: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Main Feature: Water

Target Result

Page 13: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

System Module Graphics Module

Contained block

Input

Process

System

Timer

Entities

Base Block

Entity

Entity3D

Entity2D

Contained Block

3D

Model Types

Plane

Terrain

2D

Bitmap

Shaders

Base Block

Shader

Contained Block

Extended

Shaders

Code Structure: Modules

Utility Module

Contained block

Maths

Stringify

Reporting

TokenStream

Macros

Core

D3D

Contained block

Camera

Light

Scene

Sky Box

Texture Array

Render Texture

Page 14: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Code Structure: Hierarchy

Object oriented design.

Tightly encapsulated classes.

Simple overarching program flow.

Application (simplified)

Entry Point

Process

Timer

Reporting

System

D3D

Shaders

Camera

Models

Lights

Render Textures

Scene

Page 15: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Reflection: Improvements

Terrain

Procedural terrain generation using Perlin Noise.

Distance based detail – apply hi-res texture and normal mapping

when close to terrain.

Water

Shore waves.

Specular lighting.

Tessellation.

Underwater effect.

Page 16: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Reflection: Considerations

Adaptive tessellation.

Problem: cracks.

Benefit: can load far greater sized height maps without a

performance hit (managed to get upwards of 2048x2048.)

Killzone 2 styled lens flare post processing technique.

Problem: created flare regardless of object depth.

Benefit: doesn’t require fixed point source (e.g. the Sun) like

traditional lens flare techniques.

Particles.

Problem: looked bad.

Benefit: adds depth to a scene if done correctly.

Page 17: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Reflection: Learning Points

How to utilise and take advantage of shader programs.

Many new graphic techniques including post processing,

tessellation, render textures and such like.

Post processing is great even if it doesn’t work correctly – get

some really interesting effects.

Killzone chromatic aberration…

Page 18: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Reflection: Future Approach

When struggling on something, sometimes better to just let

go and not waste more time.

Do more research before starting project to get a fuller idea

of what can be accomplished.

Set realistic target then start adding features once complete.

Page 19: DirectX 11 Graphics Programming€¦ · Main Feature: Cel shading Rendering stages: 1) Textured scene. Render the scene to texture. Can be done using no light (better for increased

Entire Feature list

Keyboard and mouse interaction

Moving camera

Cube map texturing, height and slope based alpha blended multi-texturing

Combined directional, diffuse and ambient lighting

Normal mapping

Reflection

Refraction

Vertex manipulation

Post processing techniques

2D orthographic rendering

Model loading

Height map

Skybox

Distance based tessellation

Stacked matrix transforms

References

A separate document contains references to all of the

resources that were used in the application and presentation.