x


Dynamic lights with a raycast

Hey Guys,

I am new here(also new to unity)

Let me first explain what I am working on so you can understand the context of what I am trying to achieve.

What I use: Unity Pro 3.4.2 City Engine Some other external packages.

My game: I am building a whole dynamic city(GTA style). The city will "live" with loads of people who go around their lives(For example: Eat, sleep, word, get fired, etc) This is still being worked on.

For the moment I am working on the GFX of the city itself. I already have the city itself(buildings, streets)a dynamic night/day cycle and a fully dynamic weather system(volumetric clouds) and dynamic shadows of the sun.

At night, I want the city to turn on its (dynamic) streetlights(MAANY LIGHTS), this takes down the performance of the game very very heavily. So what I would like to do is some kind of LOD system where lights turn on when the player gets within the xx radius of a light and turn off when they are outside a certain radius of the player.

Seeing how I want the lights to drop dynamic shadows on objects around the city I do not want it lightmapped.

I hope this will make performance much better.

Can anyone help me achieve this?

PS, Isn't it supposed to be possible to get dynamic shadows with point and spot lights in the latest unity? Somehow they don't. PPS, I am fairly new with unity, so please consider that!

more ▼

asked Dec 14 '11 at 04:02 PM

PuttPutt gravatar image

PuttPutt
1 3 3 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Solved!

By using a custom var to check for the distance between the main camera and the light(s) (linecast) and when the distance is shorter than xx meters, the command:

light.enabled = true;

else

light.enabled = false;

more ▼

answered Dec 19 '11 at 10:53 PM

PuttPutt gravatar image

PuttPutt
1 3 3 3

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1526
x231
x86

asked: Dec 14 '11 at 04:02 PM

Seen: 757 times

Last Updated: Dec 19 '11 at 10:53 PM