阴影贴图 - 多个来源
我正在考虑编写一些在 DX9 中执行阴影贴图的代码。我仅从一个光源获得阴影贴图的示例代码。来自多个光源的阴影贴图的性能是否可行?我的场景渲染起来非常轻 - 没有纹理,只有几百或几千个顶点。
问题是我的场景发生在太空中,靠近太阳。我打算将太阳创建为一个球体,并将每个顶点渲染为光源 - 这也将为各种科幻太空飞船效果产生一些良好的效果。但通读代码后,我非常担心这会破坏我的性能,而且我不完全确定它会产生我正在寻找的令人难以置信的灯光效果。我在这里是不是太过分了?
I'm looking at writing some code that performs shadow mapping, in DX9. The sample code that I've got only shadow maps from one light source. Is it performance viable to shadow map from more than one light source? My scene is VERY light to render otherwise- there's no textures, and only a few hundred or few thousand vertices.
The trouble is that my scene takes place in space, close to the Sun. I was going to create the Sun as a sphere, and render each vertex as a light source- this was also going to produce some good effects for various sci-fi space-ship effects. But reading through the code, I'm very concerned that this is going to destroy my performance, and I'm not entirely sure that it's going to produce the incredible lighting effects that I'm looking for. Am I just overkilling here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(3)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
渲染每个投射阴影的多个灯光的简单方法是------>
对于循环中的每个光源,执行以下操作::
{
清除屏幕外 RenderTarget 黑色。
仅使用当前灯光渲染场景...在离屏渲染目标上。
然后打开混合(添加、一对一),将离屏渲染目标绘制/覆盖到主后缓冲区上。
渲染完所有
灯光后,呈现场景。因为光线最终只是相加,所以您可以根据需要渲染任意数量的灯光。
无论您是否使用不同的照明,此方法都将起作用。您还可以打开或关闭每个灯光的阴影。
如果其中任何一个不清楚&需要更好的解释让我知道......
An easy way to render multiple lights that each cast shadows is to------>
For Every Light in a loop do the following::
{
Clear a Offscreen RenderTarget black.
Render the scene with the current light only... on the Offscreen RenderTarget.
Then with Blending(Add, One to One) turned on, draw/overlay the Offscreen RenderTarget onto your main backbuffer.
}
After all the lights are rendered, present the scene. Because light is just addition in the end, you can just keep rendering as many lights as you want.
This method will work whether your using differed lighting or not. You can also turn shadows on or off for each light.
If any of this is unclear & needs a better explanation let me know...