cs 248 interactive computer graphics - stanford...
TRANSCRIPT
CS248InteractiveComputerGraphics
Instructor:RonFedkiwWebsite:cs248.stanford.edu
MeetingTimes:TuesdayandThursday,12:00pmto1:20pm
CS148vs.CS248
• Renderingisanimportantpartofcreatingavideogame• CS148focusedonrendering• CS248thuswillnotdealmuchwithrendering• Willusescanlinerenderinginthiscourse• Raytracingistooslowforreal-timerenderinginvideogames--- butcanbeusedtogeneratehigh-qualitytexturesforthescanlinerenderer• Albeitrealtimeraytracersdonowexist
CS248:Overview
•Goal:Createavideogame!• CombinerenderingknowledgefromCS148withideasfromtherest ofcomputergraphicsincluding• (computational)Geometry• Animation• Simulation
• CS248willfocusonmakingthingsmove• i.e.AnimationandSimulation(alongwiththenecessarycomputationalgeometrytomakethishappen)
Geometry• Theenvironmentinwhichagameissetisoftenoneofthemostcompellingcomponentsofthegame• Animmersiveworldmakesthegamebothengagingandexciting• Worldscanbecreatedmanuallybyanartistand/orbeprocedurallygenerated
Geometry
• Avatarsandtheiropponentsrepresentimportantgamegeometry• Theyinteractwiththeworldviacollisions,etc.,whichrequirecomputationalgeometryalgorithms
Animation• Animationisnecessarytoaddmotiontothegeometry• Animatedbyanartist• Capturedfromaperformerorpuppeteer
• Simulatedwithequations/rules
Simulation• Simulationisanotherwayofmovingthegeometry• justonemethodofanimation,buthastakenonalifeofitsown
• Insteadofspecifyingpositions/velocitiesexplicitly,physicsequations(orotherrules)aresolvedtogetthesevalues• Allowsmoreinterestinginteractionwiththeenvironment
CS248Outline– PartI• Week1Introduction
• HW#1– Unitygameengine– 5%offinalgrade• Weeks2&3Animation
• Basics,AnimationCurvesandSplines,Etc.– 5%offinalgrade• HW#2Animation– 10%offinalgrade
• Weeks4&5Simulation• Particles&ParticleSystems(cloth,flocking,etc.),RigidBodies– 5%offinalgrade
• HW#3Simulation- 10%offinalgrade• Weeks6&7CharacterAnimation/Simulation
• CharactersandArticulatedBodies,AnimationandSimulationThereof–5%offinalgrade
• HW#4CharacterAnimation/Simulation- 10%offinalgrade• (*)Youmayworkwithapartner.GradingwillconsistofinpersonlivedemoslateMondayafternoonswiththeCAs(justlikeCS148).Seethewebsiteformoredetails.
CS248Outline– PartI• Week1Introduction
• HW#1– Unitygameengine– 5%offinalgrade• Weeks2&3Animation
• Basics,AnimationCurvesandSplines,Etc.– 5%offinalgrade• HW#2Animation– 10%offinalgrade
• Weeks4&5Simulation• Particles&ParticleSystems(cloth,flocking,etc.),RigidBodies– 5%offinalgrade
• HW#3Simulation- 10%offinalgrade• Weeks6&7CharacterAnimation/Simulation
• CharactersandArticulatedBodies,AnimationandSimulationThereof–5%offinalgrade
• HW#4CharacterAnimation/Simulation- 10%offinalgrade• (*)ShortorLongFormWrittenAssignments.Seethewebsiteformoredetails.
Shortor LongFormWrittenAssignments
• Thegoalistogetyouthinkingabouttheclassmaterial,andthinkingabouthowitrelatestoyourgameearlyon…• 15%ofthegradeintotal• WrittenAssignmentsfor9ofthelectures:
• Basics,AnimationCurvesandSplines,Etc.– lectures3,4,5• Particles&ParticleSystems,RigidBodies– lectures7,8,9• CharactersandArticulatedBodies – lectures11,12,13
• ShortForm – I’llasksomequestionsinandduringclass.Writedownbriefanswersonapieceofpaper.Turninattheendofclass.(Length– short– afewminutes ofwriting.)• LongForm – WillcovertheShortFormquestions.Butwillalsoaskforsomedetaileddiscussionsrelatedtothelectures,inordertoensurethesynergybetweenthelectureitselfandtheShortFormquestions.(Length– long– acouplepages ofwriting.)
GamingPlatforms• Theconstraintofinteractivity requiresonetoputextensiveeffortintotheplatformchosenfortheimplementationofthegame• MultithreadedPCGames
• MakeuseofallavailableresourcesonthePCincludingboththeCPUandtheGPU,makeuseofallcoresontheCPUusingmultithreaded parallelism
• Veryhighendgraphics• MobileGames
• OftensimplerthanPCgamesduetothelimitedcomputingresourcesavailable,verydifferentstyleofuserinputandinteractivity,usingsensors onthedeviceisamust
• 2D gamesmakinguseofsensorsandtouchscreens• Client/Server/BrowserGames
• Communicatebetweenmultiplecomputersandbrowsers,thebrowserhasmanytoolstoaidinmultiplayer communication,manynetworkingchallenges
• E.g.racinggames,mmos,etc.• ConsoleGames
• XboxOne,PS4,WiiU• Veryspecializedandstandardized computingenvironments• allowsformassproductionofverylowcostmachines(consoles)withoptimalresources• thegamedesignercanmakemanyassumptionsignoringanyhardwarevariationsin
ordertooptimizethegameandgameplay
Platform:MultithreadedPC• Multi-coreCPUsarethenormfortoday’scomputers.Anygameproducedtodaywillbereleasedina
marketdominatedbymulti-coreprocessors.N.B.bothPS4andXboxOnelooklikeaPC!
• Workcanbedividedintomultipletaskswhicharesubsequentlydistributedamongmultiplethreads• FunctionalDecomposition:Differentthreadsdedicatedtophysics,sound,rendering,networking,AI,GUI,etc.• DataDecomposition:Furtherincreasestheconcurrencyofeachfunctionsubsystem
• PCshavemuchmorepowerfulcomputingresources(CPUandGPU)comparedtootherplatformsallowingPCgamestobemuchmorecomplexandrealistic
• Yourgameshouldbevisually/technicallyimpressive,usethreads,andbe3D
• Therearemanytoolsforimplementingthreading,suchasPOSIXThreads(Pthreads),NativeWin32Threads,OpenMP,OpenCL,IntelTBB,etc.
Platform:MobileDevices• MoreopportunitiesforuserinteractioncomparedtoaPCgame• Touchscreen:Allowsforflexibletactileinputand
feedback• Multiplesensors:accelerometer,gyroscope,
magnetometer,etc.• Cameras:Interactwithanduseinformationfrom
thereal-world• Oftenrelymoreonimmersivegameplaythansuperiorgraphics• Simplergamescenes(typically2Dinsteadof3D)• LesscomputingpowercomparedtoaPC• Fastsimulationmodels(e.g.shapematchingfor
deformablebody,SPHforfluid.ConventionalsimulationmodelsonthePCaretooexpensiveformobile)
• OpenGLESstandardisasubsetofOpenGL• Yourgameshouldmakeuseofthespecialinteractiveandsensordrivenfeaturesofthemobiledevice(tabletsarepreferable),andcanbe2D
2DGames• 2Dgamesareallowedundercertaincircumstances,sincerenderingisnotthefocusofthiscourse• Needtodoaverygoodjobincorporatingthetopicscoveredinthiscourse(computationalgeometry,animation,andsimulation)intothegame• 2Dgamesarenotallowedforthe“ThreadedPC”option,sincethewholepointofthePCistoshowcasecomputationalpower• For“Mobile”,westronglyrecommend(prefer)2Dinordertolightentheloadonrenderingandstressotheraspectsofthegame
Platform:Client/Server/Browser
• Client-ServerModel• Servermaintainsconnectionswitheachoftheclients• Clientsdonotcommunicatewitheachother,butcanonlycommunicateindirectlythroughtheserver
• Peer-to-PeerModel• Peersarecoequalnodes• Communicationdoesnotrelyonaserver• Decentralizedsystem
• Browsershavelotsoftoolsusefulforimplementingclient/serverorpeer-to-peergames
• RunningabrowsergamealoneonaPCisnotanefficientuseofresources.Allbrowsergamesshouldbeeitherclient/serverorpeertopeer.Theycanbe2D.
Platform:Client/Server/Browser• Advantages:Cross-platformandconvenient• Canplayagameaslongasyouhaveaccesstoabrowser,noneedtodownloadanyclientprogram
• Donotneedtodealwiththeunderlyingoperatingsystem,justthebrowseritself
• Theabilitytocommunicatewithaserverorotherplayersmakesbrowsergamesversatile
• Disadvantages• Gamingexperienceisoftenlimitedinscope
• Programmingwithinabrowserhasitsownuniquechallenges
Platform:Client/Server/Browser• Largenumberoftechnologiesavailable
• AdobeFlash:Wellestablished,butgraduallybeingreplacedbyothers• HTML5:Openstandard,wellsupportedbythemajorityofbrowsers,performancetendstobelacking(especiallyin3D)
• WebGL:• BasedonOpenGLES• Hardwareacceleration:Canhandlecomplex3Dscenes• SeverallibrariesbuildontopofWebGL makingiteasiertonavigate
• CommunicationParadigms• WebSocket
• Designedtobeimplementedin webbrowsers and serversoverTCP• ProgrammedusingGo(recommended),Lua,Haskell,etc.
• Ajax(AsynchronousJavaScriptandXML)• LoadcontentwithJavaScriptasynchronously• Communicatewithoutwaiting
UnityGameEngine• WewillusetheUnitygameenginethroughoutthecourse
• Thisincludessomeofthehomeworkassignments• ThusitisveryimportantthatyoudonotmissthelecturesdedicatedtogettingyouuptospeedontheUnityEngine!• ContacttheCAsviaemailorseethewebsitetosetupyourfreelicense
• ThisThursday’slecture(Jan12)willbeaUnityboot-camptogetyoustarted• Thenevery2weeksafterthat,Thursday’slecturewillbededicatedtotheUnityengine:• Animation(Jan26),Simulation(Feb9),CharacterAnimation/Simulation(Feb23)
Homework1• DueMondaythe16th
• LiveDemowiththeCAs• InstalltheUnityEngine,setupascene/level,anddemoittotheCAs• importsomesimpleorinterestinggeometry• setupacamera,setuplighting,addtexturestoyourgeometry• seethewebsiteformoredetails
• WewillgetyoustartedviathelectureonThursday• 5%ofthefinalgrade• Youmayworkwithapartner
GameDesign• 50%ofyourfinalgradeisdirectlyrelatedtoyourgame• Youmayworkinteamsof1to4people• WestronglyencourageyoutousetheUnityEngine
• sincewewillhavespent4lecturesteachingyouhowtouseitforyourfirstfourhomeworkassignments
• andwewillgiveyousamplegame(s)/codeworkingintheengine• Thegamemustdrawheavilyontheconceptsdiscussedinthecourse(talktotheinstructororCAsifyouneedclarification)• Thelast3weeksoflecturearededicatedtogamedevelopment• Week8:GameDesign,Interactivity,andAI
• TuesdayFebruary28andThursdayMarch2– typicallygamingindustryguestlectures– attendance isrequiredandworth5%ofyourgrade
• HW5:handinalistofyourteamandadescriptionofyourproposedgame- 5%offinalgrade
• Week9:CAswilldemothe2D/3Dgamesthattheycreated,andprovidesourcecode
GameDemos• Thecompletedgameswillbelive-demoedduringtheregularfinalexamtimeslotforthecourse,andwillbe30%ofyourgrade• Eachpersonwillindependentlysubmita1pagewrite-updetailingwhattheydidforthegamebothindividuallyandincollaborationwithothers
• Youwillalsoberequiredtogivealivein-class demoofwhatyouhavesofarduringthelastweekofclasses• TuesdayMarch14orThursdayMarch16• Thiscountsas10%ofyourgrade
*Thefinalexamslotistypicallyusedforagamecompetition.Moredetailslater…