-
Notifications
You must be signed in to change notification settings - Fork 390
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
Allow GPU-based shading calculations #7302
Merged
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
2f6f386
Link to Penumbra.
nealkruis 9ad3b1f
Penumbra Cmake fixes (for Windows builds).
nealkruis 3c8e0d4
Merge branch 'develop' into penumbra-integration
nealkruis 2a30fc3
Initial implementation of Penumbra to do shading calculations.
nealkruis 8aafc93
Fix reveal calculations.
nealkruis 674d389
Update penumbra.
nealkruis f041b22
Modify ShadowCalculation object to allow input for GPU-based shading.
nealkruis 341047a
Update testfiles.
nealkruis cf37de5
Merge branch 'develop' into penumbra-integration
nealkruis 7794e71
Add design document.
nealkruis 3030f59
Fix unit tests using 'ShadowCalculation' object.
nealkruis 762b35c
Only run Penumbra tests if OpenGL is available.
nealkruis 9cd3a17
Eliminate function name conflict.
nealkruis aeddb46
Update design doc.
nealkruis f3d0cab
Expand description of existing capabilities.
nealkruis 6f02d69
Add Pixel Counting Resolution field.
nealkruis a0bd5c4
Add interior solar distribution calculations.
nealkruis ebca86b
Separate shader programs for render and calculate.
nealkruis 5170ab3
Remove extra query check.
nealkruis 5709797
Update Penumbra.
nealkruis 0e0e847
Fix minor inconsistencies.
nealkruis a6e3fd4
Merge remote-tracking branch 'origin/develop' into penumbra-integration
mbadams5 139e522
Initial work on gpu performance and multi query
mbadams5 ee6073f
Fix bugs and test new performance ideas
mbadams5 4991f3d
Update for profiling
mbadams5 821ff2d
Don't set penumbra model if there are no surfaces.
nealkruis e0d0615
Merge branch 'develop' into multi_query
mbadams5 e2c55b1
Merge branch 'penumbra-integration' of github.com:NREL/EnergyPlus int…
mbadams5 ed39392
Allow builds without OpenGL (but issue warning).
nealkruis 8adfa69
Merge branch 'develop' into penumbra-integration
nealkruis a0ea07b
Clean up cmake warning.
nealkruis 83db34a
Merge branch 'develop' into penumbra-integration
mbadams5 e9db9fb
Merge remote-tracking branch 'origin/develop' into penumbra-integration
mbadams5 c867e0d
Code clean up
mbadams5 688708f
Fix infinite loop bug in penumbra unit tests
mbadams5 c26aee2
Merge branch 'develop' into penumbra-integration
mbadams5 6870012
Fix build error and initial runtime GPU check
mbadams5 b83c45c
Merge branch 'develop' into penumbra-integration
mbadams5 90da248
Add a an OpenGL on/off CMake flag
jasondegraw 7b74c8c
Fix compile error in unit tests
mbadams5 522116a
Fix failing unit and performance tests
mbadams5 30b1023
Merge remote-tracking branch 'origin/update-license-year' into penumb…
mbadams5 b807e10
Clean up code and fix linux issues
mbadams5 72eebfb
Pass error callback to use E+ error messaging
mbadams5 1b398a1
Merge branch 'develop' into penumbra-integration
mbadams5 76b49a8
Fix two integration errors
mbadams5 5d01fd0
Test mac and windows CI opengl builds
mbadams5 94a46b2
Add GPU context check.
nealkruis e6b6b47
Update penumbra unit tests to not run if it can't create a valid Open…
nealkruis a22b1aa
Merge develop into penumbra-integration.
nealkruis 32a411c
Clean up compiler warnings.
nealkruis fde9a15
Merge remote-tracking branch 'origin/develop' into penumbra-integration
mbadams5 353723a
Fix unit test errors since penumbra error shouldn't fatal
mbadams5 5e06222
Remove unused using statements
mbadams5 e3fc456
Add transition rules.
nealkruis 95b2e30
Fixing failing unit test
mbadams5 dbf990b
Add transition rules description.
nealkruis 742a5ec
Add output rules description.
nealkruis 4b565c3
Fix build warning
mbadams5 a8518d9
Merge branch 'penumbra-integration' of https://github.com/NREL/Energy…
nealkruis 9618585
Draft documentation.
nealkruis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
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
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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
GPU-based Shading Calculations | ||
============================== | ||
|
||
**Neal Kruis, Big Ladder Software, LLC** | ||
|
||
## Justification for New Feature ## | ||
|
||
GPU architecture is optimized for performing geometry operations. Leveraging methodologies used in the gaming industry to represent shadows, the GPU can (in theory) improve computational performance of shading calculations and provide greater flexibility (e.g., handle concave geometries and solar transmission through interior glazing). | ||
|
||
## Approach ## | ||
|
||
The general approach is to use the Pixel Counting methodology described by Jones et al. In this approach, the building is rendered using OpenGL. Each surface is then viewed from the (parallel projection) perspective of the sun. The number of visible pixels for that surface is a proxy for the projected sunlit surface area. Dividing by the cosign of incidence for that surface gives the total sunlit surface area. | ||
|
||
### Exterior Shading ### | ||
|
||
Pixel counting for exterior shading can be handled using Big Ladder's [Penumbra](https://github.com/bigladder/penumbra) library (a C++ implementation of Jones's pixel counting method). | ||
|
||
### Interior Solar Distribution ### | ||
|
||
We will count pixels when viewing the from the perspective of the sun through a window with each internal surface assigned a different color, then use the histogramming functions in OpenGL to report the number of pixels of each color that are visible. This functionality will be added to Penumbra. | ||
|
||
### Pitfalls ### | ||
|
||
#### Hardware requirements #### | ||
|
||
This approach only works if there are graphics drivers (or emulators) that support OpenGL version 2.1 (or higher) on the machine running the code. This introduces a new hardware requirement for EnergyPlus. If GPU-based shading is requested and the required hardware (or emulated hardware) is not present, EnergyPlus will issue a warning and revert to the CPU-based polygon clipping method. | ||
|
||
#### Transparent shading surfaces #### | ||
|
||
Non-opaque shading surfaces are difficult to characterize under this approach (although, from early testing of SolarShadingTest.idf it doesn't appear to be working properly with the CPU calculations either). | ||
|
||
There are a couple potential solutions to this problem: | ||
|
||
1. We use the perforated approach described by Jones. | ||
2. We introduce transparency to the OpenGL rendering and calculate the color of the pixels returned. | ||
3. We render with and without transparent surfaces to evaluate their impact. | ||
|
||
## Input Output Reference Documentation ## | ||
|
||
See proposed changes in [Energy+.idd.in](https://github.com/NREL/EnergyPlus/pull/7302/files#diff-23ccf090b80d26e885712256b9a6d888). Will draft document once IDD is reviewed. | ||
|
||
## Engineering Reference ## | ||
|
||
Mainly a reference to Jones's papers. | ||
|
||
## References ## | ||
|
||
[Fast computer graphics techniques for calculating direct solar radiation on complex building surfaces](http://dx.doi.org/10.1080/19401493.2011.582154) | ||
|
||
Nathaniel L. Jones, Donald P. Greenberg, and Kevin B. Pratt. Journal of Building Performance Simulation. Volume 5, Issue 5, Pages 300-312. June 26, 2011. | ||
|
||
[Hardware accelerated computation of direct solar radiation through transparent shades and screens](https://nljones.github.io/publications/SB12_TS09b_3_Jones.pdf) | ||
|
||
Nathaniel L. Jones and Donald P. Greenberg. 5th National Conference of the International Building Performance Simulation Association-USA. Madison, Wisconsin. August 1-3, 2012 |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this place a limit on the maximum number of surfaces (e.g. maximum number of colors)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this interior calculation work with blinds and shades on windows that are controlled at each timestep? What about shading surfaces with transmittance schedules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to check, but I think we aren't limited to the number of colors. Even still, 255x255x255 = 16,581,375. Hard to imagine there would be more surfaces in a model (let alone a single zone).
Blinds/shades will work the same as they currently do. They aren't part of the shading calculations they affect the transmittance (of the solar through the window).
Scheduled transmittance is a different challenge discussed below in the document.