interior shadows and cube maps
by Andy Simon · in Torque 3D Professional · 06/26/2009 (10:57 am) · 6 replies
Hey guys,
Im using a point light inside a building I made and its either I'm not doing something right or the light shadow cast isn't working right. The light bleeds through the geometry even if shadow casting is on or off. Is this a bug or is there something that could be wrong with my model? I exported the model as a collada from 3ds max.
Also I was curious about dynamic cube maps. Lets say I want to enable dynamic cube maps on a window, what needs to be done for this to work? Whenever I set reflections to dynamic cube map, the material just turns black. I thought I read something about dynamic cube maps have to be applied to specific shape types but the post wasn't very clear on that. The building is a TSStatic shape.
thanks for any input!
Im using a point light inside a building I made and its either I'm not doing something right or the light shadow cast isn't working right. The light bleeds through the geometry even if shadow casting is on or off. Is this a bug or is there something that could be wrong with my model? I exported the model as a collada from 3ds max.
Also I was curious about dynamic cube maps. Lets say I want to enable dynamic cube maps on a window, what needs to be done for this to work? Whenever I set reflections to dynamic cube map, the material just turns black. I thought I read something about dynamic cube maps have to be applied to specific shape types but the post wasn't very clear on that. The building is a TSStatic shape.
thanks for any input!
About the author
#2
If you have two surfaces that are tessellated differently next to each other, when their vertices are transformed to paraboloid space their edges will mismatch, since the edge with more subdivisions will follow the curved space better than the one with less, causing a seam to appear between those edges.
So, for best results, make sure all edges that touch each other have the same amount of vertices along them, in the same positions.
06/26/2009 (11:53 am)
Point light shadows use paraboloid projection. This is like a fish-eye projection that maps 180 degrees of view into a spherical map. However, polygons cannot be drawn curved to match the paraboloid space: only the vertex positions are curved, but their edges are still straight lines. If you have two surfaces that are tessellated differently next to each other, when their vertices are transformed to paraboloid space their edges will mismatch, since the edge with more subdivisions will follow the curved space better than the one with less, causing a seam to appear between those edges.
So, for best results, make sure all edges that touch each other have the same amount of vertices along them, in the same positions.
#3
Edit: Use the Shadow Map Viz tool in the editor to take a look at how the paraboloids are treating the geometry around them.
06/26/2009 (11:58 am)
Also, there is behavior difference between single-pass paraboloid (which is a high-speed hack, but will have large shadow artifacts if care is not taken), and regular paraboloid. Cube map shadows should work, but right now they don't yet.Edit: Use the Shadow Map Viz tool in the editor to take a look at how the paraboloids are treating the geometry around them.
#4
06/26/2009 (1:07 pm)
thanks to both of you! I'll take a look at the shadow map tool.
#5
In any case, a dynamic cubemap would not be appropriate for a planar surface like a window. If your window/building was an Interior then you could use the support for planar reflective surfaces (which we also lack an example for atm).
Actually since the plan for Interiors is to basically stop using them and instead internally convert them to regular meshes (for better rendering performance), then at some point soon I may be working on porting the planar reflective surface support currently in Interior to regular meshes (though that sounds really tricky to me).
Ideally, regular Material and ShaderGen would support both dynamic cubemap reflections and planar reflections. And any object that renders using the Material system would be able to have a "reflective" look without requiring any reflection specific code in the class itself.
06/26/2009 (5:02 pm)
Dynamic cubemaps are only designed to work for classes derived from ShapeBase, specifically this is working for StaticShape right now - though you need to use a special CustomMaterial and mapTo.In any case, a dynamic cubemap would not be appropriate for a planar surface like a window. If your window/building was an Interior then you could use the support for planar reflective surfaces (which we also lack an example for atm).
Actually since the plan for Interiors is to basically stop using them and instead internally convert them to regular meshes (for better rendering performance), then at some point soon I may be working on porting the planar reflective surface support currently in Interior to regular meshes (though that sounds really tricky to me).
Ideally, regular Material and ShaderGen would support both dynamic cubemap reflections and planar reflections. And any object that renders using the Material system would be able to have a "reflective" look without requiring any reflection specific code in the class itself.
#6
06/29/2009 (7:41 am)
Thats pretty neat. Well I got the shadows to work considerably better but I'm going to have to clean up the geometry more.
Torque 3D Owner Andy Simon