Wednesday, August 26, 2009

Shadows




Faked AO shadows off of objects using no extra texture or render passes, just oldschool trickery.

10 comments:

Anonymous said...

this is looking really nice now. Can't wait to play. Keep it up.

Mike said...

Are the shadows baked in or are you using some other trickery?

Kristopher Peterson said...

I'm using blob shadows that have been scaled to roughly fit the shape of the objects. They get batched dynamically on the iphone.

Benoit FOULETIER said...

Blob shadows are batched... okay... but I *thought* projectors lead to a second render of the object projected on (see Aras' comment: http://forum.unity3d.com/viewtopic.php?p=173386#173386)... so won't you get one massive draw call for the whole scene?

I'm guessing baked shadows would make the levels bigger due to the extra lightmap, and you probably don't want that on the iPhone, but are you sure it's better in terms of performance?

Kristopher Peterson said...

@Ben,

That's true that projectors cause a second drawcall for each of the objects being projected on. The shadows here are just planes mapped with a multiply texture, there's no projection going on.

Mike said...

Slightly off topic, but how did you get the new Unity 2.6 x/y/z widget for an iPhone game? I'm jealous.

Do you lay your shadows out while modeling or do you do it procedurally? If while modeling, do you use simple quads and then UV map portions of an image or do you shape the plane like the object and use a single, small texture scaled to fit?

Sorry about all the questions. I love the way Revolt looks and have learned a lot just by looking at the images and trying to emulate them for practice. I also had a question about how you did those awesome looking 'god ray' lights over http://revoltgame.blogspot.com/2009/12/shot1.html if you don't mind sharing...

Kristopher Peterson said...

@Mike,

I do all level layout and object placement in Unity 2.6 and then just export packages to bring into the iPhone version.

For the shadows, I just duplicate a blob shadow and add it to each of my object prefabs, scaling it to fit.

Benoit FOULETIER said...

Thanks for the "quad shadow" tip Kris, I've been thinking about doing that for our "zombie slicing" game (http://blog.gamepulp.com/tag/zombie-shooter), AO is indeed sorely missed!
Don't you have any z-fighting issues though? How far away do you put the quads?

Regarding the 2.6-to-iPhone workflow, packages sound awful, do yourself a favor and get an asset server license! I personally have 2 copies of the same project, one for 2.6 and one for iPhone, often both editors are open at the same time, no problem whatsoever. I do most of the work on 2.6, then just commit back and forth when I must test on the device, compute occlusion culling, etc...
Our LDs work exclusively with 2.6, I'm actually the only one in the office with a Unity iPhone license (only one with a Mac, even).

Benoit FOULETIER said...

@Kris: the lighting effect in the thread you mention seems well explained to me: create a cylinder mesh with a few segments along the length, then assign colors to each ring of vertex, going from translucent blue to completely transparent; then use a vertex-color-able shader (particle multiply?), no need for a texture... voilĂ !
Does that sound right?

Kristopher Peterson said...

@Ben,

The zombie shooter is looking great...nice implementation of the ragdoll reaction overlay on the animation.

The package pipeline has been working out well enough.

Yes, many of the particle shaders support vertex color and alpha.