Skip to content

[HDRP][DXR] Make vertex color default to 1.0 instead of 0.0 #5268

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

Merged
merged 4 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed material inspector that allowed setting intensity to an infinite value.
- Fixed issue when switching between non-persistent cameras when path tarcing is enabled (case 1337843).
- Fixed issue with the LayerMaskParameter class storing an erroneous mask value (case 1345515).
- Fixed issue with vertex color defaulting to 0.0 when not defined, in ray/path tracing (case 1348821).

### Changed
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex)

#ifdef ATTRIBUTES_NEED_COLOR
outVertex.color = UnityRayTracingFetchVertexAttribute4(vertexIndex, kVertexAttributeColor);

// We want to default to white in case there is no specified color, to match the raster behaviour
// FIXME: This could be addressed in UnityRayTracingFetchVertexAttribute4(), but until then we use this workaround
if (!any(outVertex.color))
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm... I don't think we should do this here. Can you poke Ionut about this one, it should be done on C++ side I guess or inside UnityRayTracingFetchVertexAttribute4

Copy link
Contributor Author

@eturquin eturquin Jul 30, 2021

Choose a reason for hiding this comment

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

I kinda of agree, but since the UnityRayTracingFetchVertexAttribute4(...) is generic, for all kinds of attributes, it makes sense to return 0 as a default value, rather than 1. What could be done maybe, is passing the result floatN as a parameter, and then return a boolean to indicate if the attribute was found or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok there's a bunch of tests on the attribute data format already in UnityRayTracingFetchVertexAttribute4(...), so I guess we could add one on the attribute type, when returning the value if not found. I'll check with Ionut.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussion ongoing with Ionut, in the meantime we could still merge this (and I added a FIXME comment) until we address this on the engine side.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am good with the fixme for now. And see what Ionut come with.

outVertex.color = 1.0;

#else
outVertex.color = 0.0;
#endif
Expand Down