csc 4356 final project
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 PresentationTRANSCRIPT
![Page 1: CSC 4356 FINAL PROJECT](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/1.jpg)
CSC 4356 FINAL PROJECTKEVIN CHERRY
![Page 2: CSC 4356 FINAL PROJECT](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/2.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/3.jpg)
DEMO
![Page 4: CSC 4356 FINAL PROJECT](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/4.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/5.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/6.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/7.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/8.jpg)
Point Sprite
ASprite for animation 3 images swapped every 80 milliseconds
![Page 9: CSC 4356 FINAL PROJECT](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/9.jpg)
Water
Same as in project 3 Not as good looking though?
Perhaps needs more for it to refract?
![Page 10: CSC 4356 FINAL PROJECT](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/10.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/11.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/12.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/13.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/14.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/15.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/16.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/17.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/18.jpg)
Sound
Uses FMOD Ex Used for footsteps
Triggered when y deviation is less than threshold
![Page 19: CSC 4356 FINAL PROJECT](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/19.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/20.jpg)
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](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/21.jpg)
What’s Left
More realistic water More sounds
Background music? Lens flare? Recursive mirror rendering More scenary
![Page 22: CSC 4356 FINAL PROJECT](https://reader030.vdocument.in/reader030/viewer/2022012821/56815ee0550346895dcd82e7/html5/thumbnails/22.jpg)
Q & A