Visual - B477042/GraduationProject GitHub Wiki
About Visual
Lighting
- Ex) Stage1 ๋ผ์ดํธ ๋ณต์ก๋๋ฅผ ๋ฎ์ถ๊ณ ๊ตฌ์กฐ๋ฌผ๋ค์ Stationary๋ก ์ค์ ํ์ฌ ๋ผ์ดํ ์ ๋ํ ์ต์ ํ๋ฅผ ์งํํ์ต๋๋ค. ๊ตฌ์กฐ๋ฌผ๋ค์ Movable๋ก ์ค์ ํ ๊ฒ๊ณผ ์ฐจ์ด๊ฐ ๋๊ปด์ง์ง ์๊ณ ์ฑ๋ฅ ํฅ์์ ํฐ ๋์์ด ๋์ต๋๋ค.
Material
Material์ ๋ง๋๋ ๊ฒ์ ๊ณต๋ถํ๊ณ ์๋ ์ค์ด๋ผ ์ ๊ฐ ์ง์ ๋ง๋ Material์ ์ ์์ต๋๋ค. ์ธํฐ๋ท์์ Refernece๋ฅผ ์ฐพ์์ ๋ฐ๋ผ ํด๋ณด๋ฉด์ ์ด๋ป๊ฒ ์ ์์ ํ๋ฉด ์ข์์ง ์๊ฐํ๊ฒ ๋์ต๋๋ค.
Post Process
- UE4์ ์ ์์ด๋ ํํ ๋ฆฌ์ผ์ ํตํด ๋ง๋ Material๋ก ์ธ๊ณฝ์ ์ ํํ ํ์ต๋๋ค.
- ์ฒด๋ ฅ์ด ์ค์ด๋ค๋ฉด ํ๋ฉด์ด ์ ์ ๋ณด์ด๋ ํจ๊ณผ๋ฅผ ๊ตฌํํ์ต๋๋ค. ์ฒด๋ ฅ์ ๋ํ ์ ๋ณด๋ฅผ UI๋ฅผ ํตํด ์ ๊ณตํ๊ณ ์์ง๋ง ์ด๋ฐ ํํ์ ํตํด์ ์ฌ์ฉ์์๊ฒ ์ ๋ณด๋ฅผ ์ฃผ๋ ๋ฐฉ๋ฒ์ ์๊ฐํ๊ณ ๊ตฌํํ์ต๋๋ค. Post process๋ฅผ ์ด์ฉํ ๋ฐฉ๋ฒ์ด ๋น์ฉ์ ๋น์ธ๊ธฐ์ ๋น์ฉ์ ์ต์ํ ํ๊ธฐ ์ํด์ C++๋ก ์ ์ด๋ฅผ ํ์ต๋๋ค.
๊ตฌํ
EGPostProcessVolume.cpp
void AEGPostProcessVolume::SyncHpPercent(float ratio)
{
float applyRatio = 1.0f - ratio;
Settings.ColorGamma.W = FMath::Lerp<float, float>(DefaultColorGamma.W,MaxColorGamma.W,applyRatio);
Settings.ColorContrast.W = FMath::Lerp<float, float>(DefaultColorContrast.W, MaxColorContrast.W, applyRatio);
Settings.ColorSaturation.W = FMath::Lerp<float, float>(DefaultColorSaturation.W, MaxColorSaturation.W, applyRatio);
Settings.GrainJitter = FMath::Lerp<float, float>(DefaultGrainJitter, MaxGrainJitter, applyRatio);
Settings.GrainIntensity = FMath::Lerp<float, float>(DefaultGrainIntensity, MaxGrainIntensity, applyRatio);
Settings.VignetteIntensity = FMath::Lerp<float, float>(DefaultVignettelIntensity, MaxVignetteIntensity, applyRatio);
}
Player์ Hp ratio๋ฅผ ๋ธ๋ฆฌ๊ฒ์ดํธ๋ฅผ ํตํด ๋ฐ์ ํ, ๋ฏธ๋ฆฌ ์ค์ ํด๋ ๊ฐ ์ฌ์ด๋ฅผ Lerp๋ฅผ ํตํด ๋ณํ๋ ๊ณผ์ ์ ํํํ์ต๋๋ค.
void AEGPlayerCharacter::BeginPlay()
{
Stat->HPChangedDelegate.AddLambda([this]()->void {
auto World = GetWorld();
if (!World)
{
EGLOG(Error, TEXT("World is null"));
return;
}
//ํ์ฌ hp ๋น์จ์ GameInstance๋ฅผ ํตํด postprocess๋ก ๋๊ฒจ์ค์ ํผ๊ฒฉํจ๊ณผ๊ฐ ๋ํ๋๊ฒ ํด์ค๋ค.
auto GameInstance = Cast<UEGGameInstance>(World->GetGameInstance());
if (!GameInstance)return;
if (GameInstance->GetPostProcessVolume().IsValid())
GameInstance->GetPostProcessVolume()->SyncHpPercent(Stat->GetHPRatio());
});
}
Lambda ํจ์๋ฅผ ํตํด ๋ธ๋ฆฌ๊ฒ์ดํธ๋ฅผ ๋ง๋ค์์ต๋๋ค.
๊ตฌํ์ ์ด๋ ค์ ๋ ์
๊ฐ์ฅ ์ด๋ ค์ ๋ ์ ์ Material์ด์์ต๋๋ค. ์ ๊ฐ ๋จธ๋ฆฟ ์์์ ๊ทธ๋ฆฐ ์ด๋ฏธ์ง๋ฅผ ํํํ๋ ์ ์ด ๊ฐ์ฅ ์ด๋ ค์ ์ต๋๋ค. ์ด๋ฅผ ๊ทน๋ณตํ๊ธฐ ์ํด์ ์ฑ ๊ณผ ์ธํฐ๋ท์์ ์๋ฃ๋ฅผ ๋ชจ์ ๋ฐ๋ผํ๋ฉด์ ์ด๋ป๊ฒ ๋ง๋๋ ๊ฒ์ธ์ง ๋ถ์ํ๋ ค๊ณ ํ์ต๋๋ค. ํ์ง๋ง, ์ ๋์ง ์์์ต๋๋ค. ๋ฏธ์ ์ ์ธ ๊ฐ๊ฐ์ด ๋ถ์กฑํ๊ธฐ ๋๋ฌธ์ธ์ง ์๊ฐ์ด ๋ถ์กฑํ๋ ๊ฑด์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ์์ผ๋ก ๋ ๊ณต๋ถํ๊ณ ๋ง๋ค์ด๋ณด๋ฉด์ ๊ทน๋ณตํ๋ ค๊ณ ํฉ๋๋ค.