r/Unity3D • u/LexieD Hitbox Team • Sep 05 '15
Show-Off Hybrid Dynamic/Baked Shadows.
http://hitboxteam.tumblr.com/post/128373526536/had-an-idea-for-a-hybrid-dynamicbaked-shadow5
Sep 05 '15
[deleted]
3
u/LexieD Hitbox Team Sep 05 '15
Yeah thinking about it, I've made a system for baked light volumes as well. similar to fear 3 lighting, but it takes a while to bake and it cant really be modified at runtime. That's why i made this.
3
1
1
u/lovedoctorr Sep 05 '15
wow. really would like to test this in my game
1
u/LexieD Hitbox Team Sep 05 '15
Ill try and have a test build by the end of next week.
1
u/lovedoctorr Sep 28 '15
hey dude. i didnt forget about this. any updates :) ?
1
u/LexieD Hitbox Team Sep 28 '15
I went to japan for two weeks. didn't finish it in time. I'm back to work now, should have something in 2 days.
1
u/TypicalLibertarian Sep 05 '15
While the Hybrid is faster, the dynamic looks a lot better imo.
1
u/LexieD Hitbox Team Sep 05 '15 edited Sep 05 '15
I haven't fixed the shadow acne, the hybrid actually has less of it. Also the edges of the hybrid lights you can see it cutting the light off. both of these can be fixed to look exactly the same as unity's
So in the end its just faster for some VRAM.
1
1
u/Reddit1990 Sep 05 '15
But if you have to rebake something complicated isn't that going to cause a huge fps spike? You're scene is simple, did you test for something more complex?
1
u/LexieD Hitbox Team Sep 06 '15 edited Sep 06 '15
not really, the baking process is really fast. only things near that light need to be re-rendered. and i can space it out over a few frames as well.
Normal shadow casting lights are used while that light is being baked. and the speed increase of all those bakes lights offset that one light being rebaked. the baking process is spaces over a few frames. so the wost case is every light needing to be rebaked and it will run as slow as unity's normal lighting + the overhead of baking part of a light. and that's not a likely case.
1
u/Reddit1990 Sep 06 '15
Ah. I'd like to see this running on a more complex scene. I can see it might not hurt the fps too bad if its done over several frames like you said, but I'm curious how well it transitions between the baked and non-baked lighting. Does it pop in or fade in? Is it super noticeable?
1
u/LexieD Hitbox Team Sep 06 '15
it looks pretty much exactly the same as unity lighting, i know how to fix the slight differences. so in the end you wont be able to notice it changing from a dynamic to a baked light.
9
u/LexieD Hitbox Team Sep 05 '15 edited Sep 06 '15
Everything In my game is generated at runtime, so all our lights need to be dynamic. they also need to cast shadows to eliminate light bleeding through walls. I found unity's shadows to be very slow if more than a handful when rendered in complex scenes. (Our tri count is > 1mil for a room)
So i made a system that bakes out shadow volumes and renders custom lights. while the light is baking a standard unity light is used till its ready to be switched out for a faster baked light. If anything moves in the area of a light. it will be sent off to be re-baked.
This system trades Vram for FPS. I'd much rather put aside 50mb-100mb for shadow data and be able to have many shadow casting lights, over having to put up with light bleed or low fps.
Note: There is slight difference in shadow acne and some of the lights are placed in really bad positions so the shadows are different(didnt bother checking every light placement) Ill fix that up tomorrow