UE5 Guid Page : https://docs.unrealengine.com/4.27/ko/RenderingAndGraphics/Niagara/Overview/

기본 구성

  • 나이아가라 시스템 
    [1] Attribute(Parameter) → [5] Detail(argument) 직접 대응 가능 ( 드래그 ) 나
  • 나이아가라 그룹 모듈

 

기본 구조

Niagara System

  • Overview Node ( system manager )
  • Emitter ( include [Items] )
    • Properties
    • Render
    • Stages ( Emt Sapwn / Emt update / Ptc Spawn / Ptc Update )
      • Module 
        • Parameter
          • Owner : Engine / System / Emitter / Particles / Stage transient / module output
          • Type
            • Primitive : 일반 변수타입
            • Enum
            • Struct
            • Data Interface : 외부 데이터소스 ( api, datatable등 )
      • Additional Stage
        • Events ( → Event Handler )
        • Simulation Stage

 

Niagara Module Flow

  • GetMap(get Params value) → Adjust Action → SetMap(set Params value)
    • module node based on bool / basic math / trigonometric / etc

 

Event and Event Handler

  • Concept : interaction between [Niagara Emitters] ( UE _ 이벤트 및 이벤트 핸들러 개요 )
  • Note
    • 이벤트는 현재 GPU 시뮬레이션과는 함께 작동하지 않고 CPU 시뮬레이션과만 함께 작동합니다.
    • 이벤트를 사용하려면 해당 이미터의 Emitter Properties(이미터 프로퍼티)에서 Requires Persistent IDs(퍼시스턴트 ID 필요)를 활성화해줘야 합니다.
    • 우선 콜리전(Collision) 모듈을 이미터에 추가해야 콜리전 이벤트 생성(Generate Collision Event) 을 해당 이미터에 추가할 수 있습니다. 이렇게 하면 이미터의 파티클이 월드의 오브젝트와 충돌할 수 있게 됩니다.
  • Flow
    EventHandler

     

    • in receive emitter
    • select specific [generate module] in detail pannel
    EventHandler
    • same type with [generated event]
  • Event
    • Particle Spawn/Update에서 Event module 추가
      • input param
  • MechanismNiagara System
    • Overview Node ( system manager )
    • Emitter ( include [Items] )
      • Properties
      • Render
      • Stages ( Emt Sapwn / Emt update / Ptc Spawn / Ptc Update )
        • Module 
          • Parameter
            • Owner : Engine / System / Emitter / Particles / Stage transient / module output
            • Type
              • Primitive : 일반 변수타입
              • Enum
              • Struct
              • Data Interface : 외부 데이터소스 ( api, datatable등 )
        • Additional Stage
          • Events ( → Event Handler )
          • Simulation Stage

    • GetMap(get Params value) → Adjust Action → SetMap(set Params value)
      • module node based on bool / basic math / trigonometric / etc

    • Concept : interaction between [Niagara Emitters] ( UE _ 이벤트 및 이벤트 핸들러 개요 )
    • Note
      • 이벤트는 현재 GPU 시뮬레이션과는 함께 작동하지 않고 CPU 시뮬레이션과만 함께 작동합니다.
      • 이벤트를 사용하려면 해당 이미터의 Emitter Properties(이미터 프로퍼티)에서 Requires Persistent IDs(퍼시스턴트 ID 필요)를 활성화해줘야 합니다.
      • 우선 콜리전(Collision) 모듈을 이미터에 추가해야 콜리전 이벤트 생성(Generate Collision Event) 을 해당 이미터에 추가할 수 있습니다. 이렇게 하면 이미터의 파티클이 월드의 오브젝트와 충돌할 수 있게 됩니다.
    • Flow
      EventHandler
      • in receive emitter
      • select specific [generate module] in detail pannel
      EventHandler
      • same type with [generated event]
    • Event
      • Particle Spawn/Update에서 Event module 추가
        • input param
    • MechanismNiagara System
      • Overview Node ( system manager )
      • Emitter ( include [Items] )
        • Properties
        • Render
        • Stages ( Emt Sapwn / Emt update / Ptc Spawn / Ptc Update )
          • Module 
            • Parameter
              • Owner : Engine / System / Emitter / Particles / Stage transient / module output
              • Type
                • Primitive : 일반 변수타입
                • Enum
                • Struct
                • Data Interface : 외부 데이터소스 ( api, datatable등 )
          • Additional Stage
            • Events ( → Event Handler )
            • Simulation Stage

      • GetMap(get Params value) → Adjust Action → SetMap(set Params value)
        • module node based on bool / basic math / trigonometric / etc

      • Concept : interaction between [Niagara Emitters] ( UE _ 이벤트 및 이벤트 핸들러 개요 )
      • Note
        • 이벤트는 현재 GPU 시뮬레이션과는 함께 작동하지 않고 CPU 시뮬레이션과만 함께 작동합니다.
        • 이벤트를 사용하려면 해당 이미터의 Emitter Properties(이미터 프로퍼티)에서 Requires Persistent IDs(퍼시스턴트 ID 필요)를 활성화해줘야 합니다.
        • 우선 콜리전(Collision) 모듈을 이미터에 추가해야 콜리전 이벤트 생성(Generate Collision Event) 을 해당 이미터에 추가할 수 있습니다. 이렇게 하면 이미터의 파티클이 월드의 오브젝트와 충돌할 수 있게 됩니다.
      • Flow
        EventHandler
        • in receive emitter
        • select specific [generate module] in detail pannel
        EventHandler
        • same type with [generated event]
      • Event
        • Particle Spawn/Update에서 Event module 추가
          • input param
      • MechanismNiagara System
        • Overview Node ( system manager )
        • Emitter ( include [Items] )
          • Properties
          • Render
          • Stages ( Emt Sapwn / Emt update / Ptc Spawn / Ptc Update )
            • Module 
              • Parameter
                • Owner : Engine / System / Emitter / Particles / Stage transient / module output
                • Type
                  • Primitive : 일반 변수타입
                  • Enum
                  • Struct
                  • Data Interface : 외부 데이터소스 ( api, datatable등 )
            • Additional Stage
              • Events ( → Event Handler )
              • Simulation Stage

        • GetMap(get Params value) → Adjust Action → SetMap(set Params value)
          • module node based on bool / basic math / trigonometric / etc

        • Concept : interaction between [Niagara Emitters] ( UE _ 이벤트 및 이벤트 핸들러 개요 )
        • Note
          • 이벤트는 현재 GPU 시뮬레이션과는 함께 작동하지 않고 CPU 시뮬레이션과만 함께 작동합니다.
          • 이벤트를 사용하려면 해당 이미터의 Emitter Properties(이미터 프로퍼티)에서 Requires Persistent IDs(퍼시스턴트 ID 필요)를 활성화해줘야 합니다.
          • 우선 콜리전(Collision) 모듈을 이미터에 추가해야 콜리전 이벤트 생성(Generate Collision Event) 을 해당 이미터에 추가할 수 있습니다. 이렇게 하면 이미터의 파티클이 월드의 오브젝트와 충돌할 수 있게 됩니다.
        • Flow
          EventHandler
          • in receive emitter
          • select specific [generate module] in detail pannel
          EventHandler
          • same type with [generated event]
        • Event
          • Particle Spawn/Update에서 Event module 추가
            • input param
        • Mechanism
      • Event and Event Handler
      • Niagara Module Flow
    • Event and Event Handler
    • Niagara Module Flow
  • Event and Event Handler
  • Niagara Module Flow

 

