cs 248 interactive computer graphics - stanford...

21
CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw Website: cs248.stanford.edu Meeting Times: Tuesday and Thursday, 12:00pm to 1:20pm

Upload: lamdung

Post on 15-Apr-2018

233 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

CS248InteractiveComputerGraphics

Instructor:RonFedkiwWebsite:cs248.stanford.edu

MeetingTimes:TuesdayandThursday,12:00pmto1:20pm

Page 2: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

CS148vs.CS248

• Renderingisanimportantpartofcreatingavideogame• CS148focusedonrendering• CS248thuswillnotdealmuchwithrendering• Willusescanlinerenderinginthiscourse• Raytracingistooslowforreal-timerenderinginvideogames--- butcanbeusedtogeneratehigh-qualitytexturesforthescanlinerenderer• Albeitrealtimeraytracersdonowexist

Page 3: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

CS248:Overview

•Goal:Createavideogame!• CombinerenderingknowledgefromCS148withideasfromtherest ofcomputergraphicsincluding• (computational)Geometry• Animation• Simulation

• CS248willfocusonmakingthingsmove• i.e.AnimationandSimulation(alongwiththenecessarycomputationalgeometrytomakethishappen)

Page 4: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

Geometry• Theenvironmentinwhichagameissetisoftenoneofthemostcompellingcomponentsofthegame• Animmersiveworldmakesthegamebothengagingandexciting• Worldscanbecreatedmanuallybyanartistand/orbeprocedurallygenerated

Page 5: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

Geometry

• Avatarsandtheiropponentsrepresentimportantgamegeometry• Theyinteractwiththeworldviacollisions,etc.,whichrequirecomputationalgeometryalgorithms

Page 6: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

Animation• Animationisnecessarytoaddmotiontothegeometry• Animatedbyanartist• Capturedfromaperformerorpuppeteer

• Simulatedwithequations/rules

Page 7: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

Simulation• Simulationisanotherwayofmovingthegeometry• justonemethodofanimation,buthastakenonalifeofitsown

• Insteadofspecifyingpositions/velocitiesexplicitly,physicsequations(orotherrules)aresolvedtogetthesevalues• Allowsmoreinterestinginteractionwiththeenvironment

Page 8: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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.

Page 9: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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.

Page 10: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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.)

Page 11: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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

Page 12: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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.

Page 13: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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

Page 14: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

2DGames• 2Dgamesareallowedundercertaincircumstances,sincerenderingisnotthefocusofthiscourse• Needtodoaverygoodjobincorporatingthetopicscoveredinthiscourse(computationalgeometry,animation,andsimulation)intothegame• 2Dgamesarenotallowedforthe“ThreadedPC”option,sincethewholepointofthePCistoshowcasecomputationalpower• For“Mobile”,westronglyrecommend(prefer)2Dinordertolightentheloadonrenderingandstressotheraspectsofthegame

Page 15: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

Platform:Client/Server/Browser

• Client-ServerModel• Servermaintainsconnectionswitheachoftheclients• Clientsdonotcommunicatewitheachother,butcanonlycommunicateindirectlythroughtheserver

• Peer-to-PeerModel• Peersarecoequalnodes• Communicationdoesnotrelyonaserver• Decentralizedsystem

• Browsershavelotsoftoolsusefulforimplementingclient/serverorpeer-to-peergames

• RunningabrowsergamealoneonaPCisnotanefficientuseofresources.Allbrowsergamesshouldbeeitherclient/serverorpeertopeer.Theycanbe2D.

Page 16: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

Platform:Client/Server/Browser• Advantages:Cross-platformandconvenient• Canplayagameaslongasyouhaveaccesstoabrowser,noneedtodownloadanyclientprogram

• Donotneedtodealwiththeunderlyingoperatingsystem,justthebrowseritself

• Theabilitytocommunicatewithaserverorotherplayersmakesbrowsergamesversatile

• Disadvantages• Gamingexperienceisoftenlimitedinscope

• Programmingwithinabrowserhasitsownuniquechallenges

Page 17: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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

Page 18: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

UnityGameEngine• WewillusetheUnitygameenginethroughoutthecourse

• Thisincludessomeofthehomeworkassignments• ThusitisveryimportantthatyoudonotmissthelecturesdedicatedtogettingyouuptospeedontheUnityEngine!• ContacttheCAsviaemailorseethewebsitetosetupyourfreelicense

• ThisThursday’slecture(Jan12)willbeaUnityboot-camptogetyoustarted• Thenevery2weeksafterthat,Thursday’slecturewillbededicatedtotheUnityengine:• Animation(Jan26),Simulation(Feb9),CharacterAnimation/Simulation(Feb23)

Page 19: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

Homework1• DueMondaythe16th

• LiveDemowiththeCAs• InstalltheUnityEngine,setupascene/level,anddemoittotheCAs• importsomesimpleorinterestinggeometry• setupacamera,setuplighting,addtexturestoyourgeometry• seethewebsiteformoredetails

• WewillgetyoustartedviathelectureonThursday• 5%ofthefinalgrade• Youmayworkwithapartner

Page 20: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

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

Page 21: CS 248 Interactive Computer Graphics - Stanford Universityweb.stanford.edu/class/cs248/pdf/class_01_introduction.pdf · CS 248 Interactive Computer Graphics Instructor: Ron Fedkiw

GameDemos• Thecompletedgameswillbelive-demoedduringtheregularfinalexamtimeslotforthecourse,andwillbe30%ofyourgrade• Eachpersonwillindependentlysubmita1pagewrite-updetailingwhattheydidforthegamebothindividuallyandincollaborationwithothers

• Youwillalsoberequiredtogivealivein-class demoofwhatyouhavesofarduringthelastweekofclasses• TuesdayMarch14orThursdayMarch16• Thiscountsas10%ofyourgrade

*Thefinalexamslotistypicallyusedforagamecompetition.Moredetailslater…