Million+ point universal gravity simulation using OpenGL and OpenCL

Overview

Universe Simulation on GPU

  • A multi-million particle gravity simulation.
  • The main program is org.davu.app.Space.main
  • See each package.html for code details.
  • Currently only builds with Windows natives. (see TODOs)
  • Currently only works with Intel chipset. (see TODOs)
  • davu is short for David Uselmann

Controls

Space.main
  • ESC key quit (also window x button)
  • W/A/S/D moves forward,left,back,right (i.e. FPS)
  • R/F keys (or shift+W/S) moves up,down
  • Q/E keys rolls CCW/CC
  • Ctrl+3 toggles 3D glasses mode.
  • Ctrl+D+up/down arrows adjusts 3D glasses separation.
  • Ctrl+A+up/down arrows adjusts particle alpha value.
  • Ctrl+T+up/down arrows adjusts time step.
  • Left mouse button looks in that direction.
  • Right mouse button increase speed much faster.
  • Letting go of all controls reduces speed.
opencl.advanced classes
  • Click and drag to move the simulation in the window
  • Mouse roller or touchpad two-finger scroll to zoom in/out

Purpose

  • To make a million (or more) particle engine. Check.
  • To learn how to run code on the GPU. Check.
  • To learn how to link OpenCL to OpenGL. Check.
  • To visualize gravity on a massively parallel scale. Check.
  • To demonstrate the power of the the GPU in today's laptops. Check.
  • To have fun. Check. Check. Check.

Build Gravity jar

mvn package

Running Space main

java -jar target/gravity.jar

Running Other main

java -cp target/gravity.jar org.davu.opencl.advanced.Saturn

Override main in custom gravity.jar

mvn package -Dclass=org.davu.opencl.advanced.Saturn
java -jar target/gravity.jar

Technologies

  • LWJGL - Java Gaming Library OpenGL/CL/AL (and others) link to native resources.
  • OpenGL - Open Graphic Library to render simulations.
  • OpenCL - Open Computing Library to compute Newtonian gravity.
  • Java2D - Java AWT window and rendering is used for some demos.
  • JOML - Linear algebra math framework.

TODOs

Architecture detecting pom.xml
  • The current pom.xml is only configured for Windows natives.
  • When I used this OS detecting pom, it pulled down all native jars.
  • This cause conflicts where the wrong OS native was bound to the JVM.
  • https://github.com/LWJGL/lwjgl3-demos/blob/main/pom.xml
  • Looking at the pom and replace the OS native with yours
  • natives-windows
  • then it should work for your machine architecture.
OpenGL GPU Selection
  • I could not find a GPU selector for OpenGL. It selects GPU 0.
  • I matched the OpenGL GPU for OpenCL.
  • See org.davu.app.space.OpenCL.java line 57 for OpenCL GPU assignment.
Factory for initial condition instances.
  • org.davu.app.space.Space#44 has a new instance of the scenario in use.
  • I need to construct a factory to control that scenario instantiated.
  • For now, the instance name can be replaced with any subclass of Particles.
Maybe change package.html
  • Thinking I might rather they be readme.md files for github display.
Maybe add some sound
  • The pom has openal jar dependency for when I get around to implementing some sound.
Special Note
  • Newtonian gravity is normalizable. The distances and masses are relative magnitude numbers.
  • This could be a natural range if Newton's Constant and actual kg, m, sec initial conditions are used.

All Other main methods

java -cp target/gravity.jar org.davu.opencl.simple.TestInfo
java -cp target/gravity.jar org.davu.opencl.simple.Test1D
java -cp target/gravity.jar org.davu.opencl.simple.Test1Dvector
java -cp target/gravity.jar org.davu.opencl.simple.Test2D
java -cp target/gravity.jar org.davu.opencl.simple.Test2D2D
java -cp target/gravity.jar org.davu.opencl.simple.TestR2D2D

