English 中文(简体)
Rendering a point light using 6 spot lights?
原标题:

I m trying to render 6 spot lights to create a point light for a shadow mapping algorithm.

I m not sure if I m doing this right, I ve more or less followed the instructions here when setting up my view and projection matrices but the end result looks like this:

alt text

White areas are parts which are covered by one of the 6 shadow maps, the darker areas are ones which aren t covered by the shadowmaps. Obviously I don t have a problem with the teapots and boxes having their shadows projected onto the scene, however as you can see the 6 shadow maps have blindspots. Is this how a cubed shadow map is supposed to look? It doesn t look like a shadowmap of a point light source...

最佳回答

Actually you can adjust your six spots to have cones that perfectly fill each face of your cubemap. You can achieve this by setting each cone s aperture to create a circumscribed circle around each cubemap face. In this case you don t have to worry about overlapping, since the would be overlapping parts are out of the faces area.

In other terms: adjust the lights projection matrix FOV, so it won t the view frustum that includes the light cone, but the cone will include the view frustum.

The a whole implementation see this paper.

问题回答

What you re seeing here are a circle and two hyperbolas -- conic sections -- exactly the result you might expect if you took a double ended cone and intersected it with a plane.

This math may seem removed from the situation but it explains your problem. A spotlight creates a cone of light, and you can t entirely fill a solid space with a bunch of cones coming from the same point. (I d suggest rolling up a bunch of pieces of paper and taping them together at the points to try it out.)

However, as you get far from the origin of your simulated-point-source, the cones converge to their assymptotes, and there is an infinitesimally-narrow gap in the light.

One option to solve this is to change the focus of the cones so that they overlap slightly -- this will create areas that are overexposed, but the overexposure will only become obvious as you get farther away. So long as all of your objects are near the point light source, this might not be much of an issue.

Another option is to move the focus of all of the lights much closer to their sources. This way, they d converge to their assymptotes more quickly.





相关问题
Prerequisite for learning directx

I am from .net C# background and I want to learn DirectX. I have knowledge of C++ but I am fairly new to graphic world. I am little confused about how to start learning directx, should I start ...

How to programmatically disable the auto-focus of a webcam?

I am trying to do computer vision using a webcam (the model is Hercules Dualpix). I know it is not the ideal camera to use, but I have no choice here. The problem is the auto-focus makes it hard/...

Making an object orbit a fixed point in directx?

I am trying to make a very simple object rotate around a fixed point in 3dspace. Basically my object is created from a single D3DXVECTOR3, which indicates the current position of the object, ...

3d Alternative for D3DXSPRITE for billboarding

I am looking to billboard a sun image in my 3d world (directx 9). Creating a D3DXSPRITE is great in some cases, but it is only a 2d object and can not exist in my "world" as a 3d object. What is ...

热门标签