游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1760|回复: 2

DOOM 3的渲染问题,熟悉GL的帮忙

[复制链接]

20

主题

473

帖子

502

积分

高级会员

Rank: 4

积分
502
发表于 2004-11-14 00:09:00 | 显示全部楼层 |阅读模式
这几天看了doom3 里的interaction.vfp
发现个问题
在fragment shader 里有这样一段

TEX        localNormal, fragment.texcoord[1], texture[1], 2D;
MOV localNormal.x, localNormal.a;

这一段就是一个简单的bumpmap采样
相当于hlsl里的tex2D
关键在于第2句
我对GLSL是一窍不通,所以想问问这样做什么意思?
为什么要把bumpmap的alpha分量放到x 里去?
我注释掉这一句后,渲染结果果然不正常
这样做有什么意义吗?还是GLSL有这个限制?

6

主题

444

帖子

457

积分

中级会员

Rank: 3Rank: 3

积分
457
发表于 2004-11-14 00:34:00 | 显示全部楼层

Re:DOOM 3的渲染问题,熟悉GL的帮忙

当初尝试修改interaction.vfp的时候似乎没有看到这句,能否把上下几句都贴出来呢?doom3已经被delete掉了。
初步怀疑可能这个不是读取普通的normal map吧,或许是压缩过的?另外呢,这个也不是GLSL吧。只不过是fp罢了。

20

主题

473

帖子

502

积分

高级会员

Rank: 4

积分
502
 楼主| 发表于 2004-11-14 15:23:00 | 显示全部楼层

Re:DOOM 3的渲染问题,熟悉GL的帮忙

# perform the diffuse bump mapping

#-----------------
TEX        light, fragment.texcoord[0], texture[0], CUBE;
MAD        light, light, scaleTwo, subOne;

# instead of using the normalization cube map, normalize with math
#DP3                light, fragment.texcoord[0],fragment.texcoord[0];
#RSQ                light, light.x;
#MUL                light, light.x, fragment.texcoord[0];
#-----------------

TEX        localNormal, fragment.texcoord[1], texture[1], 2D;
MOV localNormal.x, localNormal.a;
MAD        localNormal, localNormal, scaleTwo, subOne;
DP3        light, light, localNormal;

# modulate by the light projection
TXP        R1, fragment.texcoord[3], texture[3], 2D;
MUL        light, light, R1;

# modulate by the light falloff
TXP        R1, fragment.texcoord[2], texture[2], 2D;
MUL        light, light, R1;
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-23 07:20

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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