[DirectX 11] Particle System

2021. 12. 26. 20:45·Graphics

Particle System

- Unity Particle System을 참고하여 현재 프로젝트에서 필요한 기능 위주로 제작.

- 현재 MaxParticle 개수대로 만들어 두고 파티클을 사용하고 있다.

- LifeTime Option에 따른 Animation 분기 설정 후 애니메이션 실행.

 

// Particle Animation Option
typedef enum PARTICLE_ANIMATION_OPTION : UINT
{
	TEXTURE_ANI		= 0x00000001,
	COLOR_ANI		= 0x00000010,
	POSITION_ANI		= 0x00000100,
	ROTATION_ANI		= 0x00001000,
	SCALE_ANI		= 0x00010000
}PARTICLE_ANIMATION_OPTION;

// Particle Render Option
typedef enum PARTICLE_RENDER_OPTION
{
	BILLBOARD,
	VERTICAL_BILLBOARD,
	HORIZONTAL_BILLBOARD,
	MESH
}PARTICLE_RENDER_OPTION;

// Particle LifeTime Option
typedef enum PARTICLE_LIFETIME_OPTION
{
	NONE,
	UP,
	DOWN,
	UPDOWN
}PARTICLE_LIFETIME_OPTION;

class ParticleSystem : public Component
{
public:
	EATER_ENGINEDLL ParticleSystem();
	~ParticleSystem();

public:
	void Awake() override;
	void SetUp() override;
	void Start() override;
	void Update() override;

public:
	EATER_ENGINEDLL void SetMeshName(std::string meshName);						// 파티클 출력할 매쉬 타입
	EATER_ENGINEDLL void SetRenderType(PARTICLE_RENDER_OPTION renderType);				// 파티클 출력할 랜더 타입
	EATER_ENGINEDLL void SetMaxParticles(int maxCount);						// 최대 파티클 출력 개수
	EATER_ENGINEDLL void SetDelayTime(float delay);							// 파티클 실행 전 지연 시간
	EATER_ENGINEDLL void SetRateOverTime(float count);						// 1초에 출력할 파티클 개수
	EATER_ENGINEDLL void SetShapeRadius(float radius);						// 파티클 랜덤 생성 범위
	EATER_ENGINEDLL void SetShapeRadius(float x, float y, float z);					// 파티클 랜덤 생성 범위

	EATER_ENGINEDLL void SetStartForce(Vector3 force);						// 파티클 고정 속력
	EATER_ENGINEDLL void SetStartForce(Vector3 minForce, Vector3 maxForce);				// 파티클 랜덤 속력
	EATER_ENGINEDLL void SetStartColor(Vector4 color);						// 파티클 고정 색상
	EATER_ENGINEDLL void SetStartColor(Vector4 minColor, Vector4 maxColor);				// 파티클 랜덤 색상
	EATER_ENGINEDLL void SetStartLifeTime(float time);						// 파티클 고정 유지시간
	EATER_ENGINEDLL void SetStartLifeTime(float minTime, float maxTime);				// 파티클 랜덤 유지시간
	EATER_ENGINEDLL void SetStartScale(float scale);						// 파티클 고정 크기
	EATER_ENGINEDLL void SetStartScale(float minScale, float maxScale);				// 파티클 랜덤 크기
	EATER_ENGINEDLL void SetStartRotation(float rot);						// 파티클 고정 회전
	EATER_ENGINEDLL void SetStartRotation(float minRot, float maxRot);				// 파티클 랜덤 회전

	EATER_ENGINEDLL void SetLifeTimeForce(Vector3 force);						// 파티클 생성 후 고정 속력 범위
	EATER_ENGINEDLL void SetLifeTimeForce(Vector3 minForce, Vector3 maxForce);			// 파티클 생성 후 랜덤 속력 범위
	EATER_ENGINEDLL void SetLifeTimeColor(Vector4 minColor, Vector4 maxColor, PARTICLE_LIFETIME_OPTION option);			// 파티클 생성 후 색상 범위
	EATER_ENGINEDLL void SetLifeTimeScale(float minScale, float maxScale, PARTICLE_LIFETIME_OPTION option);				// 파티클 생성 후 크기 범위
	EATER_ENGINEDLL void SetLifeTimeRotation(float rot);						// 파티클 생성 후 고정 회전 범위
	EATER_ENGINEDLL void SetLifeTimeRotation(float minRot, float maxRot);				// 파티클 생성 후 랜덤 회전 범위

