67 votes
Accepted

Making a night scene without being dark on the monitor

This is one case where it's useful to steal ideas from Hollywood, who have been doing this for decades. Typical hollywood night scene, also related question from Movies.SE The picture above was ...
user avatar
  • 14.6k
43 votes
Accepted

Why do some games show lights shine through walls?

Expanding on TomTsagk's correct answer, I thought it might help to describe a bit more about why games work like this. Light in games doesn't really "travel" from the source, to the surface, to the ...
user avatar
  • 114k
36 votes
Accepted

Phong lighting - there is something very strange with specular lighting

specular lighting of directional light more area has specular lighting when camera is far from an object Yep, looks right to me. The specular area for directional lights is supposed to be more or ...
user avatar
  • 14.6k
34 votes
Accepted

Is a Gaussian blur a fairly accurate representation of soft shadow edges?

Real-life soft shadows have a shape that depends on the shape of the light source as it appears from the point of view of the shadowed surface. This is because penumbras occur due to partial ...
user avatar
  • 33.2k
31 votes

How can I make particles glow and cast light on its surroundings?

Heads-Up: This answer is outdated. Unity now supports point light particles natively. Please see this answer for full details. I'll leave post this here for anyone curious, or using old versions of ...
user avatar
  • 114k
24 votes
Accepted

How can I model a star?

Use an animated texture.* There are some good ones in the store for < $10. Add a Halo. You can use the particle system, or just a transparent glow texture on a billboard in front of the sun with a ...
user avatar
  • 9,927
23 votes
Accepted

What is the utility of squared radius and inverse squared radius for lighting computations?

This is simply a kind of optimization given that invSqrRadius = 1/SqrRadius, instead of calculating the inverse squared radius for each light every time they simply ...
user avatar
  • 12.5k
22 votes

Why do some games show lights shine through walls?

Long story short, this happens for performance reasons. When there's a light on the screen, by default it shines on all objects (obstructed or not), so the game would need to make extra calculations ...
user avatar
  • 4,218
19 votes
Accepted

What is the difference between PBR and SSR?

Physically-Based Rendering You're on the right track when you say "it tries to mimic how light reflects in real life, which is it usually gets split to two components, specular and diffuse depending ...
user avatar
  • 114k
18 votes
Accepted

Why is the distance from object to eye irrelevant in illumination models?

After initially being puzzled about this question, because it felt natural that objects don't change their brightness depending on the distance to the eye (or camera), but only depending on the ...
user avatar
  • 1,497
16 votes
Accepted

Invert the colour of pixels where 1 bit sprites are overlapping

We can do this by making a custom version of the standard sprite shader (so it still does everything the one you're used to can do), and modifying its blending operation. Start by going to the Unity ...
user avatar
  • 114k
15 votes

Why do my point lights disappear when another nearby light is above 1.85 range?

Select the Light object Go to Inspector Light And change rendered mode "Auto" to "important"
user avatar
11 votes
Accepted

What is deferred lighting?

In deferred shading all the material properties are rendered into the G-buffer, e.g. albedo, normals, roughness, metalness, etc. that are needed for BRDF evaluation. After this step shading is ...
user avatar
  • 870
11 votes
Accepted

What is a lobe, in reference to lighting and graphics

It's a peak in a function defined in polar or spherical coordinates. If we look at the function y = cos(x) in rectangular coordinates, it looks like a wave, with ...
user avatar
  • 114k
11 votes
Accepted

Where to cast light/shadows in a 2.5D view?

Going to try and doodle up what I mean here as soon as I finish typing this, but: What about merging the two? Use the second (occlude by base) for everything that isn't a wall and the first (occlude ...
user avatar
11 votes
Accepted

How is this lantern glow effect achieved?

My best guess right now is that it's a billboarded transparent sprite, which is animated to give it a pulsing effect. Exactly that. This is simple enough even for older hardware. There's also some ...
user avatar
  • 8,272
10 votes
Accepted

Converting time of day into a smooth day/night variable?

tl;dr Func 1 on Wolfram Alpha: 1 - 2 * |(x mod 2) - 1| Or in your specific case: ...
user avatar
  • 10.5k
10 votes

How can I model a star?

Other then the particale system and halo effects Vadim mentioned you could create your own shader effect. There is some introduction to shaders for Unity and the possibilities are endless.
user avatar
  • 1,949
10 votes

How can I replicate the look of Zelda: BotW in my own shaders?

The Cell Shader To create a similar effect you will need two or three diffuse textures for the same number of brightness steps. Use smoothstep with a small range ...
user avatar
9 votes

How do I implement flat shading in GLSL?

As @rutter says, your #1 option is the correct thing to do in the overwhelming majority of all cases. However, if you're really adamant that you want everything to be hard-edged, then you can do this ...
user avatar
9 votes
Accepted

How can I implement a revealing light beam?

One way to implement an effect like this is with the stencil buffer. This is an extra few bits the renderer keeps around for every pixel in a render target, that you can use for scratch notes about ...
user avatar
  • 114k
8 votes
Accepted

How can I make particles glow and cast light on its surroundings?

Light emiting particles is now a built in Unity feature in 5.5. Simply enable Lights in the particle inspector, throw in a reference to a light prefab (both point and spot lights work), and change ...
user avatar
  • 1,134
8 votes

How can I create light shafts like Journey's in Unity?

You mention you're using Unity so you can use their official "Sun Shafts" feature; it's built right into the engine: You can read these Unity Docs to get a good idea of what they're capable of and ...
user avatar
  • 1,222
8 votes

Random black pixels GLSL shader bug

Unexpectedly black pixels sometimes indicate that you've got an infinity or NaN in the shader somewhere. For example normalize(vec3(0,0,0)) will generate a NaN. To me, the most obvious candidate in ...
user avatar
  • 6,576
7 votes
Accepted

procedural forest canopy for terrain lighting

This sounds like a job for Light Cookies. These have a number of advantages over the shadow mapping method you describe: Cookies can represent intermediate levels of brightness, helping you get ...
user avatar
  • 114k
7 votes
Accepted

How do I implement flat shading in GLSL?

You may have heard 3D modelers talk about "hard edges" or "sharp edges", which are roughly equivalent to what you're looking for here. When modelers create a hard edge, their software will internally ...
user avatar
  • 726
7 votes

How to avoid "completely" dark shadow using directional light (as Sun) ?

You said you were using an "Eye Adaption" Plug-in. Disable that first to make sure the issue is not caused by that. At last you have several knobs to tweak the outcome. I recommend you use a balance ...
user avatar
  • 619
6 votes

Why do my point lights disappear when another nearby light is above 1.85 range?

You should go to Edit > Project Settings > Quality and change the pixel light count to a higher value.
user avatar
6 votes

What is the utility of squared radius and inverse squared radius for lighting computations?

The other answers here dealt with the inverse square radius, but I'm going to look at the squared radius instead (which concept3d touched on, but I believe it merits further discussion). What squares ...
user avatar
6 votes

What is the utility of squared radius and inverse squared radius for lighting computations?

invSqrRadius isn't 1 - sqrRadius; it's 1 / sqrRadius. It means that you can multiply by invSqrRadius, instead of dividing by sqrRadius (as division is typically much more expensive than ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible