热点科技

标题: 转贴-上古4 FakeHDR(让N卡用户也可以HDR和AA同开!) [打印本页]

作者: hb304030    时间: 2006-12-25 15:06
标题: 转贴-上古4 FakeHDR(让N卡用户也可以HDR和AA同开!)
转贴-上古4 FakeHDR(让N卡用户也可以HDR和AA同开!)
我是什么都不懂的,大家看看就好

原帖链接

http://www3.eastgame.net/read.php?tid=1031207

N卡相对A卡有一个明显的弱点就是不支持HDR和AA同开,所以高人Timeslip(OBMM的作者)开发了FakeHDR这个工具,替代游戏中原有的HDR。FakeHDR的优势是不管是A卡还是N卡都可以和AA同开,当然效果上可能比游戏中原本的HDR差点(其实也不尽然,有人就认为FakeHDR的效果比游戏中原本的HDR更好!

CODE:

//These variables will get set automatically
texture tex1;
texture tex2;
//float2 rcpres;
float CurrentEye;
//float CurrentBrightness;

sampler s0 = sampler_state { AddressU = Clamp; AddressV = Clamp; texture = <tex1>; };
sampler s1 = sampler_state { texture = <tex2>; };

//Use these to modify the behaviour of the dll
bool SinglePixel=false;
bool AffectMenus=false;
int ToggleKey=107;
int ToggleSinglePixelKey=109;
int ToggleAffectMenusKey=106;
float ReactionSpeed=0.95;

//Current Settings
static const float BloomScale = 0.65;
static const float HDRScale = -0.38;
static const float HDRAdjust = -0.10;

//rcpres must be set to the reciprical of your screen resolution
//static const float2 rcpres = { 0.0015625, 0.0020833333333 };    //640x480
//static const float2 rcpres = { 0.00125, 0.0016666666667 };    //800x600
//static const float2 rcpres = { 0.0009765625, 0.0013020833 };    //1024x768
//static const float2 rcpres = { 0.000625, 0.0008333333333 };    //1600x1200
static const float2 rcpres = { 0.00078125, 0.0009765625 };     //1280x1024

float2 PixelKernelH[13] =
{
    { -6, 0 },
    { -5, 0 },
    { -4, 0 },
    { -3, 0 },
    { -2, 0 },
    { -1, 0 },
    {  0, 0 },
    {  1, 0 },
    {  2, 0 },
    {  3, 0 },
    {  4, 0 },
    {  5, 0 },
    {  6, 0 },
};

float2 PixelKernelV[13] =
{
    { 0, -6 },
    { 0, -5 },
    { 0, -4 },
    { 0, -3 },
    { 0, -2 },
    { 0, -1 },
    { 0,  0 },
    { 0,  1 },
    { 0,  2 },
    { 0,  3 },
    { 0,  4 },
    { 0,  5 },
    { 0,  6 },
};

static const float BlurWeights[13] =
{
    0.002216,
    0.008764,
    0.026995,
    0.064759,
    0.120985,
    0.176033,
    0.199471,
    0.176033,
    0.120985,
    0.064759,
    0.026995,
    0.008764,
    0.002216,
};


float4 Bloom( in float2 Tex : TEXCOORD0 ) : COLOR0
{
    float4 Color = tex2D( s0, Tex );
    float tempHDRScale=(0.70*smoothstep(0.00,0.75,CurrentEye))+HDRScale;
    float4 Color2=0;   
    for (int i = 0; i < 13; i++)
    {   
        Color2 += tex2D( s1, Tex + (PixelKernelH*rcpres) ) * BlurWeights;
          Color2 += tex2D( s1, Tex + (PixelKernelV*rcpres) ) * BlurWeights;
    }
    float4 Curvemod = (0.70*Color);
    Color = clamp((0.30*Color)+((0.70-Curvemod+tempHDRScale)*pow(Color,2))+((Curvemod-tempHDRScale)*(1-pow((1-Color),2))),0,1);
    Color2 *= (BloomScale-(0.00*CurrentEye));
    return clamp(Color + Color2,0,1);
}

float4 HDRBrightPass( in float2 Tex : TEXCOORD0 ) : COLOR0
{
    float4 color = tex2D( s0, Tex );
    float tempbright = clamp((0.27*color[1])+(0.67*color[2])+(0.06*color[3]),0,1);
    float HDRAdjustBias = (0.18*pow((1-CurrentEye),3));
    float curvemod = (0.25*tempbright);
    float4 colorbias = (1-pow((1-color),2));
    float4 adjust = clamp(((color-CurrentEye)-HDRAdjust-(HDRAdjustBias)),0,1);
    color = clamp((8*pow(adjust,5)),0,1);
    //color += clamp(tex2D( s1, Tex ) - (2*(CurrentEye + 0.10)) ,0,0.75); //Uncomment this line for retina burn
    color = clamp(((1-curvemod+HDRAdjustBias)*color)+((curvemod-HDRAdjustBias)*colorbias),0,1);
    color.a = 1;
    return color;
}

technique T0
{
    pass p0 { PixelShader = compile ps_2_0 HDRBrightPass(); }
    pass p1 { PixelShader = compile ps_2_0 Bloom();    }
}

作者: dohehe    时间: 2006-12-25 15:08
另一种实现方式的HDR+AA
作者: vicky117    时间: 2006-12-25 15:16
和真正的HDR不能比的。
作者: ucan24    时间: 2006-12-25 15:17
提示: 作者被禁止或删除 内容自动屏蔽
作者: txwang    时间: 2006-12-25 15:20
原帖由 jhj9 于 2006-12-25 15:17 发表


你用过吗?恐怕见都没见过吧?
不知道你这个pro-n知道不知道

上测试吧
作者: bluesky521    时间: 2006-12-25 15:27
原帖由 casper2003 于 2006-12-25 15:20 发表

不知道你这个pro-n知道不知道

上测试吧
上古4我都没下载,无法进行测试
作者: zhihuanbu    时间: 2006-12-25 15:30
原帖由 jhj9 于 2006-12-25 15:27 发表


上古4我都没下载,无法进行测试
你这个pro-n不称职啊
作者: water07    时间: 2006-12-25 15:56
人家有神卡7900GS呢  人家有编写的程序绝对能让79系列支持FP16HDR+AA
作者: jxncayxsbjwjs    时间: 2006-12-25 16:43
原帖由 jhj9 于 2006-12-25 15:17 发表


你用过吗?恐怕见都没见过吧?
放屁。我用的是6600你说我有没有见过
作者: tang3411    时间: 2006-12-25 16:46
原帖由 jhj9 于 2006-12-25 15:17 发表


你用过吗?恐怕见都没见过吧?
不过,仍然要感谢你对我们NVIDIA的支持
作者: zjpjzxk    时间: 2006-12-25 16:46
原帖由 fiorentina 于 2006-12-25 15:54 发表
G80上古4开HDR+AA唯一的问题就是16AA和4AA画质没区别,速度有区别
4X和16XAA低分辨率下没区别,但分辨率越高,AA的倍数要求也越高
作者: tianzdde    时间: 2006-12-25 17:39
This mod adds a fake HDR effect using sm2.0 shaders for us poor unfortunate souls who don't own sm3.0 capable graphics cards. I don't know how it compares to the sm3.0 effect, since I haven't got a sm3.0 card, and can barely run oblivion at all. It will cause a speed hit, but again, I cant compare it to the sm3.0 effect. It does have the major advantage of being completely compatible with AA. You can toggle the shader ingame by hitting the nupmap '+' key. If you need to change this key, download the standard version.

补丁作者的说明
作者: 00414    时间: 2006-12-25 19:26
我的yy





作者: pposs    时间: 2006-12-25 19:29
原帖由 cloudol 于 2006-12-25 19:26 发表
我yy 1280x1024 16x af 16x qaa
看到这个角色感觉好像漫画“大剑”里的组织第1号战士
甲也是黑的
作者: 10241024    时间: 2006-12-26 00:12
意淫
作者: 453565182    时间: 2006-12-26 12:11
有没有PRO-N测试过啊?




欢迎光临 热点科技 (https://itheat.com/activity/) Powered by Discuz! X3.2