java -cp target/gravity.jar org.davu.opencl.advanced.Explosive
java -cp target/gravity.jar org.davu.opencl.advanced.Explosive2
java -cp target/gravity.jar org.davu.opencl.advanced.Galaxies
java -cp target/gravity.jar org.davu.opencl.advanced.Galaxies2
java -cp target/gravity.jar org.davu.opencl.advanced.GalaxiesDarkMatter
java -cp target/gravity.jar org.davu.opencl.advanced.GalaxiesDarkMatterVar
java -cp target/gravity.jar org.davu.opencl.advanced.GalaxyArms
java -cp target/gravity.jar org.davu.opencl.advanced.Globular3D
java -cp target/gravity.jar org.davu.opencl.advanced.Gravity
java -cp target/gravity.jar org.davu.opencl.advanced.Helix
java -cp target/gravity.jar org.davu.opencl.advanced.Helix2
java -cp target/gravity.jar org.davu.opencl.advanced.Orbitally
java -cp target/gravity.jar org.davu.opencl.advanced.Saturn
java -cp target/gravity.jar org.davu.opencl.advanced.SaturnClose
java -cp target/gravity.jar org.davu.opencl.advanced.SaturnSpiral
java -cp target/gravity.jar org.davu.opencl.advanced.SolarSystem
java -cp target/gravity.jar org.davu.opencl.advanced.SolarSpeedy
java -cp target/gravity.jar org.davu.opencl.advanced.Universe
java -cp target/gravity.jar org.davu.opencl.advanced.Universe2
You might also like...

Pw0 Framewrok - magical android pentest app đź”®! Pixie Dust, Handshakes, Deauth, Nmap, Port scanner and more!

Pw0 Framework Pw0 Framewrok - magical android pentest app đź”® ! Features: Pixie Dust Handshakes Deauth Nmap Port scanner and more! Version: 0.2 Beta Au

Sep 27, 2021

A well-designed local image and video selector for Android

A well-designed local image and video selector for Android

Matisse Matisse is a well-designed local image and video selector for Android. You can Use it in Activity or Fragment Select images including JPEG, PN

Dec 29, 2022

Provide image storage and access services.

Provide image storage and access services.

Jan 23, 2022

Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation

Apache Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation

Apache Thrift Introduction Thrift is a lightweight, language-independent software stack for point-to-point RPC implementation. Thrift provides clean a

Jan 4, 2023

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR) applications.

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR) applications.

LWJGL - Lightweight Java Game Library 3 LWJGL (https://www.lwjgl.org) is a Java library that enables cross-platform access to popular native APIs usef

Dec 29, 2022

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR) applications.

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR) applications.

