On This Page

Update of Attendance Policy

If Peter is ever late to class, attendance will not be taken that day. In addition, every student receives one additional forgiven absence to use later in the semester.


Review of Unity Essentials

Download LightingURP_Unity6.zip - https://drive.google.com/drive/u/0/folders/1z1lWtDQxULNfgVB50qnbJhhPC7XFX2Z_

Unity Version: 6000

Render Pipelines — what are they?

A render pipeline is a package of rendering features built into the runtime.

A pipeline will support certain features (raytracing, LOD, Shader Graph, etc.) and not others. It offers differing levels of platform support, rendering quality, etc.

Render Pipelines — why?

All those extra features must be built into the runtime (the Unity DLL that travels with your build).

The more features, the bigger the build size that your player has to download. Some features can be stripped out at compile time, but not all.

The rendering process will take more CPU and GPU resources to run on your player’s machine. This limits what devices you can target, requires more optimization on your part, and often leads to player complaints if they aren’t using a high-spec machine.

Render Pipelines — the three options

Unity has three common render pipelines:

  • the built-in option
  • Universal Rendering Pipeline (URP)
  • High-Definition Rendering Pipeline (HDRP)

I recommend that you default to URP unless you have a compelling reason to use HDRP.

Universal Render Pipeline (URP) is suitable for all platforms, including mobile, but it doesn’t include certain high-end features like ray tracing and volumetric lighting.

Built-in Pipeline will go away at some point.

High-Definition Rendering Pipeline (HDRP) does include all the high-end features, but requires a high-powered computer or modern console to run, as well as assets that look good at high resolution.

Importing 3D Models

Models will usually be FBX files that you download from the Unity Asset Store, find online, or export from Maya or Blender.

FBX files usually contain model, material, and texture information. Sometimes they can also contain animations.

If your model shows up as bright pink, it means something is wrong with the material that’s applied to it. You should check the material, texture, and shader for issues.

Manipulating Materials

Materials contain lots of information that determines how an object shows up on screen. The parameters that are available to you are determined by the shader that the material is using, but some of them are common:

  • Color
  • Texture (Base Map)
  • Smoothness
  • Metallic
  • Emission

You can copy and modify materials. This is a great way to swap out the texture on a character or object, for example.

Creating a Particle System

Unity provides you with a really nice system for creating particle effects using a whole bunch of adjustable options. Particle effects are useful for creating things like sparks, flames, smoke, explosions, sparkles, glows, beams, dust, fog, rain, snow, and sprays.

The best way to get started with particle systems is to find a pre-made effect (for example, on the Asset Store) or a tutorial that does something similar to what you’re looking for, and then go nuts tweaking the values. Once you get used to how particle systems work, you can also create them from scratch using custom textures and behaviors.

Falling Leaves https://www.youtube.com/watch?v=wQJ0_TqoLr4

Particle System

  • Duration: 5
  • Prewarm: Yes
  • Start Size: 0.3 to 0.5
  • Start Rotation: 1 to 360
  • Start Color: Green
  • Gravity Modifier: 0.1
  • Simulation Space: World
  • Simulation Speed: 0.5
  • Max Particles: 100

Emission — Rate over Time: 5 Shape — Angle: 60 Force over Lifetime — X: -4 Color over Lifetime — Opacity gradient 1 to 0 in last 20%

Noise

  • Separate Axes: Yes
  • X: 5, Y: 1.5, Z: 5
  • Frequency: 0.1
  • Scroll Speed: 1
  • Damping: No
  • Octaves: 2

Renderer — Leaf material Collision (optional) — Type: Planes; Dampen: 0.5; Bounce: 0; create an empty GameObject at ground level and add it to the Transform list.

Sparkle - https://www.youtube.com/watch?v=UHCwUMJOFsc

Particle System

  • Duration: 2
  • Prewarm: Yes
  • Start Lifetime: 1.8
  • Start Speed: 0
  • Start Size: 0.6 to 3
  • Start Rotation: 0 to 360
  • Start Color: Random between yellow and white
  • Max Particles: 100

Emission — Rate over Time: 20 Shape — Sphere; Radius: 0.01 Color over Lifetime — Opacity gradient 0 to 1 to 0 Rotation over Lifetime — Angular Velocity: -10 to 10 Renderer — Star material

Playing Audio

Your main camera should have an AudioListener component. To play a sound, you need a GameObject with an AudioSource component.

You can have your audio source be part of another object, in which case you just need to call its Play function in a script. But be careful when you’re destroying an object that might still be emitting audio!

You can instantiate a dedicated audio source and have it play on awake, but if you do that you should make sure it cleans up after itself. You can write a script that will self-destruct once it’s done playing. (That’s a useful one to keep in your cookbook!)

