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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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"
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 ...
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 ...
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 ...
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 ...
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:
...
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.
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
lighting × 690unity × 225
opengl × 127
shaders × 108
2d × 80
shadows × 68
xna × 54
glsl × 52
rendering × 49
c++ × 37
c# × 36
3d × 31
lightmap × 27
java × 24
hlsl × 24
directx × 21
graphics × 21
shadow-mapping × 21
textures × 18
libgdx × 17
deferred-rendering × 16
unreal-4 × 15
materials × 15
pbr × 15
performance × 13