Optimalisasi Simulasi Fisika Dua Dimensi Menggunakan Compute Shader dan Buffer

Penulis

  • Hadziq Fabroyir Institut Teknologi Sepuluh Nopember, Surabaya
  • Geizka Wahyu Fahriza Stairway Games, Yogyakarta

DOI:

https://doi.org/10.25126/jtiik.2025125

Kata Kunci:

Physics, game, GPU, Unity, shader

Abstrak

Simulasi fisika merupakan aspek penting dalam pengembangan gim dan aplikasi extended reality (XR), khususnya untuk fungsi-fungsi seperti tumbukan antar objek, pergerakan, dan pemeriksaan ray-cast. Secara tradisional, simulasi ini dijalankan menggunakan Central Processing Unit (CPU). Namun, seiring meningkatnya kompleksitas interaksi pengguna, simulasi berbasis CPU mulai mengalami kendala skalabilitas, sehingga menyebabkan perlambatan pada eksekusi logika aplikasi secara keseluruhan. Untuk mengatasi kendala tersebut, penelitian ini memanfaatkan kemampuan pemrosesan paralel pada Graphics Processing Unit (GPU) melalui penggunaan compute shader dan compute buffer yang dinamis guna mengoptimalkan performa simulasi fisika dua dimensi. Penelitian dilakukan dengan mengembangkan sebuah kerangka kerja simulasi di mesin gim Unity, yang kemudian diuji kinerjanya dibandingkan dengan metode berbasis CPU melalui benchmarking. Pengujian dilakukan terhadap berbagai konfigurasi perangkat keras dengan jenis collider berbeda (lingkaran, kotak, poligon) serta jumlah objek yang beragam (100–3000 objek). Hasilnya menunjukkan bahwa simulasi berbasis GPU memiliki performa yang secara signifikan lebih unggul dibandingkan simulasi berbasis CPU, terutama pada skenario dengan jumlah objek yang tinggi. Temuan ini memberikan panduan praktis bagi pengembang aplikasi yang mengimplementasikan simulasi fisika untuk konfigurasi perangkat keras yang beragam.

 

Abstract

Physics simulation is a crucial element in game development and extended reality (XR) applications, supporting essential functionalities such as object collision detection, movement, and ray-casting inspection. Traditionally, these simulations have been handled by the Central Processing Unit (CPU). However, as user interactions become increasingly complex, CPU-based simulations encounter scalability issues, leading to slower execution of game logic and reduced overall performance. To overcome these limitations, this study leverages the parallel processing capabilities of Graphics Processing Units (GPUs) through compute shaders and dynamic compute buffers to optimize 2D physics simulations. We developed a GPU-accelerated simulation framework using the Unity game engine and benchmarked its performance against traditional CPU-based approaches. Performance evaluations were conducted across multiple hardware configurations, collider types (circle, box, polygon), and varying object counts (ranging from 100 to 3000 objects). The results demonstrate that GPU-based simulations significantly outperform CPU ones, particularly in scenarios involving large numbers of objects. These findings highlight the effectiveness of GPU acceleration for enhancing the scalability and efficiency of game physics systems, providing valuable insights for developers aiming to optimize performance across diverse hardware platforms.

Downloads

Download data is not yet available.

Referensi

AGHILINASAB, H., ALI, W., YUN, H. AND PELLIZZONI, R., 2020. Dynamic Memory Bandwidth Allocation for Real-Time GPU-Based SoC Platforms. In: IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems. Institute of Electrical and Electronics Engineers Inc. pp.3348–3360. https://doi.org/10.1109/TCAD.2020.3012210.

ARANGO, R., 2025. Determinism with 2D physics. [daring] Unity Support. Tersedia pada: <https://support.unity.com/hc/en-us/articles/360015178512-Determinism-with-2D-Physics> [Diakses 1 April 2025].

BALAMURUGAN, B., SKARIAH, A., NALINIPRIYA, G., MAHESWARI, K.G. AND V., M., 2016. Acceleration of Bullet Physics Physical Simulation Library Using GPU and Demonstration on a Set-Top Box Platform. In: Proceedings of the Second International Conference on Information and Communication Technology for Competitive Strategies. [daring] New York, NY, USA: ACM. pp.1–4. https://doi.org/10.1145/2905055.2905266.

CATTO, E., 2025. What is Box2D? [daring] Box2D. Tersedia pada: <https://box2d.org/documentation/md_faq.html> [Diakses 1 April 2025].

CHE, S., BOYER, M., MENG, J., TARJAN, D., SHEAFFER, J.W., LEE, S.H. AND SKADRON, K., 2009. Rodinia: A benchmark suite for heterogeneous computing. In: Proceedings of the 2009 IEEE International Symposium on Workload Characterization, IISWC 2009. pp.44–54. https://doi.org/10.1109/IISWC.2009.5306797.

CHOLISSODIN, I., JONEMARO, E.M.A., RAHAYUDI, B., KSATRIA, W.E., SUKMAWATI, A. AND MUZAYYANI, M.F., 2022a. Pengembangan Fast Render Objek Grafis Menggunakan Shader dan Non-Shader Berbasis WebGL dari Primitive Object untuk Membuat Raw Metaverse Material Objek Skybox 3D di Filkom UB. Jurnal Teknologi Informasi dan Ilmu Komputer, [daring] 9(7), p.1357. https://doi.org/10.25126/jtiik.2022976739.

