Unity game view too dark on runtime - c#

I made a simple game menu in unity, but it's looking way too dark in the game view (and in runtime), I tried:
Window->Rendering->Lightning Settings and set the Environment Lightning's Source to color and Light Grey color, also checked the Auto Generate option in Lightmapping settings but nothing of the above worked, it still looks way too dark. Is there any fix for this?
Sorry for the small image in the first link but I think it's very noticeable the difference in the colors anyway.

In the scene tab, you have to check the little sun ☼ next to the "Shaded" drop down so as to see the real lightning of your scene.
Since you have no light in your scene (except the ambient one) your models look very dark. Add a directional light to your scene (GameObject > Light > Directional Light)

Related

Unity light not showing up over background sprite

I have a power-up GameObject with a light component attached to it.
The sprite shows up fine, however, the halo effect does not work when the GameObject is placed over another sprite (eg a background wall).
I think its a problem with the material (as I have tried other things such as changing the culling mask, ordering layer, etc) - however, I don't know which properties to change in order to make the light visible.
I am using an area light.
I hope I saw correctly your game is 2D. If so, check out 2D Lights

Why the spotlight is turned off no light is coming out?

I have in the scene in the Hierarchy Directional Light added automatic when creating new project. And then I added also a spotlight.
I didn't change or disabled the spotlight just added it to the hierarchy: GameObject > Light > Spotlight
But even if the scene is dark or not the spotlight is like turned off.
Then I went in the editor to the menu to: Window > Lighting > Settings
Not sure 100% what I did but I changed the
Skybox Material to FrameDebuggerRenderTargetDisplay.
Then I changed the Albedo Boost by one value and it made it all dark black.
In the end I got this dark/black scene and still the spotlight is turned off.
My main goal is to make everything black/dark and use the spotlight to light on specific place/area.
But not sure if making this scene dark is the right way and not sure why the spotlight is not showing light at all.
I have on the scene some spheres and a character I want to spotlight on them.
There are can be different issues.
Intensity is not high.
Your player quality settings are not set to fantastic, check it change it(see below image
Your light button may not active in scene (See below image). At the top of the scene view is a button that toggles scene lighting, activate it and you should get the correct lighting.
or your light culling mask set to nothing

Unity build a dark scene with no lights except torch

I want to create a dark scene. The player just got a torch in his hands so this is the only light in the scene.
So the rest of the area should have no lights in it. Maybe it's a cave or a dark forest?
In Pokemon you had this effect in dungeons
Here is a rough sketch how I imagine it
So when I want to set the directional light of the scene to complete black color, you can still see good enough.
How can I archieve these effects of having a dark world?
I don't want to use a texture around the player or something like that. Maybe you can still see through darkness but really really badly.
Use this scene as an example of how to do that:
https://github.com/Galandil74/Unity-Spotlights-Example
Basically, as Lestat already said, you set the overall brightness by changing RenderSettings.ambientLight, then to create the torch effect, you use a directional light game object with a texture cookie in order to illuminate only a portion/shape of the screen.
Remember that to get full illumination through the cookie texture, the light must have its intensity propriety set to 1 - RenderSettings.ambientLight.grayScale (if it's a directional light).
I prefer to use directional light because you can then control the effect via the alpha channel of the cookie texture.
And if you're using sprites (for background, etc.), if you want them to be affected by the ambient light, remember to use the Sprites/Diffuse material.

Reloading a scene through a coroutine changes textures [duplicate]

I completed Unity's roll-a-ball tutorial and it works fine. I changed a couple of materials to make it look better. I also added a C# script that should restart the level when the player falls off of the ground (I disables the walls). I am using Unity 5.5.
It initially looks like this:
But when I go off the edge and the level restarts, it looks like this:
It sometimes looks like this for a few seconds after opening unity when the editor is loading.
Here is the script:
using UnityEngine;
using System.Collections;
public class DeathTrigger : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.CompareTag("Player"))
Application.LoadLevel(Application.loadedLevel);
}
}
Any ideas on what's causing this?
The colors and materials are loaded. This is a lighting problem because lighliting is still calculating in the background. This will likely occur in the Editor only. This should not happen in the build.
Depending on your Unity version, you can fix this by going to Windows --> Lighting --> Settings then go to the Scene tab. Scroll down and disable Auto Generate checkbox then click the Generate Lightning button.
For older version of Unity with no Auto Generate checkbox, see here.
After play with Lighting tools, only one thing should be change on Lighting Setting for every scene.
Window > Rendering > Lighting (Unity 2020)
Click at Environment Tab
At Environment Lighting, change Source from Skybox to Color.
Select white color from Ambient Color.
Done. Try test it.
Before
After
I found many solutions online but I was missing out a step, so I hope this helps.
Most solutions indicated to go to Windows->Lightning, then untick Auto and Click Generate Lighting. My problem was that while I was pressing the generate button I did not have all of my scenes loaded for preview (at least not the scene I had problems with), so it was only applying light generation to the loaded scenes. Make sure all scenes are loaded when generating the lights.
Try Clearing Baked Data if you are using unity version around 5.5
Go to Windows->Lightning->Untick Auto->Now Click dropdown arrow of Build Button which is near Auto(Check Box) -> Select Clear Baked Data.
Now try Your code which looks fine although SceneManager.LoadScene (1); is enough.
Also unloading the previous scene and setting new scene as active scene is a good practice.
This worked for me.
File > Build settings > player Settings > (on the left) Graphics > (Top-Right) gear icon > Reset
I'm a newbie and none of the advice on web helped me. However when I went to Window > Rendering > Lightning > scene tab; If "lightning setting" says “none”, click on it and choose “demo”- setting. Press “generate”.
So it seems like it was missing settings all together which made the scene go dark when loaded.
I encountered the exact same problem. What worked for me was to set Directional Light > Light > Mode to Realtime. (it was Baked, for some reason)
I hope this can help someone in the future.