나이아가라 파라미터

  • 시각화

 

  • 파라미터 리스트
    1. System Attributes
      1. System : 해당 [나이아가라 시스템]의 attribute ( set active시 초기화 )
        1. Age ( float ) : 생성 후 경과 시간
        2. bCompoleteOnInactive ( bool ) : ?
        3. CurrentLoopDuration ( float ) : 설정된 루프 길이
        4. ExecutionState ( enum )
          1. awaken
          2. sleep and let particles finish
          3. sleep and clear particles
          4. kill immediately
          5. kill after particles fisnish
        5. ExecutionStateSource ( enum )
        6. LoopCount ( int ) : 총 루프 횟수
        7. LoopedAge ( float ) : 이번루프 경과 시간
        8. NormalizedLoopAge ( float ) : 이번루프 경과시간 백분위
      2. Emitter
        1. Age ( float )
        2. CurrentLoopDelay ( float ) : 루프사이 딜레이
        3. CurrentLoopDuration ( float )
        4. DistanceTraveled ( float )
        5. ExecutionState ( enum )
        6. ExecutionStateSource ( enum )
        7. LocalSpace ( bool )
        8. LoopCount ( int )
        9. LoopedAge  ( float )
        10. NormalizedLoopAge  ( float )
        11. DistanceFraction  ( float )
        12. SpawnOutputInfo ( structure )
        13. SpawnRemainder ( float )
      3. Particle
        1. Particles.Age
        2. Color
        3. DistanceTraveled
        4. Initial Color

 

Niagara Fluid ( Grid )

  • Runtime에 BP에서 flaot4 array 받아서 render target에 그리는 플로우
  • https://www.youtube.com/watch?v=3fW5xjiDm-A
    • - Manager BP에서 VectorArray를 Niagara에 보냄
      - Niagara에서 받은 VectorArray를 RenderTarget에 Override ( 빈 에미터에서 GPU 계산으로 바꿀 것 )
      - NiagaraFluids 플러그인 활성화
      - 빈 Emitter에서 Grid2D하고 RenderTarget2D 파라미터를 생성, 받음
          -> Grid2D는 2차원 데이터배열
      - Emitter Spawn phase에서 Set grid, 
        <- RenderTarget(256x256 size, rendertarget user parameter에 user rendertargetparameter 넣기)
        - Grid 2D Set Resolution ( data format을 half float ), Emiiter의 grid 연결 256, 256Scratch에 들어가는 parameter는 접두에 In / Out이 붙어야 함
    • + stage ( generic simulation stage ) 3개, initialize / write to grid / write to texture
        - iteration source = data interface, execute = always, 


커스텀 모듈 : write to grid / write to texture

 

커스텀 HLSL

int Out_Num;
InLocationsAndSizes.Length(Out_Num);
 
float NewGridValue = 0;
 
for(int Index = 0; Index <= Out_Num; Index++)
{
    float4 Out_Value;
    InLocationsAndSizes.Get(Index, Out_Value);
    OutRGBA = Out_Value.z;
    const float Distance = length(Out_Value - InGridLocation);
 
    if(Distance < (Out_Value.w * InRadiusScale))
    {
        const float Falloff = (1 - (Distance/(Out_Value.w * InRadiusScale)));
        NewGridValue = NewGridValue + Falloff;
    }
}
 
 
OutRGBA = lerp(InRGBA, NewGridValue, InDeltaTime * 5);

'Unreal > UE Feature' 카테고리의 다른 글

Projectile & Spline  (0) 2024.05.17
AI  (0) 2024.05.17
Texture  (0) 2024.05.17
Modeling  (0) 2024.05.17
Physics  (0) 2024.05.16

+ Recent posts