LWJGL - Lightweight Java Game Library 3 LWJGL (https://www.lwjgl.org) is a Java library that enables cross-platform access to popular native APIs usef

Dec 29, 2022

A fabric mod and api that lets you change player gravity direction

GravityChanger A fabric mod and api that lets you change player gravity direction. Features This mod adds 6 items that let you change your gravity to

Aug 27, 2022

Ptubes is a database disaster recovery product based on the PITR (Point In Time Recovery) method

Ptubes is a database disaster recovery product based on the PITR (Point In Time Recovery) method, which can be used to restore the entire database to a specific point in time to help users improve the reliability and security of the database

Nov 29, 2022

It's a particle system only appliaction. Made with LWJGL (OpenGL and GLFW for Java) and ImGui.

ParticleParty It's a particle system only appliaction. Made with LWJGL (OpenGL and GLFW for Java) and ImGui. How To Use Move the camera with ctrl + W/

Jan 8, 2022

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.

ChartFx ChartFx is a scientific charting library developed at GSI for FAIR with focus on performance optimised real-time data visualisation at 25 Hz u

Jan 2, 2023

"I am fluent in over 6 million forms of communication!"

K3PO K3PO is a network driver and language agnostic testing tool. It is designed to be able to create arbitrary network traffic and behavior, and to c

Dec 1, 2022

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.

ChartFx ChartFx is a scientific charting library developed at GSI for FAIR with focus on performance optimised real-time data visualisation at 25 Hz u

Dec 30, 2022

Flights metasearch engine simulation using Java, GraphQL and React.js, developed for COMP30220 Distributed Systems.

Flights metasearch engine simulation using Java, GraphQL and React.js, developed for COMP30220 Distributed Systems.

Distributed Airways For the full project report, see ./report.pdf. A demonstration video is available here. Requirements Docker JDK 8 and Apache Maven

Dec 29, 2022

A suite of software tools and services created to support activity planning and sequencing needs of missions with modeling, simulation, scheduling and validation capabilities

Aerie A suite of software tools and services created to support activity planning and sequencing needs of missions with modeling, simulation, scheduli

Jan 3, 2023

Free universal database tool and SQL client

Free universal database tool and SQL client

DBeaver Free multi-platform database tool for developers, SQL programmers, database administrators and analysts. Supports any database which has JDBC

Jan 1, 2023

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Dec 30, 2021

A Toolkit for Modeling and Simulation of Resource Management Techniques in Internet of Things, Edge and Fog Computing Environments

The iFogSimToolkit (with its new release iFogSim2) for Modeling and Simulation of Resource Management Techniques in Internet of Things, Edge and Fog Computing Environments. In the new release Mobili Management, Microservice Management, and Dynamic Clustering mechanisms are added as new features.

Dec 17, 2022

Java UCI Protocol implementation (Universal Chess Engine)

Java UCI Protocol implementation (Universal Chess Engine)

A simple UCI (Universal Chess Interface) Client written in Java. Tested with Stockfish 13. Documentation Starting / Closing the client By using the st

Jan 2, 2023

Universal, flexible, high-performance distributed ID generator

Universal, flexible, high-performance distributed ID generator

CosId Universal, flexible, high-performance distributed ID generator 中文文档 Introduction CosId aims to provide a universal, flexible and high-performanc

Dec 27, 2022
Owner
David Uselmann
David Uselmann
A VisionCamera Frame Processor Plugin to preform text detection on images using MLKit Vision Text Recognition

vision-camera-ocr A VisionCamera Frame Processor Plugin to preform text detection on images using MLKit Vision Text Recognition. Installation yarn add

Aaron Grider 133 Dec 19, 2022
Roman Beskrovnyi 250 Jan 9, 2023
Anthos Edge Use Cases for bringing apps and computation closer to the location where the action is, to improve response times and save bandwidth.

Anthos Bare Metal Edge Use Cases Edge computing is a distributed computing paradigm that brings computation and data storage closer to the location wh

Google Cloud Platform 27 Dec 20, 2022
Fast computer vision library for SFM, calibration, fiducials, tracking, image processing, and more.

Table of Contents Introduction Cloning Repository Quick Start Gradle and Maven Building from Source Dependencies Help/Contact Introduction BoofCV is a

Peter Abeles 916 Jan 6, 2023
Java interface to OpenCV, FFmpeg, and more

JavaCV Commercial support: Introduction JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of comput

Bytedeco 6.4k Jan 4, 2023
TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO

About TwelveMonkeys ImageIO is a collection of plugins and extensions for Java's ImageIO. These plugins extend the number of image file formats suppor

Harald Kuhr 1.6k Jan 5, 2023
Traditional roguelike game with pixel-art graphics and simple interface

Traditional roguelike game with pixel-art graphics and simple interface

Evan Debenham 2.5k Dec 30, 2022
This project allows the exchange of files between your local disk and a D64 image (Commodore 64 image disk) . Ce projet permet l'Ă©change de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64).

DiskToolC64 Ce projet permet l'Ă©change de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64). Introduction Les fi

Eddy BRIERE 3 Oct 12, 2022