游戏开发论坛

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

求助:texm3x2tex指令部分文档不明白其所指

[复制链接]

8

主题

16

帖子

16

积分

新手上路

Rank: 1

积分
16
发表于 2006-1-23 17:12:00 | 显示全部楼层 |阅读模式
这是DX文档中关于该指令的详细解释:
Here is more detail about how the 3x2 multiply is accomplished.

The texm3x2pad instruction performs the first row of the multiply to find u'.

u' = t(n)RGB * TextureCoordinates(stage m)UVW   //TextureCoordinates(stage m)UVW
                                                                        //指的是什么?因为此指令一般跟bump
                                                                        //map联系起来,而bump map的解释是
                                                                       //利用一个扰动函数对normal进行变动;
                                                                       //bump map 的扰动函数怎么跟  
                                                                       //TextureCoordinates(stage m)UVW
                                                                       //联系起来呢?
                                                                    
The texm3x2tex instruction performs the second row of the multiply to find v'.

v' = t(n)RGB * TextureCoordinates(stage m+1)UVW   


The texm3x2tex instruction samples the texture on stage (m+1) with (u',v') and stores the result in t(m+1).

t(m+1)RGB = TextureSample(stage m+1)RGB using (u', v') as coordinates.

请教,谢谢!


8

主题

16

帖子

16

积分

新手上路

Rank: 1

积分
16
 楼主| 发表于 2006-1-23 17:18:00 | 显示全部楼层

Re:求助:texm3x2tex指令部分文档不明白其所指

个人的理解是:
TextureCoordinates(stage m)UVW其实就是代表扰动函数里面的的2*2矩阵(中的一行)
不知是不是这样理解,请教!

20

主题

473

帖子

502

积分

高级会员

Rank: 4

积分
502
发表于 2006-1-24 11:07:00 | 显示全部楼层

Re:求助:texm3x2tex指令部分文档不明白其所指

texm3x2tex要和texm3x2pad连用
最常见的使用是在计算dot3 bump map里
举个例子好说明
tex  t0 // color map
tex  t1 // normal map
// t2中放light vector in tangent space
// t3中放half vector in tangent space
texm3x2pad  t2, t1_bx2       
//这句执行完了以后, u = dot(t2, t1_bx2), v = dot(t3, t1_bx2)
//也就是u = N.L v = N.H
//其中u,v可以理解为临时寄存器
texm3x2tex  t3, t1_bx2       
//这句执行完后t3.rgb = sample(t3, float2(u,v))
//也就是用刚才得到的u,v作为坐标去采样t3中的贴图,然后存
//入t3.rgb中
//事先做好一个color/specular的查询表贴图设置到tex stage 3中,就可以
//在这里同时得到light diffuse和light specular值
//然后用于下面的其他计算了..
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-23 08:02

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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