1 / 38

CSE4MOD Lighting

CSE4MOD Lighting. Paul Taylor 2009 . Textures need Lights Lights need Textures One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them -Does this need context to be awesome?-. OpenGL /DirectX Light Types. Point Spotlight Ambient

silvio
Download Presentation

CSE4MOD Lighting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE4MODLighting Paul Taylor 2009

  2. Textures need Lights Lights need Textures One Ring to rule them all, One Ring to find them,One Ring to bring them all and in the darkness bind them -Does this need context to be awesome?-

  3. OpenGL /DirectX Light Types Point Spotlight Ambient Distant

  4. Point home.elka.pw.edu.pl/.../general/General.html

  5. Spot home.elka.pw.edu.pl/.../general/General.html

  6. Ambient (Area) home.elka.pw.edu.pl/.../general/General.html

  7. Distant (Sun / Moon) home.elka.pw.edu.pl/.../general/General.html

  8. Specular Reflection • Specular • The more specular a surface, the move light is reflected very closely to the angle of reflection • A mirror is a near perfect Specular Surface http://www.indigorenderer.com/joomla/forum/files/specular_material_test_01_168.jpg

  9. Diffuse Reflection(Lambertian reflection) http://torcode.com/ http://www.glenspectra.co.uk/SiteResources/Data/Templates/1product.asp?DocID=389&v1ID=

  10. Emissive • It Glows! http://www.gennetten-concreteartist.com/d-network.html

  11. Translucent Surfaces Too Hard Basket!!! http://www.trinity3d.com/product.php?productid=1572&cat=293&page=2 http://www.nondot.org/sabre/Projects/Raytracer/

  12. Great so light is stupid complex! Good lighting is dependant on the reflections and behaviours of surfaces This means we can not just use simple textures that are coloured to look good We need to be able to define the behaviours of our objects We need to define the materials they are made of

  13. Materials • For OpenGL to calculate the lighting correctly your surfaces (Polygons) need to have their material properties set. • There are five Variables you will need to consider: • Shininess Exponent • Emission (4x Floats rgba) • Specular (4x Floats rgba) • Diffuse (4x Floats rgba) // Diffuse sets the alpha trans! • Ambient (4x Floats rgba)

  14. Lighting in 2k4 How many lights does DirectX 9 support? OpenGL 2.0?

  15. Here’s the lighting in a 2k4 Level

  16. So how many lights??

  17. 8 Wow!

  18. How do so many appear in game? There are 2 common ways to increase the lighting in a rendered scene: Baked in Lighting Multi-Pass Rendering

  19. Multi-Pass • Only 8 lights can be used per render • Using the accumulation buffer we can store a frame and blend it with the next frame • By doing an additive combine we can add the lighting from both sets of lights to the scene

  20. Baked In • This type is pre-calculated • As you have seen when you build a level • All the ‘light’ is stored in textures called light maps

  21. Lighting in 2k4 • There are 2 light groups • Dynamic • Static

  22. Light Properties • Colour • Brightness, Hue & Saturation ~= RGB • All range 0-255 (Brightness can exceed this limit) • Radius • The max distance a light may affect. • LightType is redundant (From the Unreal1 Era) • Lights will default to LT_Steady • The other light types are now implemented in another UT system called projectors

  23. Directional Lights There are a few ways to create these • The Actor Browser • Light->Spotlight / Sunlight • The sunlight actor is a special case, it utilises a surface to emit light from an ‘infinite’ distance • Set the bDirectional property to true • Advanced->bDirectional

  24. Light Effects • Lighting->LightEffect • Beware of Animated Effects they only work in UnrealEd!!! The Important ones: • LE_None – Default Constant Falloff • LE_NonIncidence – Sharper Falloff • LE_QuadraticNonIncidence – Super Sharp Falloff

  25. Rebuild Often • As soon as you relocate a light the shadows are removed until you rebuild • Use the lights only button when you are not moving geometry around

  26. Surface Properties (F5) • This is where you get to tweak all of your settings for texturing and light mapping • Inside the Pan/Rot/Scale Tab you will find Light Map:

  27. Light Map Size • This is the detail level of your light map. • 1 is the most detailed • 256 the least detailed • Higher detail creates sharper shadows!!!

  28. Static Meshes • Static Meshes are really bad at receiving shadows as they do not share the light maps used in the Unreal Engine • Surfaces are either Lit or Unlit, no graduation! • Static Meshes are good at casting shadows • So try to avoid casing shadows onto static meshes, instead let the static mesh cast a shadow onto the BSP Geometry

  29. Terrain Behaviour • Terrain light maps are stored separate to the BSP Geometry • Stored as a birds-eye view texture.

  30. Particles • Particles receive no light • Except for Mesh Emitters which receive very basic lighting as per static meshes

  31. Selective Lighting If Lighting->bSpecialLit is set a light will only affect surfaces that also have bSpecialLit set to true

  32. Improving your workflow • Scaling lights • Literal value Light += value • Percentage Light *= percentage

  33. Making Actors Emit Light • Any Static Mesh can emit light but you need to do a few alterations: • Set bShadowCast to false so light will exit the mesh without becoming a shadow • Set bUnlit to true so the mesh will not decide that it is in shadow and turn black

  34. Adding Coronas to Lights • This is as simple as adding a skin to your light that resembles a corona. • You’ll need to open Coronas.utx • Navigate to Display->Skins click add then click use to get the corona added to your light. • You can scale the Corona using DrawScale3D with the X and Y values

  35. Two types of Dynamic Light • TriggerLight • These guys are set up to be triggered • Plain Old Dynamic • Poor trigger abilities

  36. Projectors Replace Dynamic Lights for almost all uses They reduce the dependence on hardware lighting, by replacing the lighting with projected textures Projectors are both faster and better looking Projected textures interact with animated objects too!!!

  37. Think of them as little Cameras • We take the camera, load in image into it and point it at a surface • But how do we make an animated projector?

  38. Next Week Texturing and Materials

More Related