CSC 4356 FINAL PROJECT KEVIN CHERRY 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 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 Uses function that copies image file to GL texture index Diffuse and normal textures are handled in shader Easy to implement and looks great! 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 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 ASprite for animation 3 images swapped every 80 milliseconds Same as in project 3 Not as good looking though? Perhaps needs more for it to refract? 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 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 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 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 Uses glutJoystickFunc with poll interval of 15 Uses unsigned int as bit mask for buttons Works for any joystick (buttons will be different) 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 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 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 Uses FMOD Ex Used for footsteps Triggered when y deviation is less than threshold 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 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 More realistic water More sounds Background music? Lens flare? Recursive mirror rendering More scenary