Unreal - Radial Blur 기법 (신속 블러)

2025. 4. 22. 22:19·Unreal5 프로젝트 다이어리

일자베기 스킬이 너무 심심해서 RadialBlur를 추가해서

조금더 신속한 느낌을 추가해보도록 하겠습니다

중심점(Radial center)에서 바깥 방향으로 뿌옇게(blur) 퍼지는 효과입니다

 

먼저 메테리얼을 만들어줍니다

메테리얼을 Post Process로 변경합니다

Scene Texture을 만들고 씬 텍스쳐의 아이디를 PostProcessInput0로 변경해줍니다

Mask노드를 생성 R, G, B에 체크해줍니다

2번 ScreenPosition node를 꺼내고 UVS노드와 연결

3번 Lerp 노드를 꺼냅니다

4번 RadicalGradientExponential노드를 꺼냅니다

5번 ScreenAlignedUVS노드 꺼내고 UVS와 연결

6. ScalarParameter 노드를 꺼내고 Radius와 연결

7. 값을 1로 변경해줍니다

 

1. Scalar Parameter 이름을 Blur Radius로 변경

2. Scalar Parameter 노드를 생성후 Density로 이름을 변경

3. 1-x 노드를 꺼내고 연결한다음 Density에 연결 그리고 Lerp와의 연결을 해줍니다

4. Custom Node를 꺼냅니다

const float2 ScreenMult = View.ViewSizeAndInvSize.xy * View.BufferSizeAndInvSize.zw;

const int TexIndex = 14;
const float Samples[11] = {-0.08,-0.05,-0.03,-0.02,-0.01,0,0.01,0.02,0.03,0.05,0.08};

float2 dir = float2(0.5,0.5) - ScreenUV;
float4 sum = float4(0.0, 0.0, 0.0, 0.0);
for(int i = 0; i<11; i++)
{
float2 pos = ScreenUV + dir * Samples[i] * BlurDist;
pos = clamp(pos, float2(0.0,0.0), float2(1.0, 1.0));
sum += SceneTextureLookup(pos * ScreenMult, TexIndex, false);
}

return sum / 11.0;

 

커스텀 노드를 복사합니다

1. 커스텀노드를 복사후 넣어줍니다

2. 배열 엘리먼트를 추가합니다

3-4. 인덱스0을 BlueDist , 인덱스1을 ScreenUV 로 세팅해줍니다

(해당 스펠링은 정확하게 커스텀 노드와 스펠링(이름)이 같아야합니다)

1. 스칼라 파라미터 노드를 생성 이름을 Blur로 설정후 값을 1로 주고 Blur Dist쪽과 연결

2. 나머지 노드들을 해당 그림처럼 연결해줍니다

3. Density노드를 디폴트값을 4로 변경해줍니다

해당 메테리얼을 머티리얼 인스턴스로 생성해줍니다

맵에 만약 포스트 프로세스 볼륨이 없다면 추가해줍니다 (맵에 존재해야 작동합니다)

포스트프로세스의 적용범위를 맵 전체에 적용하기위해 Infinite Scale 무한규모에 체크해줍니다

렌더링기능 > 포스트 프로세스 머티리얼을 추가해줍니다

배열을 추가후 아까만든 포스트프로세스를 추가해줍니다

메테리얼 인스턴스의 Density값을 수정하면 블러의 값을 수정가능합니다

그러면 해당 블러를 사용할 함수를 만들어보겠습니다

 

계속 적용되어있으면 눈이 너무 아프니 잠시 뺴주도록 하겠습니다

필요한 헤더 추가해줍니다

블러를 소환시킬함수 숨길함수 그리고 필요한 메테리얼 인스턴스를 선언합니다

