Path tracing obj - (taichi course final project) a path tracing renderer that can import and render obj files

Overview

太极图形课S1-大作业

作业来源

路径追踪是目前计算机图形学中进行三维渲染的主流算法,因其生成的图像真实感强,广泛应用于静态图、电影等离线渲染上。随着目前GPU算力的不断增强,电子游戏等实时渲染领域也逐渐采用光栅化和路径追踪的方法来增强画面效果。

本次大作业通过太极编程语言完成了一个简单的路径追踪渲染器,该渲染器支持OBJ文件的导入和渲染。但因时间原因,没有实现OBJ的纹理映射和各类空间求交加速算法。

在实现本大作业中,参考了太极图形课的路径追踪示例程序 (链接)

运行方式

运行环境:

[Taichi] version 0.8.8, llvm 10.0.0, commit 7bae9c77, win, python 3.9.7

运行:

python path_tracing_obj.py

  • 使用 默认OBJ文件: 需保证model文件夹和path_tracing_obj.py文件位于同一路径下

  • 使用 自定义 OBJ文件: 可以修改path_tracing_obj.py文件中scene_init开头的函数以加载自定义模型,需注意可能需要对模型进行三维几何变换以让模型以合适的大小、位置、角度显示在屏幕上

效果展示

下面为在康纳盒中显示不同OBJ模型的效果图 res0

res1

res2

res3

res4

res5

整体结构

-LICENSE
-|data
-|model
-README.MD
-path_tracing_obj.py
-requirements.txt

实现细节:

path_tracing_obj.py是项目源代码,其中包含Ray类、Triangle类、Model类、ModelSphere类、Scene类、路径追踪中用到的反射折射方向计算函数和路径追踪函数、渲染函数、场景加载函数和main函数。

整体流程

  1. 执行场景加载函数,用OBJ文件实例化Model类,对Model对象执行三维几何变换,将Model对象添加到Scene类中
  2. 执行渲染函数,对屏幕上每个像素计算射线方向并调用路径追踪函数获取其颜色,将其写入帧缓冲器
  3. 在路径追踪函数依照路径追踪算法不断迭代,直到到达最大深度或与光源相交
  4. 在GUI中显示帧缓冲器中的图像
Visualisation for sorting algorithms. Version 2.0

Visualisation for sorting algorithms v2. Upped a notch from version 1. This program provides animates simple, common and popular sorting algorithms, t

Ben Woo 7 Nov 08, 2022
Algorithms-in-Python - Programs related to DSA in Python for placement practice

Algorithms-in-Python Programs related to DSA in Python for placement practice CO

MAINAK CHAUDHURI 2 Feb 02, 2022
Apriori - An algorithm for frequent item set mining and association rule learning over relational databases

Apriori Apriori is an algorithm for frequent item set mining and association rul

Mohammad Nazari 8 Jan 10, 2022
A simple python implementation of A* and bfs algorithm solving Eight-Puzzle

A simple python implementation of A* and bfs algorithm solving Eight-Puzzle

2 May 22, 2022
This is a Python implementation of the HMRF algorithm on networks with categorial variables.

Salad Salad is an Open Source Python library to segment tissues into different biologically relevant regions based on Hidden Markov Random Fields. The

1 Nov 16, 2021
This is a demo for AAD algorithm.

Asynchronous-Anisotropic-Diffusion-Algorithm This is a demo for AAD algorithm. The subroutine of the anisotropic diffusion algorithm is modified from

3 Mar 21, 2022
PICO is an algorithm for exploiting Reinforcement Learning (RL) on Multi-agent Path Finding tasks.

PICO is an algorithm for exploiting Reinforcement Learning (RL) on Multi-agent Path Finding tasks. It is developed by the Multi-Agent Artificial Intel

21 Dec 20, 2022
Python based framework providing a simple and intuitive framework for algorithmic trading

Harvest is a Python based framework providing a simple and intuitive framework for algorithmic trading. Visit Harvest's website for details, tutorials

100 Jan 03, 2023
N Queen Problem using Genetic Algorithm

The N Queen is the problem of placing N chess queens on an N×N chessboard so that no two queens attack each other.

Mahdi Hassanzadeh 2 Nov 11, 2022
Classic algorithms including Fizz Buzz, Bubble Sort, the Fibonacci Sequence, a Sudoku solver, and more.

Algorithms Classic algorithms including Fizz Buzz, Bubble Sort, the Fibonacci Sequence, a Sudoku solver, and more. Algorithm Complexity Time and Space

1 Jan 14, 2022
Parameterising Simulated Annealing for the Travelling Salesman Problem

Parameterising Simulated Annealing for the Travelling Salesman Problem Abstract The Travelling Salesman Problem is a well known NP-Hard problem. Given

Gary Sun 55 Jun 15, 2022
All algorithms implemented in Python for education

The Algorithms - Python All algorithms implemented in Python - for education Implementations are for learning purposes only. As they may be less effic

1 Oct 20, 2021
Implemented page rank program

Page Rank Implemented page rank program based on fact that a website is more important if it is linked to by other important websites using recursive

Vaibhaw 6 Aug 24, 2022
GoldenSAML Attack Libraries and Framework

WhiskeySAML and Friends TicketsPlease TicketsPlease: Python library to assist with the generation of Kerberos tickets, remote retrieval of ADFS config

Secureworks 43 Jan 03, 2023
An implementation of ordered dithering algorithm in python as multimedia course project

One way of minimizing the size of an image is to simply reduce the number of bits you use to represent each pixel.

7 Dec 02, 2022
This python algorithm creates a simple house floor plan based on a user-provided CSV file.

This python algorithm creates a simple house floor plan based on a user-provided CSV file. The algorithm generates possible router placements and evaluates where a signal will be reached in every roo

Joshua Miller 1 Nov 12, 2021
Infomap is a network clustering algorithm based on the Map equation.

Infomap Infomap is a network clustering algorithm based on the Map equation. For detailed documentation, see mapequation.org/infomap. For a list of re

347 Dec 23, 2022
It is a platform that implements some path planning algorithms.

PathPlanningAlgorithms It is a platform that implements some path planning algorithms. Main dependence: python3.7, opencv4.1.1.26 (for image show) Tip

5 Feb 24, 2022
Algorithmic virtual trading using the neostox platform

Documentation Neostox doesnt have an API Support, so this is a little selenium code to automate strategies How to use Clone this repository and then m

Abhishek Mittal 3 Jul 20, 2022
Solving a card game with three search algorithms: BFS, IDS, and A*

Search Algorithms Overview In this project, we want to solve a card game with three search algorithms. In this card game, we have to sort our cards by

Korosh 5 Aug 04, 2022