1
\$\begingroup\$

I would like to know how to properly handle indoor lighting without a directional light. My scene has a room( its some kind of shop), in which the player and ai-agents can move around. I can get good results by placing long area lights at the ceiling and baking the light, and placing light probes so the dynamic objects are also affected by the baked light.

The main problem is how can i get real-time shadows for the player and the ai-agents ?

You could position a few point lights roughly where the center of the area lights would be. But i don't know if i can or even should have so many shadow casting lights in one scene. I tried placing 6 or so and i think only 4 of them would actually cast shadows.

I would really appreciate some help. For this project, i've kind of given up on it but i really want to know. Thank you.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Static lights should use the light map (as they don't change, there is no need to use dynamic resources).

Moving lights, should use some form of real-time shadow mapping, which involves doing a sort of quick bake of a custom light map based on what it can "see". This is done by doing a depth map render before the lighting phase, for each light (spotlights do a single perspective render, directional lights do an orthographic render, and point lights do a cube map render).

Then, during the lighting phase, for each type of light. a shading pass is done which refers to the corresponding shadow map, and decides if the resulting pixel to be shaded is, or is not, in shadow. if it is, then it gets direct light, if not, then it gets nothing, or maybe just a little ambient light.

There are a few techniques out there, so I would recommend googling shadow map techniques, along with shadow volumes, in conjunction with unity, and decided what is possible, and what works best for you, and learning that.

\$\endgroup\$
2
  • \$\begingroup\$ I will definitely look into shadow maps and volumes. At the moment i don't know a lot about rendering and shading but could you explain a bit how this would create realtime-shadows of dynamic objects? \$\endgroup\$
    – dkerm
    Feb 1, 2018 at 17:47
  • \$\begingroup\$ I believe unity has the technology built in, so you had best refer to the unity docs on how to enable shadows. \$\endgroup\$
    – Ian Young
    Feb 2, 2018 at 10:09
0
\$\begingroup\$

You would have to render dynamic lighting and shadowmap for the characters/moving-objects in the first pass, then render your entire scene using your static lightmap/shadowmap and dynamic lightmap/shadowmap together in the second pass.

You can afford to have many point lights if you are only calculating light/shadows from point lights for your dynamic objects.

Also research "deferred lighting". It is a method for rendering a large number of lights with 2 passes.

\$\endgroup\$
2
  • \$\begingroup\$ thank you so much for your answer. Sadly i don't know a lot about rendering, so do not know how to decide what to render or how to make additional passes. What would be the best way to learn about all of that? (just researching rendering in general ?) do you recommend any resources for this whole topic? \$\endgroup\$
    – dkerm
    Feb 1, 2018 at 18:01
  • \$\begingroup\$ @dkerm This Wikipedia article on deferred shading explains the basic concept and has additional links. There are a number of books on realtime rendering. If you search your favorite bookstore for "realtime rendering" you should find them. \$\endgroup\$ Feb 2, 2018 at 4:27

You must log in to answer this question.

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