根据我的理解,要在OpenGL中镜像,基本上是画场景,然后翻转所有的东西,然后再画一次,除了使它通过镜子可见外,从而在镜子中创建一个完美的翻转图像。但我看到的问题是,当这样做时,唯一能看到其他镜像的镜像是在前面的镜像之后呈现的镜像。因此,如果我呈现镜像1然后镜像2,镜像1不能看到镜像2,但是镜像2可以看到镜像1。如何有效地镜像镜像而不发生呢?
发布于 2013-12-11 08:57:53
有两种常见的方法可以将反射呈现为多个/递归反射.

- [http://www.bonzaisoftware.com/tnp/gl-water-tutorial/](http://www.bonzaisoftware.com/tnp/gl-water-tutorial/) (overkill for planar reflections, but quite related)
- [http://ivanleben.blogspot.com.au/2008/03/water-reflections-with-opengl.html](http://ivanleben.blogspot.com.au/2008/03/water-reflections-with-opengl.html)
- [http://renderingwonders.wordpress.com/2011/01/03/chapter-08-%E2%80%93-buffer-objects-storage-is-now-in-your-hands-%E2%80%93-fbo-textures/](http://renderingwonders.wordpress.com/2011/01/03/chapter-08-%E2%80%93-buffer-objects-storage-is-now-in-your-hands-%E2%80%93-fbo-textures/)
- [http://cgvr.cs.uni-bremen.de/teaching/cg\_literatur/Cube\_map\_tutorial/cube\_map.html](http://cgvr.cs.uni-bremen.de/teaching/cg_literatur/Cube_map_tutorial/cube_map.html)

(关于单反射模板缓冲区的使用有很多页面,但这不是您想要的,所以我不想列出一些)
- [http://en.wikibooks.org/wiki/OpenGL\_Programming/Mini-Portal](http://en.wikibooks.org/wiki/OpenGL_Programming/Mini-Portal)
- [http://en.wikibooks.org/wiki/OpenGL\_Programming/Mini-Portal\_Recursive](http://en.wikibooks.org/wiki/OpenGL_Programming/Mini-Portal_Recursive)
- [http://www.fairyengine.com/articles/portals.htm](http://www.fairyengine.com/articles/portals.htm)
- [http://www.benjaminklingler.com/portal-rendering.html](http://www.benjaminklingler.com/portal-rendering.html)
*请注意,这些链接只是几分钟谷歌搜索的结果。请随意编辑和删除/添加。
发布于 2013-12-11 08:57:03
最简单的方法是使用模具缓冲区。看看这个页面。
其基本思想是:
如果你有反射镜,你必须做所有可能的组合(首先渲染镜子1,然后在镜像1的反射中镜像2,然后在原始场景中呈现镜像2,然后在镜像2的反射中呈现1的反射,等等)。
你不能用这个算法做无限镜像反射(只有有限的反射量)。只有射线追踪才能做到这一点。
https://stackoverflow.com/questions/20511599
复制相似问题