游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2740|回复: 3

求在opengl里实现镜面效果的方法

[复制链接]

1

主题

1

帖子

0

积分

新手上路

Rank: 1

积分
0
发表于 2005-3-19 16:24:00 | 显示全部楼层 |阅读模式
也许镜面效果很难实现,似乎很少3D游戏有这种效果(仅记得NFS7有)....
我想过用视点变换,但是考虑到如果镜面之后还有东西的话,将不能实现...
望各位指点!!

2

主题

19

帖子

19

积分

新手上路

Rank: 1

积分
19
发表于 2005-3-20 18:33:00 | 显示全部楼层

Re:求在opengl里实现镜面效果的方法

像Doom3那种的?恐怕有点难

不过像MGS2的那种墙面反光,地面反光都可以通过建立一套墙中的相反模型实现,而且效果也很不错的

190

主题

1801

帖子

2096

积分

金牌会员

Rank: 6Rank: 6

积分
2096
QQ
发表于 2005-3-20 22:59:00 | 显示全部楼层

Re:求在opengl里实现镜面效果的方法

nehe里有个例子

11

主题

97

帖子

206

积分

中级会员

Rank: 3Rank: 3

积分
206
QQ
发表于 2005-3-21 11:22:00 | 显示全部楼层

Re: 求在opengl里实现镜面效果的方法

tjxduck: 求在opengl里实现镜面效果的方法

也许镜面效果很难实现,似乎很少3D游戏有这种效果(仅记得NFS7有)....
我想过用视点变换,但是考虑到如果镜面之后还有东西的话,将不能实现...
望各位指点!!

basiclly  i do like this  
1 Bind a render texture as current render target
2 Load Camera projection matrix
3 Set the reflective view matrix = Camera matrix * Reflection matrix(*Local object matrix)
4 Push the model view matrix, load Mreflview as the current modelview matrix
5 Enable a user clip plane at the mirror surface
6 Invert the primitive culling / winding order
7 Render the entire scene (except the reflect object ?) to the currently bound  render texture
8 Restore the culling / winding order
9 Disable user clip plane
10 Pop the previous model view matrix
11 Bind the framebuffer as render target

镜面之后还有东西的话
dont worry :) as i told you what to do
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-24 21:39

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表