Giter Site home page Giter Site logo

boybaykiller / newtonian-particle-simulator Goto Github PK

View Code? Open in Web Editor NEW
250.0 7.0 20.0 4.27 MB

C# OpenGL Particle Simulation, GPU accelerated

Home Page: https://youtu.be/NhnoNYqIhTI

C# 89.40% GLSL 10.60%
opentk c-sharp opengl particles million-particles gravity newtonian particle-system particlesystem

newtonian-particle-simulator's Introduction

C# OpenGL Newtonian-Particle-Simulator

gif img1

This is a very simple interactive particle simulator. The whole pipeline consists out of a single shader program. The vertex shader computes and renders particles at the same time. The fragment shader just outputs the computed colors with blending enabled. The actual particles are stored in a Shader Storage Buffer which is a really useful arbitrary read/write interface of global GPU memory.

Requires OpenGL 4.5.

Also see https://youtu.be/NhnoNYqIhTI.

KeyBoard:

  • W, A, S, D => Movment
  • E => Toggle cursor visibility
  • T => Toggle simulation
  • V => Toggle VSync
  • F11 => Toggle fullscreen
  • LShift => Faster movment speed
  • LControl => Slower movment speed
  • Esc => Close

Mouse:

  • LButton => Set point of mass

newtonian-particle-simulator's People

Contributors

boybaykiller 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  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  avatar  avatar  avatar  avatar  avatar

newtonian-particle-simulator's Issues

Default context below required minimum

Per the issue mentioned in #2, I need to modify the MainWindow class object and insert an NativeWindowSettings override to change the core version to the version necessary to run this application. (Requested 4.5, got back a core 3.30 version on RTX 2070 as the default, have to provide an override to get 4.6.)

@JulianStambuk mentioned the following:

Turns out on my system requesting 4.6 returns a Core Profile which means rendering without an VAO wont work anymore (deprecated in core). I could specifically request a Compatibility Context but I am not sure about that.

And this may affect how rendering works if the requested OpenGL version is not properly requested going forward.

(Please feel free to update the issue title.)

Exception on startup

Specifications

Windows 10 64bit
Ryzen 3 3200G
GTX 1050Ti

Repro

Doubleclick the unpacked portable executable.
Console will appear as child window and show stack trace

Unhandled exception. System.TypeInitializationException: The type initializer for 'Newtonian_Particle_Simulator.Helper' threw an exception.
 ---> System.FormatException: Input string was not in a correct format.
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
   at System.Convert.ToDouble(String value)
   at Newtonian_Particle_Simulator.Helper..cctor()
   --- End of inner exception stack trace ---
   at Newtonian_Particle_Simulator.MainWindow.OnLoad(EventArgs e)
   at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
   at OpenTK.GameWindow.Run(Double updateRate)
   at Newtonian_Particle_Simulator.Program.Main()

and promptly exits afterward.

SSBO vs VBO

Hi, I didn't find any way contact info, so I'll just drop it here.

Did you find any resources on SSBO vs VBO performance for rendering?

I see you chose to store all particle data in SSBO to be able to read and write data in the VS for all particles directly. Have you found any resources suggesting this approach is faster, or have you done any comparisons with a pipeline completely compute shader driven or doing simulation in CS and rendering by passing the particle data as a VBO to the VS?

I'm just curious, but your choice seems to work fine as you can both simulate and render in the same render pass.

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.