CHOLISSODIN, I., SYAUQY, D., FIRMANDA, D.A., AJI, I., RAHMAN, E., HARAHAP, S. AND SEPTINO, F., 2022b. Pengembangan Auto-AI Model Generatif Analisis Kompleksitas Waktu Algoritma Untuk Data Multi-Sensor IoT Pada Node-RED Menggunakan Extreme Learning Machine. Jurnal Teknologi Informasi dan Ilmu Komputer, 9(7), p.1349. https://doi.org/10.25126/jtiik.2022976738.

CORMEN, T.H., LEISERSON, C.E., RIVEST, R.L. AND STEIN, C., 2022. Introduction to algorithms. MIT press.

IRAWAN, F.T., MA’RUFI, M.R. AND CHOLISSODIN, I., 2017. Optimasi Rendering Game 2D Asteroids Menggunakan Pemrograman CUDA. Jurnal Teknologi Informasi dan Ilmu Komputer, [daring] 4(4), pp.221–226. https://doi.org/10.25126/jtiik.201744488.

LEE, R.P., PIERCE, J.R., MILLER, K.G., ALMANZA, M., TABLEMAN, A., DECYK, V.K., FONSECA, R.A., ALVES, E.P. AND MORI, W.B., 2025. Acceleration of the particle-in-cell code OSIRIS with graphics processing units. Journal of Plasma Physics, 91(1). https://doi.org/10.1017/S0022377824001569.

LIANG, C. AND LIU, X., 2015. The research of collision detection algorithm based on separating axis theorem. Int. J. Sci, 2(10), pp.110–114.

MILLINGTON, I., 2007. Game physics engine development. CRC Press.

MORSY, M.M., GOODALL, J.L., O’NEIL, G.L., SADLER, J.M., VOCE, D., HASSAN, G. AND HUXLEY, C., 2018. A cloud-based flood warning system for forecasting impacts to transportation infrastructure systems. Environmental Modelling and Software, 107, pp.231–244. https://doi.org/10.1016/j.envsoft.2018.05.007.

NVIDIA, 2025. CUDA C++ Best Practices Guide. [daring] Tersedia pada: <https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/> [Diakses 6 June 2025].

PENG, X., ZHENG, Z., SHEN, C., YOUNG, T., GUO, X., WANG, B., XU, H., LIU, H., JIANG, M., LI, W., WANG, Y., YE, A., REN, G., MA, Q., LIANG, W., LIAN, X., WU, X., ZHONG, Y., LI, Z., GONG, C., LEI, G., CHENG, L., ZHANG, L., LI, M., ZHANG, R., HU, S., HUANG, S., WANG, X., ZHAO, Y., WANG, Y., WEI, Z. AND YOU, Y., 2025. Open-Sora 2.0: Training a Commercial-Level Video Generation Model in $200k. [daring] pp.1–21. Tersedia pada: <http://arxiv.org/abs/2503.09642>.

PISCAGLIA, F. AND GHIOLDI, F., 2023. GPU Acceleration of CFD Simulations in OpenFOAM. Aerospace, [daring] 10(9), p.792. https://doi.org/10.3390/aerospace10090792.

RIZALDI, H.I., PRAMANA, F.S., R, B.N., A. N., A.Y. AND CHOLISSODIN, I., 2017. Optimasi Proses Rendering Objek Game 3D Menggunakan Pemrograman CUDA Pada Game Sandbox Craft. Jurnal Teknologi Informasi dan Ilmu Komputer, [daring] 4(3), p.207. https://doi.org/10.25126/jtiik.201743444.

SUNG, N.J., MA, J., HOR, K., KIM, T., VA, H., CHOI, Y.J. AND HONG, M., 2025. Real-Time Physics Simulation Method for XR Application. Computers, 14(1). https://doi.org/10.3390/computers14010017.

XIONG, Y., 2024. GPU acceleration of ab initio simulations of large-scale identical particles based on path integral molecular dynamics. [daring] pp.1–23. Tersedia pada: <http://arxiv.org/abs/2404.02628>.

XU, A. AND LI, B.T., 2024. Particle-resolved thermal lattice Boltzmann simulation using OpenACC on multi-GPUs. International Journal of Heat and Mass Transfer, 218(October 2023). https://doi.org/10.1016/j.ijheatmasstransfer.2023.124758.

YENPURE, A., PUGMIRE, D. AND CHILDS, H., 2025. Steady-State Particle Advection Speed-Ups from GPU and CPU Parallelism. In: IS and T International Symposium on Electronic Imaging Science and Technology. Society for Imaging Science and Technology. https://doi.org/10.2352/EI.2025.37.12.HPCI-179.

Diterbitkan

03-11-2025

Terbitan

Bagian

Ilmu Komputer

Cara Mengutip

Optimalisasi Simulasi Fisika Dua Dimensi Menggunakan Compute Shader dan Buffer. (2025). Jurnal Teknologi Informasi Dan Ilmu Komputer, 12(5), 1073-1082. https://doi.org/10.25126/jtiik.2025125