	EATER_ENGINEDLL void SetTextureTiling(int count_x, int count_y);				// 파티클 텍스쳐 나눌 개수
	EATER_ENGINEDLL void SetPlayTime(float playTime, bool loop = false);				// 파티클 시스템 플레이 시간 및 반복 여부
	
	EATER_ENGINEDLL void SetDiffuseName(std::string diffuseName);

	EATER_ENGINEDLL void Play(bool loop = false);							// 파티클 시스템 플레이 시간 및 반복 여부
	EATER_ENGINEDLL void Stop();									// 파티클 시스템 중지

	EATER_ENGINEDLL void SetNextParticle(ParticleSystem* particle);

	...

};

 

ParticleSystem Option

- Particle Random Data : 각각의 입자들은 생성시마다 랜덤한 값 (Position, Rotation, Scale, Color ...) 설정 가능

- Particle LifeTime Option : 세가지 옵션 ( 증가 & 감소 &증가 감소)

- Particle Mesh Render Option : 네가지 옵션 ( Billborad & Vertical Billboard & Horizontal Billboard& Mesh )

- SetMeshName : 파티클 출력할 매쉬 타입

- SetRenderType : 파티클 출력할 랜더타입

- SetMaxParticles : 최대 파티클 출력 개수

- SetDelayTime : 파티클 실행 전 지연 시간

- SetRateOverTime : 1초에 출력할 파티클 개수

- SetShapeRadius : 파티클 랜덤 생성 범위

- SetStartForce: 파티클 생성시 속력

- SetStartColor : 파티클 생성시 색상

- SetStartLifeTime : 파티클 유지시간

- SetStartScale: 파티클 생성시 크기값

- SetStartRotation : 파티클 생성시 회전값

- SetLifeTimeForce : 파티클 생성 후 속력 범위

- SetLifeTimeColor : 파티클 생성 후 색상 범위

- SetLifeTimeScale : 파티클 생성 후 크기 범위

- SetLifeTimeRotation : 파티클 생성 후 회전 범위

- SetTextureTiling : 파티클 텍스쳐 나눌 개수

- SetPlayTime : 파티클 시스템 플레이 시간 및 반복 여부

- SetNextParticle : 현재 파티클 종료 후 실행할 파티클 추가

 

적용 영상

Particle System 적용 영상

'Graphics' 카테고리의 다른 글

[DirectX 11] Deferred Rendering FXAA  (0) 2022.01.16
[DirectX 11] Order Independent Transparency  (0) 2022.01.07
[DirectX 11] Terrain Mesh Blending  (0) 2021.12.20
[DirectX 11] Map / UnMap vs UpdataSubresource  (0) 2021.12.19
[DirectX 11] Animation  (0) 2021.12.18
'Graphics' 카테고리의 다른 글
  • [DirectX 11] Deferred Rendering FXAA
  • [DirectX 11] Order Independent Transparency
  • [DirectX 11] Terrain Mesh Blending
  • [DirectX 11] Map / UnMap vs UpdataSubresource
KyuHwang
KyuHwang
  • KyuHwang
    DirectX Engine
    KyuHwang
  • 전체
    오늘
    어제
    • 분류 전체보기 (50)
      • C++ (4)
      • CS (0)
      • Graphics (32)
      • DLL (2)
      • Shader (7)
      • Project (4)
      • ETC (1)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • YouTube
  • 공지사항

  • 인기 글

  • 태그

    Define Macro
    RunTime Compile Shader
    Directx11
    DLL Interface
    bc format
    Order Independent Transparency
    Implicit Linking
    animation retargeting
    std::is_base_of
    mobile format
    shader
    Return Type Operator
    Shader Macro
    Hash Code
    nvtt
    dll
    hlsl
    Project
    Shader Resource 관리
    texture block compression
    Define Function
    animation constraint
    rigging chain
    Alpha Blending
    std::enable_if
    Shader Reflection
    DirectX 2D
    C ++
    Explicit Linking
    Win API
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
KyuHwang
[DirectX 11] Particle System
상단으로

티스토리툴바