Archive 19/01/2023.

Urho Light (how to use) - Keep Scene Lighted up from all angles , distances

Jimmy781

Hey Guys ,

I’m fairly new to urho and i’m not really sure how the light works .

I’m using this :

            LightNode = scene.CreateChild("DirectionalLight");
            LightNode.SetDirection(new Vector3(0.6f, -1.0f, 0.8f));
            light = LightNode.CreateComponent<Light>();
            light.LightType = LightType.Directional;

I have a plane -

PlaneNode.Scale = new Vector3(100.0f, 0.0f, 100.0f);

Which i populate with items

My camera is either at the center of the plane (0,0,0) moving right-left or viewing the plane from a top view (0,50,0) rotated downwards.


There are too many shadows and items far away appear black . I would like to keep everything lighted up all the time regardless of my camera position.

i tried playing with the light.intensity but it was making things white completely.

1vanK

use Zone for ambient lighting

Jimmy781

@1vanK - do you have an example ?

I’m not really sure how to add more light

George1

// Create a Zone component for ambient lighting & fog control
Node* zoneNode = scene_->CreateChild(“Zone”);
Zone* zone = zoneNode->CreateComponent();
zone->SetBoundingBox(BoundingBox(-10000.0f, 10000.0f));
zone->SetAmbientColor(Color(0.5f, 0.5f, 0.5f));

zone->SetFogColor(Color(0.4f, 0.5f, 0.8f));
zone->SetFogStart(5000.0f);
zone->SetFogEnd(30000.0f);

//Put large distance for bounding box and the fog thing.