Skip to content

The overall goal is to understand how the Digital Differential Analyzer (DDA) algorithm works in the context of raycasting. DDA is a technique that was widely used in old games like Wolfenstein 3D and Catacomb 3D to create pseudo-3D effects in two-dimensional environments.

Notifications You must be signed in to change notification settings

GPMLAD/raycasting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 

Repository files navigation

Raycasting Prototype with DDA

This prototype was developed based on Lode's Computer Graphics Tutorial, an excellent resource for learning about raycasting, graphics algorithms, and related techniques. Lode's tutorial served as my inspiration and guidance for implementing the concepts covered in this project.

The overall goal is to understand how the Digital Differential Analyzer (DDA) algorithm works in the context of raycasting. DDA is a technique that was widely used in old games like Wolfenstein 3D and Catacomb 3D to create pseudo-3D effects in two-dimensional environments.

Final result!

What is DDA?

DDA is a rasterization algorithm that calculates points along a line between two given points. In the context of raycasting, DDA is used to trace rays through a two-dimensional grid, simulating the projection of a 3D environment.

How does this prototype work?

This prototype uses HTML5 Canvas and JavaScript to create a simple simulation of a 3D environment. Users can move around the environment, rotate, and observe object projections on the screen. DDA is employed to calculate the intersection of rays cast from the observer's position.

How to run the prototype?

Simply open the index.html file in a web browser or click here. Use the keys wasd to move and the mouse to rotate. Click on the screen to lock the mouse. You can press z if your cursor is on the minimap to build/destroy walls.

References and Additional Readings

This prototype is an educational tool to grasp the basic concepts behind raycasting and the DDA algorithm. Feel free to explore, experiment, and adapt this code as needed for your own applications.

Protótipo de Raycasting com DDA

Este protótipo foi desenvolvido com base no Lode's Computer Graphics Tutorial, uma excelente fonte para aprender sobre raycasting, algoritmos gráficos e técnicas relacionadas. O tutorial de Lode foi a minha inspiração e orientação para implementar os conceitos abordados neste projeto.

O objetivo geral é entender como funciona o algoritmo DDA (Digital Differential Analyzer) em um contexto de raycasting. O DDA é uma técnica que foi amplamente utilizada em jogos antigos, como Wolfenstein 3D e Catacomb 3D, para criar efeitos de pseudo-3D em ambientes bidimensionais.

Final result!

O que é DDA?

O DDA é um algoritmo de rasterização que calcula pontos ao longo de uma linha entre dois pontos dados. No contexto de raycasting, o DDA é utilizado para traçar raios através de uma grade bidimensional, simulando a projeção de um ambiente 3D.

Como funciona este protótipo?

Este protótipo utiliza HTML5 Canvas e JavaScript para criar uma simples simulação de um ambiente 3D. O usuário pode movimentar-se pelo ambiente, rotacionar e observar as projeções dos objetos na tela. O DDA é empregado para calcular a interseção de raios lançados a partir da posição do observador.

Como executar o protótipo?

Basta abrir o arquivo index.html em um navegador web ou clicar aqui. Use as teclas wasd do teclado para movimentar-se e use o mouse para rotacionar. Clique na tela para travar a o mouse. Você pode usar a tecla z caso seu cursos esteja sobre o minimapa para criar/destruir paredes.

Referências e Leituras Adicionais

Este protótipo é uma ferramenta educacional para entender os conceitos básicos por trás do raycasting e do algoritmo DDA. Sinta-se à vontade para explorar, experimentar e adaptar este código conforme necessário para suas próprias aplicações.

(^u^)/

About

The overall goal is to understand how the Digital Differential Analyzer (DDA) algorithm works in the context of raycasting. DDA is a technique that was widely used in old games like Wolfenstein 3D and Catacomb 3D to create pseudo-3D effects in two-dimensional environments.

Topics

Resources

Stars

Watchers

Forks

Languages