44
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 ...
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
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 ...
20
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 ...
17
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 ...
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
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 ...
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
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
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 ...
8
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
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
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
Accepted
How can I make a ball glow and cast light?
You can't use the emmisive property alone, that will simply cause the object to appear. If this is something you are positive you want (And realize that it may affect your FPS, especially if you have ...
6
votes
Accepted
Light Attenuation Formula Derivation
In real physics, light (like many other influences) falls off as the inverse square of distance from the source.
You can visualize this by imagining a lightbulb giving off one instantaneous flash - ...
5
votes
Memory-Efficient, Optimized Terraria-Like 2D Lighting
One option would be to load lighting information only as it appears on the screen. You would get one performance hit at the beginning as the full screen lighting is calculated, but from there you ...
5
votes
How to set emission level through C#
You're bang on for a low-dynamic range emissive colour. To get access to brighter emission we need to move to a high-dynamic range, which is outside the range of the ...
4
votes
Accepted
Efficient Per-Tile Lighting Technique
Use a lightmap.
A lightmap is an array in memory which is as large as your map and represents the light level of each tile.
When you create/remove a light source, add/subtract its light intensity ...
4
votes
How can I make particles glow and cast light on its surroundings?
Years ago, before dynamic lights were affordable, we would simply use a 2D-billboarded particle effect with additive blending. It would brighten the scene towards white. By drawing it with the correct ...
4
votes
Accepted
2D deferred lighting calculations not working
First Question: The dot product basically tells you how much two vectors are pointing in the same direction. So if a light points directly against the normal of a surface the surface will be brighter ...
4
votes
How do I properly combine the colors of different lights?
Define "properly." There are multiple ways of blending color. Additive blending works as you describe, 0.1 + 0.1 = 0.2 because we don't care if this value goes ...
4
votes
Accepted
How can I create light shafts like Journey's in Unity?
Use stretched particle to get the effect. In Renderer, choose "Stretched Billboard". Change Length Scale as you need. This can be used in both 3D and 2D scenes.
If you are actually into effect stuffs ...
4
votes
Accepted
Unity - Small holes of light seems to go through my blender mesh
I believe that might be related to "shadow acne." Try lowering the bias of your directional lights.
http://answers.unity3d.com/questions/925812/unity-5-real-time-lights-cast-shadows-with-gaps-li.html
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
lighting × 712unity × 237
opengl × 127
shaders × 111
2d × 83
shadows × 71
xna × 54
glsl × 52
rendering × 47
c# × 37
c++ × 37
3d × 32
lightmap × 26
java × 25
graphics × 23
hlsl × 23
shadow-mapping × 21
directx × 20
textures × 19
libgdx × 17
deferred-rendering × 16
unreal-4 × 15
materials × 15
performance × 14
pbr × 14