Shadows for transparent objects

Started by
15 comments, last by Cypher19 18 years, 8 months ago
Hi, Sorry to keep blabbering about Age Of Empires 3 but it has such nice graphics for a RTS! One of the things I wondered was how they did the shadows. Someone here gave me a link to a video with some tech-talk about this game. If I remember right they mentioned they used volumetric shading. Could be true, as the shadows are sharp and received by all surrounding objects (including the grass). The same effect is also visible in Doom3 (lights behind a raster or something). Now I was wondering, how they do volumetric shading for objects with transparent textures? For example, I have a quad with a gate drawn on it. Or what about the leaves of a tree? The silhouette would be a solid square so how to make it 'transparent'? Or are they using a different technique than volumetric shading? Greetings, Rick
Advertisement
i guess you mean shadowmapping. in that case you can render the transparent object using alpha testing (for trees and grass and gates)when rendering the shadowmap
Shadows Volumes (which doom3 uses) doesn't play nice with alpha-tested (ie. fences, leaves) geometry, for obvious reasons. Shadow mapping on the other hand works just fine, as it only depends on actual rendered fragments, not underlying geometry.

IMHO, Doom3 'cheats' with alpha tested grates - they get ignored by the shadow volumes. Instead the level designer manually adds a suitably projected shadow texture. Usually (always?) no moving objects can go between the light and the grate so you can't see this break.

Properly transparent (alpha blended) objects don't tend to work with either method, but thats a whole other problem...
actually you can do alpha blended objects using shadowmapping by rendering a color map as well. but this only works with per-object/per-light shadowmaps not with per -light shadowmaps, unless between the transparent object and the reciever there are no further blockers. of course you could use per-object/per-light shadowmaps for all transparent objects and simple per-light shadowmaps (without color) for everything else. humus has a transparent shadowmapping demo: http://www.humus.ca/index.php?page=3D&ID=39
now realtime caustics, those are really difficult

edit: after looking at humus site again i see that you don't even have to use per-object/per-light shadowmaps
localhost: Humus' demo, while nice, is also not suitable for a general case scenario.

The big problem comes up when you have two translucent objects in a row from each other, in relation to the light. For awhile, one idea I had was to do something like SimmerD's ID-based shadow maps, and do one map for each translucent object in the scene, project that onto the world, and in theory the result would be that they would stack (like HL2's shadow do: http://pcmedia.ign.com/pc/image/halfife2_020904_018.jpg ). In a conversation where I asked him how he 'picks' what shadow map to use in a certain area of the world though, he came up with this, imo, very clever and very practical idea:

Quote:The only ways to do translucent shadow mapping are

a) depth peeling - not practical imo

b) do per-receiver shadow maps.

Each object needs its own unwrapped uv space. You render occluders into the object's receiver texture, using the u,v as the x,y of where to render.

That way each translucent receiver could have its own view of the world. This way you could do properly filtered light as well.

For each translucent receiver, render the light as seen through all objects in between itself and the light - sorting other translucent objects from back to front ( from the receiver's pov ).


I dunno about you guys, but I like that idea!
Nice demo! My trees are pretty static most of the time so a shadowmap could be quite fast I think. I guess I need to make some sort of decal that fits over the terrain with the a tree shadow texture inside. Or does a terrain itself use projective shadows as well?

The nice thing about those shadows in AOE3 is that they also cover other objects. For example, another tree or some grass behind another tree will receive its shadow. A decal with a transparent texture works for the (static)terrain but not for other objects. I guess those objects are using projective texturing. In that case, I wonder how how an object could determine fast with projective texture(s) to use. For example, if a car drives through a forest, it constantly receives shadows. How to check fast which projective shadow(s) to pick?

BTW, if you don't know AOE3, check this out:
http://www.ageofempires3.com/ScreenshotsMedia/ScreenshotView.aspx?ss=Onthebayou_1600x1200.jpg
Its frustrating, I want to have graphics like that as well!

Greetings,
Rick
spek: I think AoE3 uses an entirely shadow map-based system, specifically directional shadows, not per-object shadows. It's certainly not a far cry, as some solutions like TSMs produce extremely high quality shadows at a good framerate. Keep in mind that per-object and projective shadows are very much old technology, and AoE3, like it or not, is a game meant for next-gen cards.
@Cypher19
yes, i noticed that problem as well. the per reciever maps idea could work. another possible solution might be to use a very high res screen-space perspective shadowmap and use screen-door transparency and write color and depth for transparent objects. then you could multisample the shadowing to solve the multiple transparent shadow caster problem. but this would use up quite a lot of memory and the higher number of texture reads would slow things down as well and other problems are likely to appear.
Not to mention the fact that you only have fixed levels of transparency, i.e. 50%, 25%. and effects like volumetric fog are thrown out the window.
couldn't you use projective textureing and shadow mapping to solve this problem? if it's in shadow, find the projective texture s, t and modulate based on that..
I'm not thinking in depth here just throwing out ideas

Tim

This topic is closed to new replies.

Advertisement