티스토리 뷰
파라미터
Tex : Texture2D
UV : float2

float4 luminance = float4(0.30, 0.59, 0.11, 1);
float2 dim;
Tex.GetDimensions(dim.x, dim.y);
float texH = dim.y;
float texW = dim.x;
// TOP ROW
float s11 = dot(Texture2DSample(Tex, TexSampler, UV + float2(-1.0f / texW, -1.0f / texH)), luminance);
float s12 = dot(Texture2DSample(Tex, TexSampler, UV + float2(0, -1.0f / texH)), luminance);
float s13 = dot(Texture2DSample(Tex, TexSampler, UV + float2(1.0f / texW, -1.0f / texH)), luminance);
// MIDDLE ROW
float s21 = dot(Texture2DSample(Tex, TexSampler, UV + float2(-1.0f / texW, 0)), luminance);
float s23 = dot(Texture2DSample(Tex, TexSampler, UV + float2(1.0f / texW, 0)), luminance);
// LAST ROW
float s31 = dot(Texture2DSample(Tex, TexSampler, UV + float2(-1.0f / texW, 1.0f / texH)), luminance);
float s32 = dot(Texture2DSample(Tex, TexSampler, UV + float2(0, 1.0f / texH)), luminance);
float s33 = dot(Texture2DSample(Tex, TexSampler, UV + float2(1.0f / texW, 1.0f / texH)), luminance);
float sobel_h = s11 + (2 * s12) + s13 - s31 - (2 * s32) - s33;
float sobel_v = s11 + (2 * s21) + s31 - s13 - (2 * s23) - s33;
float4 result;
if (((sobel_h * sobel_h) + (sobel_v * sobel_v)) > 0.05)
{
result = float4(0,0,0,1);
}
else
{
result = float4(1,1,1,1);
}
return result;'개발 > Shader' 카테고리의 다른 글
| [Lighting] Volumetric Lighting [자료조사] (0) | 2021.09.22 |
|---|---|
| [HLSL] Smoothness Rectangle Masking (0) | 2021.09.17 |
| [HLSL] Simple Texture Normal (0) | 2021.09.16 |
| [HLSL] Noise - Voronoi Shader (0) | 2021.09.16 |
| [Color Blending] 컬러 블랜딩 공식 (0) | 2021.06.22 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 컴네
- 정리
- 이종식
- #Shader #셰이더 #Tessellator #눈발자국 #발자국
- normal
- 소프트웨어공학
- ImageEffect
- Unreal
- 법선
- 이미지이펙트
- 이미지 효과
- unity
- designer
- shader
- Substance Designer
- 네트워크
- 유니티 셰이더
- 유니티
- ue4
- 블러효과
- HLSL
- 노영태
- 모션블러
- MotionBlur
- 소공
- 인하대
- Substance
- Noise
- 컴퓨터네트워크
- 컴퓨터구조론
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
글 보관함