Тема: Странное.
Показать сообщение отдельно
Старый 17.12.2011, 23:31   #348
dsd
Мастер
 
Аватар для dsd
 
Регистрация: 13.06.2011
Сообщений: 1,103
Написано 481 полезных сообщений
(для 1,836 пользователей)
Ответ: Странное.



постэффект sepia
// SCENECURRENT semantics is the texture which contains the scene right after the rendering.
// Its size matches the size of the backbuffer.
const texture sceneTexture : SCENECURRENT;

// Texture sampler to get access to texture pixels for shader
sampler sceneSample = sampler_state
{
	// Assing texture to sampler
	Texture   = <sceneTexture>;
	// We always needs clamping for textures
	AddressU  = Clamp;
	AddressV  = Clamp;
	// Linear texture filtering, also you may use "Point" or "None"
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
};

const float3 LUMINANCE_WEIGHTS = float3(0.27, 0.67, 0.06);
const float3 LightColor = float3(1.0,0.9,0.5);
const float3 DarkColor = float3(0.2,0.05,0.0);



// Pixel shader for uv-offset
float4 PSEffect(float2 texCoords : TEXCOORD0) : COLOR
{
	float3 color = tex2D(sceneSample, texCoords).rgb;
	float lum = dot(LUMINANCE_WEIGHTS,color);
	float3 sepia = DarkColor*(1.0-lum) + LightColor*lum;
	return float4(sepia, 1.0f);
}

// Shaders techniques. Shader must contain at least one technique.
technique MainTechnique
{
	// Sequence of technique passes. This passes will performs on stage.
	pass Sepia
	{
		PixelShader	= compile ps_2_0 PSEffect();
	}
}
чернобелое изображение
// SCENECURRENT semantics is the texture which contains the scene right after the rendering.
// Its size matches the size of the backbuffer.
const texture sceneTexture : SCENECURRENT;

// Texture sampler to get access to texture pixels for shader
sampler sceneSample = sampler_state
{
	// Assing texture to sampler
	Texture   = <sceneTexture>;
	// We always needs clamping for textures
	AddressU  = Clamp;
	AddressV  = Clamp;
	// Linear texture filtering, also you may use "Point" or "None"
	MinFilter = Linear;
	MagFilter = Linear;
	MipFilter = Linear;
};

// Pixel shader for uv-offset
float4 PSEffect(float2 texCoords : TEXCOORD0) : COLOR
{
	float3 color = tex2D(sceneSample, texCoords).rgb;
	float grayscale=0.299*color.r+0.587*color.g+0.114*color.b;
	color=float3(grayscale,grayscale,grayscale);
	return float4(color, 1.0f);
}

// Shaders techniques. Shader must contain at least one technique.
technique MainTechnique
{
	// Sequence of technique passes. This passes will performs on stage.
	pass grayscale
	{
		PixelShader	= compile ps_2_0 PSEffect();
	}
}
float4 ToYUV(float2 texCoords : TEXCOORD0) : COLOR
{
	float3 color = tex2D(sceneSample, texCoords).rgb;
	float y  = (0.257 * color.r) + (0.504 * color.g) + (0.098 * color.b);
	float v =  (0.439 * color.r) - (0.368 * color.g) - (0.071 * color.b);
	float u = -(0.148 * color.r) - (0.291 * color.g) + (0.439 * color.b);
	float3 ctr = float3(0.0627,0.5,0.5);
	return float4(float3(y,u,v)+ctr,1.0f);
}
: SCENECURRENT; - Где можно найти полный список семантик хорса? Ибо ни в шагах ни в документации этой не было.

Последний раз редактировалось dsd, 18.12.2011 в 00:35.
(Offline)
 
Ответить с цитированием