Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

N-Body Gravity Simulation

NotificationsYou must be signed in to change notification settings

dbeckwith/nbody

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

byDaniel Beckwith

Demo

About

The goal of this project was to make a fast real-time simulation of gravitational interactions between many particles. The implementation runs a particle simluation on the GPU using an OpenGL compute shader. The shader computes the body-body interactions between every particle and updates their velocities and positions accordingly. Each particle is assigned an initial radius, mass, position, and velocity when the simulation starts based on the given random seed. The particles are arranged to mimic galaxies with a single super-massive star in the center and many smaller stars orbiting the center star. Multiple galaxies interact with each other by colliding and interfering with the orbits of the surrounding stars. The particles are rendered using instanced rendering for the best possible performance, and shaded using the billboard technique to fake a 3D spherical shape. The stars are colored according to their current velocity.

Installation

First, make sure Python 3.5 is installed. Then, usepip to install the dependencies:

pip install -r requirements.txt

This will install thePyQt5,PyOpenGL,pyrr, andNumPy packages. If you're on Windows andpip can't install some of the packages, you may have to download the appropriate wheel files fromhere and install them usingpip:

pip install path/to/wheel1 path/to/wheel2 ...

You may want to do this in aVirtual Environment if you don't have administrative privilages.

Usage

From the project root, run the python module with the help option to see its usage:

python -m nbody --help

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp