1 / 9

Sistema de Partículas

Sistema de Partículas. Su aplicación a los gráficos en tiempo real. Sistema de Partículas. Un sistema de partículas es un conjunto de pequeños objetos que están en movimiento usando algún algoritmo Modelar fuego, humo, explosiones, lluvia, nieve, estrellas...

beata
Download Presentation

Sistema de Partículas

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sistema de Partículas Su aplicación a los gráficos en tiempo real Jose María Buades Rubio

  2. Sistema de Partículas • Un sistema de partículas es un conjunto de pequeños objetos que están en movimiento usando algún algoritmo • Modelar fuego, humo, explosiones, lluvia, nieve, estrellas... • No es una forma de renderizar, sino de animar los objetos que renderizamos.

  3. Sistema de Partículas • La idea es controlar la creación, movimiento, cambio y eliminación de partículas durante el tiempo. • Tenemos un numero n máximo de partículas, cada una se crea en un instante de tiempo t, evoluciona a lo largo del tiempo según valores propios o del conjunto de partículas

  4. Lluvia CreaciónPara cada partícula Crear en posición (z, (x, y)) aleatoria Generar velocidad (vz, (vx, vy)) SimulaciónPara cada partícula activa z = z – vz Si toca suelo y continua lloviendo z = zmax generar (x, y) (vz, (vx, vy))

  5. Lluvia RenderizaciónPara cada partícula Dibujar linea (x, y, z) a (x+vx, y+vy, z+vz) FinalizaciónCuando no ha de continuar lloviendo yPara cada partícula desactivada es cierto

  6. class CRain : CObject3D {public: CRain(); CRain(int numParticles); ~CRain(); void Create(int numParticles); void Destroy(); int GetNumParticles(); void Simulate(float fIncTime); virtual void Render(); virtual void RenderShadow(){}; bool IsActive(); void Active(bool bActivate=true); void SetDimensions(float fX, float fY, float fZ); void GetDimensions(float&fX, float&fY, float&fZ);protected: float m_fDimx, m_fDimy, m_fDimz; bool m_bActivate; int m_nParticles bool m_bCreated; CParticleRain* m_pParticles; };

  7. Consideraciones • El número de partículas no debe ser excesivo para no saturar la CPU • Usar arrays de tamaño fijo y controlar el número de partículas “vivas” • No solo la posición es objeto de simulación, se puede simular el tamaño, el color... • La simulación ha de ser realista pero de bajo coste computacional (SIMD)

  8. Ejemplo: Demo.zip

  9. Bibliografía A. Watt, F. Policarpo “3D Games: Real-time Rendering and Software Techonology” Ed. Acm-Press T. Möller, E. Haines “Real-time Rendering” Ed. A K Peters K. Hawkins, D. Astle, A. LaMothe “OpenGL Game Programming” Ed. Prima Tech

More Related