1
\$\begingroup\$

I have tried modifying all the settings suggested that I can find, but the lighting of objects in my Scene remains unchanged. I've used the "Generate" button, I've set "Intensity Multiple" to 0, I've enabled/disable Scene lighting, I've set the Environment Lighting to black, there are no lights in the Light Explorer, etc.

I want everything but the Canvas HUD to be completely black, except anything illuminated by manually added lights. Is there some way to do this in the latest Unity that I'm somehow missing?

Edit 2: I have changed the material of my sprites, and now there is total darkness, except when I place lights. I changed the Rendering Mode of the material to Fade to fix the HUD being blocked from viewing by the tiles, and now the problem is that a light placed as a child of the player is causing the player to appear as a purely black version of his sprite.

\$\endgroup\$
9
  • \$\begingroup\$ What content do you have in your scene right now that's receiving lighting? Can you show us a sample? \$\endgroup\$
    – DMGregory
    Commented Jan 26, 2022 at 19:10
  • \$\begingroup\$ All of it. The best I could get for reducing lighting was a black skybox behind all the backgrounds, tiles, and objects. \$\endgroup\$ Commented Jan 26, 2022 at 19:44
  • \$\begingroup\$ "All of it" helps someone who has seen your scene and knows what's in it. Unfortunately, we're not in that position, so you'll need to specifically list what kinds of renderers, materials, shaders, etc you've placed into your scene. \$\endgroup\$
    – DMGregory
    Commented Jan 26, 2022 at 19:48
  • \$\begingroup\$ It's a 2d scene, and I have not explicitly added any materials or shaders, nor renderers besides the default (i.e. Sprites-default material). I'm not sure what other facts are relevant here, since everything else I have is the basic 2d-platformer stuff. \$\endgroup\$ Commented Jan 26, 2022 at 20:00
  • \$\begingroup\$ The default sprite material is unlit - it always displays the native brightness/colour of the texture, regardless of lights in the scene. Did you mean to use a lit material or the 2D lighting system to handle darkening/shadowing your sprites? \$\endgroup\$
    – DMGregory
    Commented Jan 26, 2022 at 21:05

1 Answer 1

0
\$\begingroup\$

The default rendering material (formally called a Material, set in the Sprite Renderer component) for sprites is automatically fully visible regardless of other lights in the scene. In order to have a sprite affected by light (or the lack thereof), one must change the material to a different one. Setting to a newly created Material with all default settings suffices to make sprites respond to light. One should set "Intensity Multiple" to 0 and the Environment Lighting color to black, then press the "Generate" button, in order to actually remove the ambient light.

The Z position of the light, and the particular settings of the material, may affect how things actually end up getting lit, assuming one is using the default renderer with 3D Lights (just called Lights in the menus). The Rendering Mode of the material affects the results, with Fade being the option that solved some of my problems.

\$\endgroup\$
2
  • \$\begingroup\$ "One should set "Intensity Multiple" to 0 and the Environment Lighting color to black, then press the "Generate" button, in order to actually remove the ambient light" no, you should probably turn off baked global illumination if you're not using it, rather than paying the overhead of generating and storing unused lighting information and lighting everything with a pure black baked light. \$\endgroup\$
    – DMGregory
    Commented Jan 28, 2022 at 10:14
  • \$\begingroup\$ Don't forget to mark this answer as "Accepted" if it worked for you. \$\endgroup\$
    – DMGregory
    Commented Feb 27, 2022 at 2:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .