OpenGL.Tutorial16_ShadowMapping

Posted cppskill

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenGL.Tutorial16_ShadowMapping相关的知识,希望对你有一定的参考价值。

1、

2、

In Tutorial 15 we learnt how to create lightmaps, which encompasses static lighting. While it produces very nice shadows, it doesn’t deal with animated models.

Shadow maps are the current (as of 2016) way to make dynamic shadows. The great thing about them is that it’s fairly easy to get to work. The bad thing is that it’s terribly difficult to get to work right.

In this tutorial, we’ll first introduce the basic algorithm, see its shortcomings, and then implement some techniques to get better results. Since at time of writing (2012) shadow maps are still a heavily researched topic, we’ll give you some directions to further improve your own shadowmap, depending on your needs.

Basic shadowmap

The basic shadowmap algorithm consists in two passes. First, the scene is rendered from the point of view of the light. Only the depth of each fragment is computed. Next, the scene is rendered as usual, but with an extra test to see it the current fragment is in the shadow.

The “being in the shadow” test is actually quite simple. If the current sample is further from the light than the shadowmap at the same point, this means that the scene contains an object that is closer to the light. In other words, the current fragment is in the shadow.

The following image might help you understand the principle :

3、

4、

5、

 

以上是关于OpenGL.Tutorial16_ShadowMapping的主要内容,如果未能解决你的问题,请参考以下文章

Arcball轨迹球

Unity5 BakeGI(Mixed Lighting)小记

“typedef __u16 __bitwise __le16;”是啥意思?在Linux内核中是啥意思?

在 int 上使用 __int16(或 int16_t)的优点/缺点

线性 PCM 16 位到 8 位

可分解环的表示