Creating and Instantiating Prefabs

Prefabs are important and offer two distinct advantages.

First, prefabs allow you to create multiple copies of one object, or multiple variations of the same basic object. If you need to make changes to the prefab (by updating the model, adjusting some values, adding a script, or anything else) then all the copies will automatically update as well.

Second, prefabs are stored as separate asset files, which means that it’s much easier for developers to make changes to a scene’s prefabs without causing version control conflicts. When you’re putting together your scene, think about how it makes sense to organize things into prefabs.

Lighting a Scene

Download LightingURP_Unity6.zip - https://drive.google.com/drive/u/0/folders/1z1lWtDQxULNfgVB50qnbJhhPC7XFX2Z_

There are four types of lights: directional lights, point lights, spot lights, and area lights.

Lights emit light according to their color and intensity. Only “lit” materials will react to lights; “unlit” materials ignore all lighting.

Lights can be controlled by scripts. You can turn them on or off, adjust their color and intensity, or change their direction (for directional and spot lights) and position (for point lights, spot lights, and area lights).

You can control general features of the light in your scene using Lighting Settings (Window → Rendering → Lighting). This will be very useful to you for creating atmosphere and mood in your scene. You can change some of them at runtime using the RenderSettings object.

Here are tutorials that will give you a jumpstart:

Setting Up a Camera

Align with View. A useful tool for working with cameras is the Align with View command in the GameObject menu.

Every scene comes with a camera already in the hierarchy, but you can add more cameras to your scene. If you do, you should make sure you only have one Main Camera (check the tag on the Camera object) and one Audio Listener.

You can turn cameras on and off using scripts or timelines. It is straightforward to set up split screen, though the logic for supporting gameplay can be more complicated.

Render Textures. You can point a camera at a RenderTexture in order to reflect it in the game world (for example, as a CCTV monitor, a mirror, or a 3D object in the UI).




Player Attention Through Workshop of Unity Essentials

How do you get the player to look at something in particular?

Roughly, a viewer’s attention is drawn to the following:

  • Movement
  • The brightest object
  • The most saturated color
  • An actor’s eyes
  • The object with the most contrast
  • Center of frame

Players also pay special attention to:

  • Threats
  • Interactables

Here is a breakdown of ways to draw and sustain attention, with a focus on web design (Link).

You can see that many elements are shared. On websites you are usually trying to facilitate an interaction, such as buy, learn, contact, find, and so on. The user is usually oriented to websites in general and knows what task they are trying to accomplish.

In games, the verbs are different, and often the player is trying to work out what their task is and what tools are available. This is often a source of the fun. Attention creates an expectation: what the player notices first shapes what they believe will matter later.

Here is a discussion of creating paths through a level. It is focused on shooter design, but has a lot of useful tips for creating focal points and sightlines, as well as a useful visualization of player paths through a level that helps identify points of choice and bottlenecks. https://www.youtube.com/watch?v=GZ99gAb4T0o

Now Workshop:

  • Download LightingURP_Unity6.zip - https://drive.google.com/drive/u/0/folders/1z1lWtDQxULNfgVB50qnbJhhPC7XFX2Z_
  • Open ‘priestLevel’
  • Manipulate the camera’s field of view and position
  • Add point lights. Edit
    • Color
    • Intensity
    • Position
  • Control attention through lighting
    • Groups two sets of point lights under two separate parents
    • So that you can toggle one set on and the other off
    • Each gives a lighting scheme
    • One scheme draws our attention to the foreground, the other the background


Ideation & Design — The Other Shoe

Brainstorm Three Ideas

Work in pairs and brainstorm the three game ideas you draft, per your homework today.

Discuss:

  • Setup — What does the player first encounter?
  • Anticipation — What does the player come to expect?
  • Payoff — What does the game eventually do with that expectation?

Expectation

Write one sentence describing what the player should expect after the opening moments of your game.

  • What does the player notice first?
  • What familiar convention or genre expectation are you using?
  • What action or response can repeat long enough to become a pattern?
  • What does that pattern invite the player to predict?

What detail does most of the work?

Payoff

Choose what the payoff does to the expectation:

  • Fulfill it — the predicted event arrives, but timing, scale, or consequence gives it force.
  • Complicate it — the prediction was partly right, but the world adds a condition or cost.
  • Overturn it — the world reveals that the player misunderstood the pattern.

The payoff should depend on the setup. If you could replace it with any surprising event, the two parts are not connected strongly enough.


Play

Antichamber — Playing on expectations we came into it with because of genre. “A genre is a collection of constraints that players can take as a given.” (Situational Game Design, p.20)

I’ll play and pause. You write down what you know and what you expect.