This is a work in progress. Aim is to simulate take off, space station docking, and moon landing with a futuristic space plane. Requires OpenGL 4.5 (glClipControl for reversed-z rendering) See sfsim homepage for more details.
- Tested on Debian 13 and Windows 11
- Install JDK 25 Deb for Linux or JDK 25 MSI for Windows
- Install Clojure 1.12
- Download Packr Jar file for creating Windows executable
- Install NSIS for building Windows installer
git clone https://github.com/wedesoft/sfsim.git
cd sfsim
git checkout maingit clone https://github.com/wedesoft/sfsim.git
cd sfsim
git checkout windowsGet JoltPhysics 5.5.0 and build it as follows. Note you might have to install glslc if you already have Vulkan installed.
cd Build
./cmake_linux_clang_gcc.sh Release g++ -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DDOUBLE_PRECISION=ON -DDEBUG_RENDERER_IN_DEBUG_AND_RELEASE=OFF -DPROFILER_IN_DEBUG_AND_RELEASE=OFF -DUSE_AVX2=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF -DUSE_F16C=OFF -DUSE_FMADD=OFF
cd Linux_Release
make -j `nproc`
sudo make install
cd ../..cd Build
./cmake_windows_mingw.sh Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DDOUBLE_PRECISION=ON -DDEBUG_RENDERER_IN_DEBUG_AND_RELEASE=OFF -DPROFILER_IN_DEBUG_AND_RELEASE=OFF -DINTERPROCEDURAL_OPTIMIZATION=OFF -DUSE_AVX2=OFF -DUSE_LZCNT=OFF -DUSE_TZCNT=OFF -DUSE_F16C=OFF -DUSE_FMADD=OFF
cmake --build MinGW_Release -j `nproc`
cmake --install MinGW_Release --prefix /usr/local
cd ..- Build Jolt wrapper library:
make jolt - Build Worley noise:
clj -T:build worley - Build Perlin noise:
clj -T:build perlin - Build blue noise:
clj -T:build bluenoise - Build cloud cover:
clj -T:build cloud-cover - Download space ship model:
clj -T:build download-spaceship - Download NASA Bluemarble data:
clj -T:build download-bluemarble - Download NASA Blackmarble data:
clj -T:build download-Blackmarble - Download NOAA elevation data:
clj -T:build download-elevation - Download NASA JPL ephemeris data:
clj -T:build download-ephemeris - Extract elevation data:
clj -T:build extract-elevation - Convert day map sectors into pyramid of tiles:
clj -T:build map-sectors-day - Convert night map sectors into pyramid of tiles:
clj -T:build map-sectors-night - Convert elevation sectors into pyramid of tiles:
clj -T:build elevation-sectors - Convert tile pyramids into pyramid of cube maps:
clj -T:build cube-maps - Download Moon color images:
clj -T:build download-lunar-color - Download Moon elevation:
clj -T:build download-lunar-elevation - Build atmosphere lookup tables:
clj -T:build atmosphere-lut - Perform all build steps above:
clj -T:build all - Enable integration tests (requiring results of above build steps):
touch .integration
- Update version number in
src/clj/sfsim/version.clj - Build JAR file:
clj -T:build uber - Create Windows executable:
java -jar packr-all-4.0.0.jar scripts/packr-config-windows.json(delete out-windows folder first) - Upload to Steam:
sdk\tools\ContentBuilder\builder\steamcmd.exe +login <account_name> <password> +run_app_build C:\Users\....\sfsim\scripts\sfsim_playtest_windows.vdf +quit
- Update version number in
src/clj/sfsim/version.clj - Build JAR file:
clj -T:build uber - Create Linux executable:
java -jar packr-all-4.0.0.jar scripts/packr-config-linux.json(delete out-linux folder first) - Upload to Steam:
sdk/tools/ContentBuilder/builder_linux/steamcmd.sh +login <account_name> <password> +run_app_build /home/..../sfsim/scripts/sfsim_playtest_linux.vdf +quit
- Install clj-kondo
- Run
clj-kondo --lint src/clj/sfsim
- Run tests (recommended to use xvfb-run):
xvfb-run clj -M:test - Run test for specific module (rendering for example):
xvfb-run clj -M:test sfsim.t-render - Run the global cloud cover prototype:
clj -M etc/cover.clj - Run main program:
clj -M:run
If you want to modify the spacecraft model, you need to edit the Blender model and convert it to GLB again. The Blender model can be converted to GLB as follows:
- apply all modifiers in Blender (first to last)
- delete lights and camera
- delete reference images
- delete invisible objects used for object differences
- export to GLB with baking animations enabled (animation mode "NLA track"!)
- exit Blender without overwriting model
- Simulators
- Engines
- LWJGL
- Publications
- Bruneton: Precomputed Atmospheric Scattering
- Yuksel et al.: Deep Opacity Maps
- Bouthors: Interactive multiple anisotropic scattering in clouds
- Pettersson: Real-time rendering and dynamics of sparse voxel octree clouds
- Nubis: Authoring Real-Time Volumetric Cloudscapes with the Decima Engine
- Hull: Fundamentals of Airplane Flight Mechanics
- Webpages
- NVidia article on atmospheric scattering
- Cascaded Shadow Maps
- Shadow mapping improvements
- improved Perlin noise
- Normal vectors of ellipsoid
- Clojure performance flame graphs
- How to calculate your horizon distance
- Java native interface example
- Earth explorer data
- Simple Physics-based Flight Simulation with C++
- Wedesoft blog
- Videos
- Clojure
- cljstyle (style checking)
- clj-kondo (static code analysis)
- clj-async-profiler (flame graph profiler)
- antq (detect available updates for dependencies)
- nREPL server and REPL-y client
- rebel-readline REPL with colors :)
- Data
