SgW32 Четверг, 25.04.2024, 17:54
Главная | Регистрация | Вход Приветствую Вас Гость | RSS
Меню сайта

Разделы новостей
Уязвимости [106]
Релизы [7]
Туториалы [0]
Новости сайта [2]
Инетересности [2]
Другое [1]

Наш опрос
Каких программ на сайте не хватает?
Всего ответов: 72

Главная » 2012 » Январь » 10 » Шейдер виньетирования
Шейдер виньетирования
20:03

В интернете нашёл только на HLSL, и переписал на CG.

Модельки из HL2 и Metro 2033. 

(на скринах есть ещё ссао и блум) 

Для Ogre3d

vignetting.cg:

sampler RT : register(s0);

float4 main_ps(float2 iTexCoord : TEXCOORD0,
uniform float radius,
uniform float darkness) : COLOR
{
float4 color=tex2D(RT,iTexCoord);
float2 inTex = iTexCoord - 0.5;
float vignette = 1 - dot(inTex, inTex);
color.rgb *= saturate(pow(vignette, radius) + darkness);
return color;
}

fragment_program Vignetting cg
{
source vignetting.cg
entry_point main_ps
default_params
{
param_named radius float 4
param_named darkness float 0.7
}
profiles ps_2_x arbfp1
}

material Ogre/Compositor/Vignetting
{
technique
{
pass
{
depth_check off

vertex_program_ref Ogre/Compositor/StdQuad_Cg_vp
{
}

fragment_program_ref Vignetting
{
}

texture_unit RT
{
tex_coord_set 0
tex_address_mode clamp
filtering linear linear linear
}
}
}
}


compositor vignetting
{
technique
{
texture rt0 target_width target_height PF_R8G8B8

target rt0 { input previous }

target_output
{
// Start with clear output
input none

pass render_quad
{
material Ogre/Compositor/Vignetting
input 0 rt0
}
}
}
}





Категория: Инетересности | Просмотров: 1300 | Добавил: Sgw32 | Рейтинг: 0.0/0 |
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Форма входа

Календарь новостей
«  Январь 2012  »
ПнВтСрЧтПтСбВс
      1
2345678
9101112131415
16171819202122
23242526272829
3031

Поиск

Друзья сайта

    Integral Calculator
    Enter a function to integrate:

    Variable:

    Limit Calculator
    Enter a function to compute its limit:
    Limit variable: Compute at: Limit type

Статистика

Copyright Sgw32 Corporation © 2024 Используются технологии uCoz