void ASwordCharacter::StartRadialBlur()
{
	if (radialBlurMaterialInstance)
	{
		for (TActorIterator<APostProcessVolume> psIt(GetWorld()); psIt; ++psIt)
		{
			APostProcessVolume* postProcessVolume = *psIt;
			if (postProcessVolume)
			{
				//blending list setting!
				TArray<FWeightedBlendable>& blendables = postProcessVolume->Settings.WeightedBlendables.Array;

				// if insert no add
				bool alreadyAdded = false;
				for (const FWeightedBlendable& blendable : blendables)
				{
					if (blendable.Object == radialBlurMaterialInstance)
					{
						alreadyAdded = true;
						break;
					}
				}
				if (!alreadyAdded)
				{
					if (blendables.Num() >= 1)
					{
						blendables.Insert(FWeightedBlendable(1.0f, radialBlurMaterialInstance), 1);
					}
					else
					{
						blendables.Add(FWeightedBlendable(1.0f, radialBlurMaterialInstance));
					}
				}
			}
		}
	}
}
void ASwordCharacter::EndRadialBlur()
{
	if (radialBlurMaterialInstance)
	{
		for (TActorIterator<APostProcessVolume> psIt(GetWorld()); psIt; ++psIt)
		{
			APostProcessVolume* postProcessVolume = *psIt;
			if (postProcessVolume)
			{
				TArray<FWeightedBlendable>& blendables = postProcessVolume->Settings.WeightedBlendables.Array;

				// remove!
				for (int32 i = blendables.Num() - 1; i >= 0; --i)
				{
					if (blendables[i].Object == radialBlurMaterialInstance)
					{
						blendables.RemoveAt(i);
					}
				}
			}
		}
	}
}

포스트프로세스를 iterator로 월드상에서 찾고 찾은 포스트프로세스에서 블렌드리스트에서 radialBlurMaterialInstance

를 추가하거나 삭제하는 코드입니다

이미 배열에 추가가 되어있다면 추가를 하지않고 없으면 추가합니다

삭제는 RemoveAt함수를 사용합니다

radialBlurMaterialInstance에 제가 만든 메테리얼 인스턴스를 할당 꼭 해줍니다

 

애님인스턴스에서 노티파이를 만들고 호출해줍니다

노티파이까지 찍어주면됩니다

결과물

'Unreal5 프로젝트 다이어리' 카테고리의 다른 글

Unreal - 원형 프로그래스바(ProgressBar) 만들기  (0) 2025.04.24
Unreal - Ghost Trail(고스트 트레일) 잔상  (0) 2025.04.23
Unreal - 대쉬 공격 만들기 (Sweep 처리방식)  (0) 2025.04.22
Unreal - 어색한 충돌 처리 해결하기  (0) 2025.04.21
Unreal - 공중 공격 - (2)  (0) 2025.04.20
'Unreal5 프로젝트 다이어리' 카테고리의 다른 글
  • Unreal - 원형 프로그래스바(ProgressBar) 만들기
  • Unreal - Ghost Trail(고스트 트레일) 잔상
  • Unreal - 대쉬 공격 만들기 (Sweep 처리방식)
  • Unreal - 어색한 충돌 처리 해결하기
lucodev
lucodev
커피와 노트북 그리고 개발
  • lucodev
    루코 개발테이블
    lucodev
  • 전체
    오늘
    어제
    • 분류 전체보기 (121) N
      • Unreal5 프로젝트 다이어리 (73)
      • Unreal5 프로젝트 다이어리2 (3) N
      • Unreal 팁 (8)
      • Unreal 디버깅 (8)
      • C++ 프로그래머스 다이어리 (21)
        • Stack (3)
        • Hash (4)
        • Heap (2)
        • Sort (1)
      • 코드 개인보관함 (8) N
  • 인기 글

  • 최근 글

  • 최근 댓글

  • 링크

  • 공지사항

  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 태그

    unreal sequence
    unreal loading
    unreal 모션매칭
    언리얼 motionmatching
    언리얼 모션매칭
    언리얼 foot step
    언리얼 시퀀스
    언리얼 컷씬
    언리얼 로딩
    unreal 로딩
    언리얼
    언리얼 비헤이비어트리
    언리얼 페이드 아웃
    unreal 컷씬
    언리얼 behavior tree
    언리얼 behaviortree
    unreal look at
    언리얼 로딩창
    언리얼 look at
    unreal 시퀀스
  • hELLO· Designed By정상우.v4.10.3
lucodev
Unreal - Radial Blur 기법 (신속 블러)
상단으로

티스토리툴바