im having issues with diretional light shadow casting.
my directional light is at world origin but the shadows it casts are not, is there a way to move where the shadows are cast?
in this image i have set the lighting so its easier to see what i mean
For a directional camera, the position doesn’t matter. The light is even shone in a direction across the whole scene.
Not 100% sure what you are looking to do?
Just a note, if you are using lightmaps in editor and you are making changes to your geometry / light settings, you may want to enable Auto Rebake. That will ensure that lightmaps are getting generated and rendered in editor.
auto rebake is on.
it is a directional light not camera.
i want the shadows area to be cast at the world origin not where it is
to move the lit area to the outlined area
Sorry, typo. I meant to say light.
Directional lights is an even light across the whole scene.
If you want shadows only in particular area, it has to be a positional light such as a spotlight.
we want the light to be cast over the whole scene, but due to the size we have to reduce the area which shadows are cast to keep resolution. (the distance modifier)
i set the lighting to show where the shadows are being cast to.
when the final lighting is set up it will be cast across the whole scene.
but as it is the shadows only appear in the lit area.
appologies if im not clear about what i need
i need to move the area where the shadows appear to the world origin where the cameras are
One solution to do that would be instead of using lightmaps, use realtime shadows and set their update mode to Once.
Now realtime shadows will always be rendered from the camera point of view up to a distance. So each time you move your camera in place, you can update the shadows once, in code.
We’ve done something similar on this site, after each camera animation, the shadows are updated to reflect the new position of the camera and target a single place of the world:
is realtime shadows the dynamic option?
and with a complicated scene would that affect performance?
and i dont understand what determins the area shadows are cast to by a directional light
Both realtime shadows and lightmap shadows use the same rendering pipeline, the end visual result will be mostly the same (depending on the selected shadows resolutions).
The difference is where the shadows are rendered:
- With dynamic shadows (either rendered once or in realtime, per frame), the shadows are rendered in an area starting from the active camera point of view up to a distance (shadowDistance).
- With lightmapped shadows, the engine on application start will render shadows for all models affected by a lightmapped light. It will split the area in segments to ensure the shadows resolution is sufficient and render all affect models.
The performance for dynamic shadows when their shadow update mode is set to once depends on the number of models rendered / polycount and shadows resolution but I’d say it can be quite ok for many use cases.
You can easily test it using the profiler if it’s ok for your application by using the update shadows button:
ok thankyou for helping, our programmer is busy for the next few days, but i will update you with how it turns out.
i have found out how to move the light cast area.
one of the meshes in the scene will be the light origin point,
you can move it to make the light in the right place and then lower it until its hidden.
in our case it was a tree.
how can i change the title to include (solved)