XNA, WPF light show visualizer

HI all,
I'm developing a software to control light show ( through DMX protocol ), i use C# and wpf to develop my main software (.net 4.0)
To help people preview their show, i would like to make a live 3D visualizer...
First, i thought that i could use wpf 3D to make the visualizer, but i need to work with light ..
My main application should send property ( beam angle, orientation (X,Y), position(X,Y), Brush ( color,shape,effect)) to the 3D visualizer
But i would like to be able to move light (position in the scene) by mouse during execution and had value in return...
So ..
Does XNA is the easiest way to doing that ?
Can you help me for that :
Generating light (orientation , bitmap like filter in front of light )
Dynamically moving object with mouse and get position in return
Dynamically add or remove fixture
All of your advice, sample, example are very welcome ... I don't espect to have a perfect result at the first time but i need to understand the main concepts for doing that
Thank You !!
XNA does not contain any functionality for managing a "scene" - you will have to implement that yourself. For example: you might make a Light class containing the information about your light (position, orientation, etc), and then have a List<Light> of them, which you update and render yourself.
I will now assume that you have a 3D model of a "Light" (as in: the metal box containing the lightbulb) and also a 3D model of a stage. And that you can figure out how to render them - there are plenty of tutorials online for simple model rendering in XNA. Here is a starting point.
So your 3rd requirement ("Dynamically add or remove fixture") should be fairly simple once you can render things. Just add and remove Lights from your List of them based on user input. See the Input namespace.
And your 2nd requirement ("Dynamically moving object with mouse and get position in return") should also be simple. If you want your user to move lights by clicking and dragging, just keep track of the mouse position between frames and apply that as an adjustment to the clicked Light's position (or rotation).
To figure out which Light the user clicks in the first place, a good starting point is the Picking Sample.
I am assuming here that the user will click the Light (metal box) itself to move/rotate it. If you would rather have the user click and drag the endpoint of the light (the spot it projects) - that is more difficult. One idea that comes to mind: Intersect a ray from your Light with the stage to find the centre of the projected spot. At that point draw a dummy "handle" object (like a sphere) that the user can click and drag around. When the user finishes dragging, figure out the new orientation for the Light to make that the new centre.
Finally your 1st requirement ("Generating light (orientation , bitmap like filter in front of light )") is the tricky one. My understanding of this is that you want a way to draw the endpoint of the beam of light on your stage model? If so, what you are looking for is called Projective Texture Mapping. Presumably you will have a circular texture for basic lights, and perhaps other textures for gobos.
The quick-and-dirty way to do this would be to draw your stage model, once for each light, with additive blending (so that each light added with the other lights and the black had no effect), with a colour set to whatever you want the light colour to be, and with a black and white texture (a white circle on black background) drawn with TextureAddressMode.Clamp, with a shader that draws the texture with projective texture mapping which is set up with the light as the projection point.

Categories

Resources