Skip to content

Conversation

alelievr
Copy link
Member

@alelievr alelievr commented Nov 25, 2020

Purpose of this PR

⚠️ Waiting for Volumetric performance tests to land (ETA: ~2 weeks)

  • Allows the Density Volume component to take a RenderTexture / Custom Render Texture as volume mask
  • Add colored volume masks
  • Higher-resolution volume masks (up to 256 cube configured in the HDRP settings)
  • Added a falloff mode for density volume blend distance (linear or exponential)

Also, improve the 3D Texture atlas to support different 3D texture resolutions and RGBA 3D textures and real-time GPU copy for 3D render textures.

New volumetric settings in the HDRP asset:
image

Falloff mode:
image
Note that the falloff mode doesn't affect the Fade Distance interpolation (which is always linear).

Also added a debug mode to visualize the density volume 3D atlas:
image

With selection support:
image


Testing status

Modified the fog volume test with 3D textures of different resolutions and colors:
image

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/HDRP%252Fdensity-volumes-improvements/.yamato%252Fall-hdrp.yml%2523PR_HDRP_trunk/4610582/job/full-pipeline

Note:

If you want to author texture 3D in unity I recommend this tool: https://github.com/alelievr/Mixture.
You can ask me for installation :)

@alelievr alelievr self-assigned this Nov 25, 2020
@github-actions github-actions bot added the HDRP label Nov 25, 2020
{
volumes.Remove(volume);
}
if (!volumeAtlas.AddTexture(volumeTexture))
Copy link
Contributor

Choose a reason for hiding this comment

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

I might have missed it but does this mean the atlas is updated every frame now? How do we detect if something has changed if not?

Copy link
Member Author

Choose a reason for hiding this comment

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

This only happens when the density volume texture is registered so no. Otherwise the it's the atlas that internally checks if the textures needs to be updated with a hash:
https://github.com/Unity-Technologies/Graphics/pull/2751/files#diff-9452a7b53ae106d6e8115c2ce8966e7dec933f97ce8d7241a18130cc5d9d4af7R373

@alelievr alelievr requested a review from a team December 1, 2020 09:24
@alelievr
Copy link
Member Author

alelievr commented Dec 3, 2020

There will be a volumetric lighting performance test in the automated performance test project soon, we can wait for it to be merged and then see the perf impact with the dashboards

Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

Looks good! I was hitting only one issue though:
Setting Max Density Volume Size to Resolution 256 throws the following:
D3D11: Failed to create render texture resource (3D, 2048x8192x256 mips=14 dxfmt=27, hr=0x30), checking with Antoine a user could be informed with a warning notifying that gpu memory limit is reached

Went through settings, debug modes, exponential/linear settings. No other issues found.

## Creating a Density Mask Texture

4. Click Apply.
1. In image-editing software of your choice, prepare a grayscale flipbook texture and [import it as a 3D texture](https://docs.unity3d.com/2020.2/Documentation/Manual/class-Texture3D.html). For example, a texture of size 1024x32 describes a 3D texture of size 32x32x32 with 32 slices laid out one after another.
Copy link
Contributor

Choose a reason for hiding this comment

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

guess it need to be rewrite as it is not grayscale anymore, we handle RGB

@alelievr
Copy link
Member Author

@TomasKiniulis I fixed the texture failed to create issue

MaxSize

@TomasKiniulis
Copy link
Contributor

@TomasKiniulis I fixed the texture failed to create issue

MaxSize

Thanks! Seems like a nice way to avoid the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants