CSC 4356 FINAL PROJECT

22
CSC 4356 FINAL PROJECT KEVIN CHERRY

description

CSC 4356 FINAL PROJECT. KEVIN CHERRY. Objective. Class Techniques Shadow Normal Map Point Sprite Water / Mirror Spot / Point Light Common Techniques Skycube HUD Joystick Camera Bob When Walking Sound Collision Detection Custom Techniques Water Fade Off. DEMO. Shadow. - PowerPoint PPT Presentation

Transcript of CSC 4356 FINAL PROJECT

Page 1: CSC 4356 FINAL PROJECT

CSC 4356 FINAL PROJECTKEVIN CHERRY

Page 2: CSC 4356 FINAL PROJECT

Objective Class Techniques

Shadow Normal Map Point Sprite Water / Mirror Spot / Point Light

Common Techniques Skycube HUD Joystick Camera Bob When Walking Sound Collision Detection

Custom Techniques Water Fade Off

Page 3: CSC 4356 FINAL PROJECT

DEMO

Page 4: CSC 4356 FINAL PROJECT

Shadow Uses code from notes Able to render for multiple objects

Stores reversed view matrix in texture so I can get just model matrix in shader

Page 5: CSC 4356 FINAL PROJECT

Normal Map

Uses function that copies image file to GL texture index Diffuse and normal textures are handled in shader Easy to implement and looks great!

Page 6: CSC 4356 FINAL PROJECT

Point Sprite Got starting code online Structs

Sprite: GL texture unit, position, color, scale, texture coordinates

ASprite: Same but GL texture unit is array and texture count, texture index, swap delay, and swap counter added

Page 7: CSC 4356 FINAL PROJECT

Point Sprite Render

Creates x,y positions for four vertices Binds sprite’s texture Uses triangle strip and texture coordinates Rendered last so texture’s alpha is blended with scene

Page 8: CSC 4356 FINAL PROJECT

Point Sprite

ASprite for animation 3 images swapped every 80 milliseconds

Page 9: CSC 4356 FINAL PROJECT

Water

Same as in project 3 Not as good looking though?

Perhaps needs more for it to refract?

Page 10: CSC 4356 FINAL PROJECT

Mirror Uses water reflection code Tricky at first

Must flip over the clipping plane axis This and reflection in water is the only time you can see

player

Page 11: CSC 4356 FINAL PROJECT

Spot / Point Light Couldn’t get spotlight working Instead objects lit by multiplying white vector based on

camera distance in fragment shader Light flickers with time to simulate fire from match Light gradually takes effect as match comes up/down

Page 12: CSC 4356 FINAL PROJECT

Skycube Easy to add to scene, hard to get texture mapped right

Most sky cube textures online have small problems Mapped in Wings and carefully touched up Moves with player so player never escapes

Page 13: CSC 4356 FINAL PROJECT

HUD Had a lot of problems at first, but then realized a simple

solution: Pop any model tranformations Reverse view transformations in opposite order Perform HUD translations Render

Page 14: CSC 4356 FINAL PROJECT

Joystick

Uses glutJoystickFunc with poll interval of 15 Uses unsigned int as bit mask for buttons Works for any joystick (buttons will be different)

Page 15: CSC 4356 FINAL PROJECT

Joystick Problem: Glut only recognizes 3 axis Solution: Glfw

In joystick mapped function, glfw used for 4 axis values Axis values alter same code as mouse movement

Axis values [-1, 1] Deadzone set to 0.2

Page 16: CSC 4356 FINAL PROJECT

Joystick

Can switch from joystick to keyboard and mouse while game is running

Each switch resets movement values Switches automatically to keyboard and mouse if joystick

is disconnected

Page 17: CSC 4356 FINAL PROJECT

Camera Bobbing

Common technique used in majority of games Running increases bobbing rate Increases a value as you walk Uses sin of value converted to radians for y

displacement

Page 18: CSC 4356 FINAL PROJECT

Sound

Uses FMOD Ex Used for footsteps

Triggered when y deviation is less than threshold

Page 19: CSC 4356 FINAL PROJECT

Collision Detection Checks camera’s position relative to custom 2D squares

Squares are expressed as center XZ position along with width and depth

If camera is within square Check distance to all edges Move to outside of that edge

Page 20: CSC 4356 FINAL PROJECT

Water Fade Off Without this, can see where water is cut by skycube With it, water fades off and seems to continue off into

the distance Accomplished in shader

Page 21: CSC 4356 FINAL PROJECT

What’s Left

More realistic water More sounds

Background music? Lens flare? Recursive mirror rendering More scenary

Page 22: CSC 4356 FINAL PROJECT

Q & A