Tentei programar o universo mas isso aconteceu...

In this episode, I show how I programmed my own universe (or at least part of it) using physics simulation and ray tracing in @unity. For physics, I implemented only one formula: Isaac Newton's law of universal gravitation. My C# script applies the appropriate gravitational forces to all rigid bodies in the scene, and Unity then takes care of everything else (integration, collision detection and handling, etc.). Then I gave it a visual makeover using shaders again! With this system, I created some planetary systems, tried to solve the "three-body problem," contemplated a sunrise, an eclipse... and even tested the flat-earth theory (for entertainment purposes, of course). In the end, it's all very simple, but the visual result is very beautiful, especially with ray tracing! This project will serve as the basis for a game I'm developing. It will be a fantastic game and will soon be available in stores near you! If you're also inspired to make a game with this, you can download the full code for my project here: https://github.com/oprogramadorreal/G... Good luck and see you in the next episode! :) Menu: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Introduction: 0:00 My history with physics simulation: 1:11 Objectives: 3:24 Law of universal gravitation: 4:03 Creating stars and planets: 4:52 Simulating: 5:18 A great chaos: 6:41 Physics is beautiful: 7:24 The three-body problem: 7:45 Objects with different masses: 8:38 A solar system: 8:58 Flat Earth?: 9:52 Ray-traced rendering: 10:24 Next steps: 11:33 Addenda: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1) Regarding what I said at 10:47: the ray tracing shader was written using Unity's "compute shaders" (https://docs.unity3d.com/Manual/class.... The syntax is very similar to DirectX's HLSL, but it's not exactly the same. 2) For the simulation to work as I showed in the video, it's important to disable gravity (from Unity) for all rigid bodies in the scene. Gravity is calculated only by the script I called "Simulator". References: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This episode was inspired by some videos by @SebastianLague. I highly recommend his channel! Coding Adventure: Solar System    • Coding Adventure: Solar System   Coding Adventure: Compute Shaders    • Coding Adventure: Compute Shaders   Coding Adventure: Ray Marching    • Coding Adventure: Ray Marching   Ray Tracing: What it is and how it works    • Ray Tracing: O que é e como funciona   Article about ray tracing in Unity (I only implemented part 1) http://three-eyed-games.com/2018/05/0... Stars using Unity's particle system    • Creating an Infinite Area of Stars - Tutor...   The problem of three Bodies https://pt.wikipedia.org/wiki/Problem... Law of Universal Gravitation https://pt.wikipedia.org/wiki/Lei_da_...    • A História COMPLETA da GRAVITAÇÃO UNIVERSA...   - see more on the channel @CienciaTodoDia How to simulate gravity in Unity    • How to Simulate Gravity in Unity   Mathematics for games (forces)    • Game Math Theory - FORCES   Music used: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MONIN - Limits [Chill Electro] - RoyaltyFreePlanet    • MONIN – Limits [Chill Electro] 🎵 from Roya...   CHRISRGMFB - Radical Heights [Synthwave] - RoyaltyFreePlanet    • CHRISRGMFB – Radical Heights [Synthwave] 🎵...   Aries Beats - Infinity [Synthwave] - RoyaltyFreePlanet    • Aries Beats – Infinity [Synthwave] 🎵 from ...   MONIN - Binary Stars [Synthwave] - RoyaltyFreePlanet    • MONIN – Binary Stars [Synthwave] 🎵 from Ro...   Aries Beats - Night Ride [Synthwave] - RoyaltyFreePlanet    • Aries Beats – Night Ride [Synthwave] 🎵 fro...   Gravity - Lance Conrad https://www.storyblocks.com/audio/sto... #physics #raytracing #gamedev