-
Notifications
You must be signed in to change notification settings - Fork 855
Implementing a water system for HDRP #6109
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
Conversation
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. HDRP SRP Core Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
59449eb
to
c9ff624
Compare
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.
are you sure we don't have all those function already available somewhere?
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.
ok currently it was in cloud :)
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.
Yeah i moved it from cloud specific to a more generic file
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.
So those function should be moved into the file name: com.unity.render-pipelines.high-definition\Runtime\Lighting\SphericalHarmonics.cs . There is other function for SH there.
c9ff624
to
69b924f
Compare
4fc8bb5
to
27fbaa2
Compare
63d4717
to
a7c43ac
Compare
2caf220
to
7e3d2d6
Compare
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.
PR is in good shape for merging a v1 ✔️
We're still missing a few things to be able to consider it really finished like:
- Documentation (will come later since it will evolve with the UX pass coming)
- Metal support (has been disabled for now, but will make a fogbugz as soon as this is merged and hopefully will be fixed asap)
You can find more info in the confluence test document here.
As for the feedback document, most of the issues have been fixed and less serious issues/concerns will be fixed in the upcoming weeks.
Also this needs screenshot updates on the other platforms, but I am going to wait for the branching to do it. @sebastienlagarde |
Fixed some issue with the normal management that improves significantly the rendering at high wind speeds |
$VertexDescription.Position: input.positionOS = vertexDescription.Position; | ||
$VertexDescription.Normal: input.normalOS = vertexDescription.Normal; | ||
$VertexDescription.Tangent: input.tangentOS.xyz = vertexDescription.Tangent; | ||
$VertexDescription.uv0: input.uv0 = vertexDescription.uv0; |
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.
note for me
@@ -0,0 +1,70 @@ | |||
VertexDescriptionInputs AttributesMeshToVertexDescriptionInputs(AttributesMesh input) |
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.
note for me
|
||
// This intends to simulate indirect specular "multi bounce" | ||
float3 attenuation = 1.0f; | ||
if (R.y < 0.0) |
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.
maybe add a comment that it assume Y is up? and assume water is flat
// Update the water surfaces | ||
var commandBuffer = CommandBufferPool.Get(""); | ||
UpdateWaterSurfaces(commandBuffer); | ||
renderContext.ExecuteCommandBuffer(commandBuffer); |
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.
Pure sanity check, @JulienIgnace-Unity any thought about calling update of water surface with command buffer like this?
// Water textures | ||
[Reload("Runtime/RenderPipelineResources/Texture/Water/FoamSurface.png")] | ||
public Texture2D foamSurface; | ||
[Reload("Runtime/RenderPipelineResources/Texture/Water/FoamNormals.tga")] |
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.
Any reasons this isn't a png here?
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.
do later
numBands = nbBands; | ||
|
||
// Allocate the buffers | ||
phillipsSpectrumBuffer = RTHandles.Alloc(simulationResolution, simulationResolution, numBands, dimension: TextureDimension.Tex2DArray, colorFormat: GraphicsFormat.R16G16_SFloat, enableRandomWrite: true, wrapMode: TextureWrapMode.Repeat); |
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.
sanity check, is this always allocated even if water is disabled?
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.
Only allocated if the system is on
|
||
using (var builder = renderGraph.AddRenderPass<WaterRenderingData>("Render Water Surfaces", out var passData, ProfilingSampler.Get(HDProfileId.WaterSurfaceRendering))) | ||
{ | ||
builder.EnableAsyncCompute(false); |
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.
? is it for future testing?
UNITY_TRANSFER_INSTANCE_ID(input, output); | ||
|
||
// Apply the mesh modifications that come from the shader graph | ||
float3 positionOS; |
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.
note for me
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.
Note for self: evaluate the need of duplicated the shaderpasswaterforward.hlsl instead of reusing regular file
GetSurfaceAndBuiltinData(input, V, posInput, surfaceData, builtinData); | ||
|
||
// Light layers need to be set manually here as there is no mesh renderer | ||
builtinData.renderingLayers = DEFAULT_LIGHT_LAYERS; |
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.
Ah good point, light layers will need to works with water, so we will need to add them on the water volume control or the equivalent mesh
Launching the tests, yay! |
81b8b5d
to
8cde6b8
Compare
Did the fixed asked by @sebastienlagarde, rebased master and relaunching the tests |
relaunched tests |
86f8b70
to
9cbf2fc
Compare
Fixed memory leak and relaunching tests |
91b5f7a
to
5874dc4
Compare
|
||
// Make sure to release the resources if they have been created (before HDRP destroys them) | ||
if (simulation != null && simulation.AllocatedTextures()) | ||
simulation.ReleaseSmmulationResources(); |
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 think this is a typo, it should be ReleaseSimulationResources
Note: Sorry if I shouldn't comment on the PR, I saw the comment you left a while back about this but I still thought I should point this out. Have a great day.
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.
{ | ||
// Update the water surfaces | ||
var commandBuffer = CommandBufferPool.Get(""); | ||
UpdateWaterSurfaces(commandBuffer); |
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.
note for me. Maybe run async in the future
https://jira.unity3d.com/browse/HDRP-110
This PR implements an initial version of the Water System for HDRP. It still be significantly improved before
The design and scope document can be found here:
https://confluence.unity3d.com/display/HDRP/HDRP+Water+System
This system allows for the users to add ocean, rivers and pools to their scenes.
Testing status
Check the feedback document here: https://shorturl.at/efluM