cse4mod lighting

38
CSE4MOD Lighting Paul Taylor 2009

Upload: silvio

Post on 24-Feb-2016

34 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSE4MOD Lighting

CSE4MODLighting

Paul Taylor 2009

Page 2: CSE4MOD Lighting

Textures need LightsLights 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?-

Page 3: CSE4MOD Lighting

OpenGL /DirectX Light Types

PointSpotlightAmbientDistant

Page 4: CSE4MOD Lighting

Point

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

Page 5: CSE4MOD Lighting

Spot

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

Page 6: CSE4MOD Lighting

Ambient (Area)

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

Page 7: CSE4MOD Lighting

Distant (Sun / Moon)

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

Page 8: CSE4MOD Lighting

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

Page 9: CSE4MOD Lighting

Diffuse Reflection(Lambertian reflection)

http://torcode.com/http://www.glenspectra.co.uk/SiteResources/Data/Templates/1product.asp?DocID=389&v1ID=

Page 10: CSE4MOD Lighting

Emissive

• It Glows!

http://www.gennetten-concreteartist.com/d-network.html

Page 12: CSE4MOD Lighting

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

Page 13: CSE4MOD Lighting

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)

Page 14: CSE4MOD Lighting

Lighting in 2k4

How many lights does DirectX 9 support?

OpenGL 2.0?

Page 15: CSE4MOD Lighting

Here’s the lighting in a 2k4 Level

Page 16: CSE4MOD Lighting

So how many lights??

Page 17: CSE4MOD Lighting

8Wow!

Page 18: CSE4MOD Lighting

How do so many appear in game?

There are 2 common ways to increase the lighting in a rendered scene:

Baked in LightingMulti-Pass Rendering

Page 19: CSE4MOD Lighting

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

Page 20: CSE4MOD Lighting

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

Page 21: CSE4MOD Lighting

Lighting in 2k4

• There are 2 light groups– Dynamic– Static

Page 22: CSE4MOD Lighting

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

Page 23: CSE4MOD Lighting

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

Page 24: CSE4MOD Lighting

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

Page 25: CSE4MOD Lighting

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

Page 26: CSE4MOD Lighting

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:

Page 27: CSE4MOD Lighting

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!!!

Page 28: CSE4MOD Lighting

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

Page 29: CSE4MOD Lighting

Terrain Behaviour

• Terrain light maps are stored separate to the BSP Geometry

• Stored as a birds-eye view texture.

Page 30: CSE4MOD Lighting

Particles

• Particles receive no light– Except for Mesh Emitters which receive very basic

lighting as per static meshes

Page 31: CSE4MOD Lighting

Selective Lighting

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

Page 32: CSE4MOD Lighting

Improving your workflow

• Scaling lights– Literal value Light += value– Percentage Light *= percentage

Page 33: CSE4MOD Lighting

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

Page 34: CSE4MOD Lighting

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

Page 35: CSE4MOD Lighting

Two types of Dynamic Light

• TriggerLight– These guys are set up to be triggered

• Plain Old Dynamic– Poor trigger abilities

Page 36: CSE4MOD Lighting

Projectors

Replace Dynamic Lights for almost all usesThey reduce the dependence on hardware

lighting, by replacing the lighting with projected textures

Projectors are both faster and better lookingProjected textures interact with animated

objects too!!!

Page 37: CSE4MOD Lighting

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?

Page 38: CSE4MOD Lighting

Next Week Texturing and Materials