Skip to content

Rendering task updates #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open

Rendering task updates #11

wants to merge 53 commits into from

Conversation

seuribe
Copy link

@seuribe seuribe commented Jun 6, 2018

Several small and medium changes to optimize the rendering. The most important one is the use of a pool for Color3f arrays, which reduces considerably garbage collection and allows it to run without problems with less memory.
Other changes include some refactoring / reorganization of the code, and a reduction in the amount of operations needed for some rendering tasks.

seuribe added 11 commits June 6, 2018 09:12
- moved color buffer creation & pooling to the new class
- moved the statistics printing to a separate method
- rename variables
- calculate the square root of the normal length only if needed
- avoid recalculating view direction, take instead the negated ray direction
@seuribe seuribe closed this Jun 6, 2018
@seuribe seuribe reopened this Jun 6, 2018
@seuribe seuribe requested a review from porst17 June 6, 2018 12:22
Copy link
Member

@porst17 porst17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjust the commit messages of your commits (e.g. by interactive rebase + force push). The general rule of thumb in most git projects (including the Linux kernel) is to split the commit messages in two parts separated by a blank line:

Short description (Subject line)

Long description or additional information

A properly formed git commit subject line should always be able to complete the following sentence:
If applied, this commit will <your subject line here>

It starts with a capital letter and has no period at the end.

It never starts with a dash -

You can find more details here.

seuribe added 15 commits June 7, 2018 13:22
By pushing synchronization down to each individual bucket instad of the
pool class, the granularity of locking should be increased, reducing the
chances of threads being blocked.
Separating shading logic makes de code more readable, and opens the doors
to later implementing multiple shading algorithms.
The ray already contains the viewing direction, so it does not need to be
recalculated. By changing which parameters are passed to the shade
function, it's possible to avoid some vector operations.
seuribe added 27 commits June 8, 2018 20:55
This will remove the need for most other instance variables, and allow to remove parameters
from some functions
When vOld == 0, the CSP will have only null pointers, which are never used. When
vOld == the old v, then it will just overwrite the previous CSP set for v. This does not
happen when the hashmap is cleared, but doing so prevents the reuse of the CS and CSG
for different pixels in the same column.
This removes the responsibilities of the rendering methods, as how the CSP is stored
can be considered a different concern. Also, this change opens the doors to changing how
the CSPs are cached, as a hashmap might not be the most efficient solution.
Remove unused and commented out code, replace .* imports with just the needed ones.
A small optimization to avoid creating a new vector and two vector class function calls every time the
similarity of colors is evaluated.
Avoid doing too many conditions inside the tightest loop. Instead, pre-calculate
always the corner rays and then skip them when iterating over the SamplingPoints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants