-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Gluschenko/maintenance-1
Maintenance 1
- Loading branch information
Showing
35 changed files
with
779 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,64 @@ | ||
# RenderBox | ||
# Render Box | [![.NET Core Desktop](https://github.com/Gluschenko/render-box/actions/workflows/build.yml/badge.svg)](https://github.com/Gluschenko/render-box/actions/workflows/build.yml) | ||
|
||
[![.NET Core Desktop](https://github.com/Gluschenko/render-box/actions/workflows/build.yml/badge.svg)](https://github.com/Gluschenko/render-box/actions/workflows/build.yml) | ||
![](src/RenderBox/Resources/RenderBoxLogo.png) | ||
|
||
## Introduction | ||
|
||
Main aim of this project is implementation of path tracing algorithm in C# (without GPU optimization at first time). | ||
### Introduction | ||
|
||
The main goal of this project is to implement a path tracing | ||
algorithm in C# (without GPU optimization at first time). | ||
|
||
There are also several different renders, such as the | ||
Mandelbrot Set or Perlin Noise. | ||
|
||
Sources: | ||
|
||
* https://en.wikipedia.org/wiki/Path_tracing (EN) | ||
|
||
* https://ru.wikipedia.org/wiki/Трассировка_пути (RU) | ||
|
||
## Requirements | ||
### Requirements | ||
|
||
* Visual Studio 2019 | ||
* .NET Core SDK 5.0 | ||
|
||
## Renderers | ||
|
||
## Draft (pseudo-code) | ||
### PathRenderer | ||
|
||
Color TracePath(Ray ray, count depth) { | ||
if (depth >= MaxDepth) { | ||
return Black; // Bounced enough times. | ||
} | ||
**Key features:** | ||
* Point lingting | ||
* Soft shadows | ||
* Ambient occlusion | ||
* Transparency & reflection | ||
* Camera movement | ||
|
||
ray.FindNearestObject(); | ||
if (ray.hitSomething == false) { | ||
return Black; // Nothing was hit. | ||
} | ||
![](.media/PTX_7.jpg) | ||
![](.media/PTX_9.jpg) | ||
![](.media/PTX_10.jpg) | ||
![](.media/PTX_11.jpg) | ||
![](.media/PTX_13.jpg) | ||
|
||
Material material = ray.thingHit->material; | ||
Color emittance = material.emittance; | ||
|
||
// Pick a random direction from here and keep going. | ||
Ray newRay; | ||
newRay.origin = ray.pointWhereObjWasHit; | ||
### MandelbrotRenderer | ||
|
||
// This is NOT a cosine-weighted distribution! | ||
newRay.direction = RandomUnitVectorInHemisphereOf(ray.normalWhereObjWasHit); | ||
**Key features:** | ||
* Zoom in / zoon out | ||
* Color filters | ||
|
||
// Probability of the newRay | ||
const float p = 1/(2*M_PI); | ||
![](.media/14.png) | ||
![](.media/10.jpg) | ||
![](.media/13.png) | ||
|
||
// Compute the BRDF for this ray (assuming Lambertian reflection) | ||
float cos_theta = DotProduct(newRay.direction, ray.normalWhereObjWasHit); | ||
Color BRDF = material.reflectance / M_PI ; | ||
### PerlinRenderer | ||
|
||
// Recursively trace reflected light sources. | ||
Color incoming = TracePath(newRay, depth + 1); | ||
![](.media/11.jpg) | ||
|
||
// Apply the Rendering Equation here. | ||
return emittance + (BRDF * incoming * cos_theta / p); | ||
} | ||
### RandomRenderer | ||
|
||
void Render(Image finalImage, count numSamples) { | ||
foreach (pixel in finalImage) { | ||
foreach (i in numSamples) { | ||
Ray r = camera.generateRay(pixel); | ||
pixel.color += TracePath(r, 0); | ||
} | ||
pixel.color /= numSamples; // Average samples. | ||
} | ||
} | ||
|
||
## Work in progress | ||
|
||
![](.media/1.jpg) | ||
![](.media/2.jpg) | ||
![](.media/3.jpg) | ||
![](.media/4.jpg) | ||
![](.media/5.jpg) | ||
![](.media/6.jpg) | ||
![](.media/7.jpg) | ||
![](.media/8.jpg) | ||
![](.media/9.jpg) | ||
![](.media/10.jpg) | ||
![](.media/11.jpg) | ||
![](.media/12.jpg) | ||
![](.media/13.png) | ||
![](.media/14.png) | ||
|
||
## Aim | ||
## Goal of project | ||
|
||
![](.media/aim_1.png) | ||
![](.media/aim_2.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.