Skip to content
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

New ray masking and backface culling implementation #184

Merged
merged 9 commits into from
Jun 8, 2018

Conversation

scschaefer
Copy link
Contributor

@scschaefer scschaefer commented May 16, 2018

Hi,

these commits contain a new ray masking implementation (for all OpenCL intersection kernels) as well as a backface culling implementation (also for all OpenCL intersection kernels).
These new features are optional and are off by default. If either feature is disabled in CMake all code related to them is disabled at compile time to make sure that there is no performance impact.

For a more detailed description of the new features' implementation, please have a look at the commit messages.

I'd love to hear what you think, and if you have any feedback or would like something changed, please let me know.

Cheers,
Sebastian

…e list is empty because it has no associated GPU devices.

All platforms with no associated devices are now deleted from the platforms vector before commencing the unit tests.
Furthermore the test now throws an exception if the list of platforms is empty.
The test was failing if ray masking support was enabled because it didn't force the usage of the 2-level BVH which, at the moment, is the only BVH that supports ray masking.
…ernels.

The remnants of the deprecated ray masking implementation have been removed.
The new ray masking implementation uses the mesh/shape id to distinguish whether a shape is masked or not on a per ray basis.
With this new implementation, each ray can only ignore one specific mesh per call to the intersection kernel. However, the number of unique shapes that can be ignored is only limited by the positive range of a signed integer (MAX_INT - 1).
When ray masking is disabled through the CMake config switch all ray masking checks in the intersection kernels are disabled at compile time to make sure that there is no performance impact when not using the feature.
This implementation utilises the order of the vertices of each triangle to determine whether the side facing the direction of the ray is the front or back side. The front side is defined as the side where all vertices of the triangle are defined in clockwise order.
The implementation makes use of one of the two integer padding fields of the ray data structure to declare whether the ray needs to cull backfaces or not. Thus to enable backface culling for a ray, the new member variable "int doBackfaceCulling;" needs to be set to true/1 either manually or by using the new method "void SetDoBackfaceCulling(bool _bDoBackfaceCulling)".
If backface culling is disabled via the CMake config switch (RR_ENABLE_BACKFACE_CULL; off by default) all backface culling checks in the intersection kernels are disabled at compile time to make sure that there is no performance impact when not using the feature.
Fixed warnings in x64 as well as x86 on visual studio platforms.
Some improvements to the code to make use of C++11 features. (e.g. std::make_unique, = default/delete for constructors and destructors, override, etc.)
Some minor changes were reverted due to GCC compilation errors in linux. (g++ 7.3.0)
@yozhijk
Copy link
Contributor

yozhijk commented May 18, 2018

@scschaefer thanks a lot for your contribution! I will review and merge PR early next week

@scschaefer
Copy link
Contributor Author

@yozhijk Great! Looking forward to your feedback 😃

@yozhijk yozhijk merged commit 3de8f3f into GPUOpen-LibrariesAndSDKs:master Jun 8, 2018
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