Sample Usages of Cyfra - Brushed Material Simulation and Raytraced Solar System #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brushed Material Simulation:
Implements some features of a raytracer such that a scene containing a sphere and a light source can be drawn.
The ray bounces off of the sphere and gets a color sample from an environment map created using the existing implementation of gradient generation. Multiple samples are taken to simulate a look of brushed material.
Implementation:
The sample is retrieved from the gradient with an offset depending on the ray direction. I used sine to make the effect more appealing:
In here a basis orthogonal to the reflected ray direction is created so that an offset for the reflection can be taken. Then, the offset is sampled uniformly from a disk. This simulates the imperfections in reflections in real life by making the reflection direction be more random. Multiple samples are taken to make the result closer to how a real world object would look like.
Raytraced Solar System:
The visualization showcases something similar to Earth's orbit around the Sun and how the Moon can cause solar eclipses. It is all done using the existing raytracing implementation.