Git Product home page Git Product logo

raylib-gpu-particles's Introduction

Raylib GPU Particles

This example creates a 3D particle system fully on the GPU.

On a simple laptop (MSI Katana) you can draw 2 million particles per frame at 60 fps. The particles are rendered as triangles with direction and magnitude.

The code is Highly documented, you will absolutely understand! It uses Raylib, rlgl (lower level Raylib) and Raygui. You can learn GPU Instancing, particle billboarding and rotating to movement and compute shaders all in Raylib!


This example requires raylib to be compiled with GRAPHIC_API=GRAPHICS_API_OPENGL_43, otherwise you won't be able to use compute shaders.

Features:

  • Highly documented, you will absolutely understand!
  • 100% GPU updated and drawn particles.
  • raylib.h API.
  • rlgl.h lower level API.
  • raygui.h API for fun sliders and playing around.
  • GPU Instancing example.
  • Particle billboarding and rotating to movement example.
  • Compute shader example.

Usage

There are four files in this project. The shaders should be placed under the /Shaders subdirectory. Make sure you have raygui.h in your source.

  • main.c
  • particle_compute.glsl: Update the particles positions and velocity.
  • particle_vertex.glsl: Convert triangles to particles by rotating, scaling, coloring and facing them to the camera.
  • particle_fragment.glsl: Output color.

The simulating parameters can be modified with sliders provided by RayGUI.

raylib-gpu-particles's People

Contributors

arceryz avatar klao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.