MIT License

项目介绍

sinnwrig/URP-Fog-Volumes 是一个托管在 GitHub 上的开源项目,主要使用 C# 编写,采用 MIT License 许可证,目前获得 246 个 Star、22 次 Fork。

仓库全名
sinnwrig/URP-Fog-Volumes
开源许可证
MIT License
Star 数
246
Fork 数
22
未关闭 Issue
2

README 摘要

Raymarched Fog Volumes for Unity's Universal RP This repository is an implementation of single-bounce raymarched volumetric fog for Unity's Universal Render Pipeline. Scenes | Outdoors Light Shafts | URP Samples- Japanese Garden | Nighttime streetlights :-:|:-:|:-:|:-:| More Examples Installation Open the package manager and select the Add package from Git URL option found under the top left dropdown. Add this…

完整内容见 GitHub 原始 README 或本页 。

常见问题

URP-Fog-Volumes 用什么语言开发?

主要使用 C# 编写,采用 MIT License 许可证,目前有 246 个 Star。

URP-Fog-Volumes 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 URP-Fog-Volumes 的源码?

可以直接克隆仓库:git clone https://github.com/sinnwrig/URP-Fog-Volumes.git,默认分支为 main;安装与运行步骤见仓库 README。

URP-Fog-Volumes 最近还在维护吗?

仓库最近一次更新为 1月23日,当前有 2 个未关闭 Issue;Star 数为 246,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Implementation of Raymarched Volumetric Fog in Unity's Universal Render Pipeline

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

C#
HLSL
ShaderLab

README

Raymarched Fog Volumes for Unity’s Universal RP

This repository is an implementation of single-bounce raymarched volumetric fog for Unity’s Universal Render Pipeline.

Scenes Outdoors Light Shafts URP Samples- Japanese Garden Nighttime streetlights
Fog Outdoors Fog Garden Fog Building Fog
No Fog Outdoors
Garden
Building

More Examples

Installation

Features

  • Half & quarter-resolution rendering with depth-aware upsampling (Incompatible with temporal rendering).
  • Temporal Rendering with reprojection (Semi-complete).
  • Animated scrolling 3D texture noise
  • 4 primitive shapes that support non-uniform scale and rotation:
    • Cube
    • Capsule
    • Sphere
    • Cylinder
  • Support for all realtime lights, shadows, and cookies up to a maximum of 32 lights per volume.
    • Lighting is not entirely physically-based, and instead exposes artistic controls for finer tweaking.
    • Light attenuation is only single-bounce, and fog does not self-shadow. Multiple-bounce lightmarching will be added soon.
  • Support for APV GI in Unity 2023.1+
  • Samples for the Gas Station, Forest, and Office Building scenes. These can be imported through the package manager.

Usage

  • Add the Fog Volume Render Feature to your renderers.
  • Create a new Fog Volume in the scene by adding the FogVolume component to any object or using the options under GameObject/Volumes/
  • Create or assign a new profile.
  • Adjust object scale and profile settings until you get your desired look.

Limitations

Unresolvable
  • Does not support DirectX 9 (Desktop GPUs before 2009~2011) or DirectX 11 9.x (DirectX version specifically for Windows Phone and Microsoft Surface RT). These shader models are incompatible with dynamic loops.
  • Temporal Reprojection is disabled in scene view, and only works when in play mode. Unity does not seem to generate consistent motion vectors for the editor view, and causes severe warping/blurring.
  • Temporal Reprojection cannot reproject parts where fog is facing the skybox or empty space. Motion vectors can’t be created where there are no discernible features to track and compute movement.
  • There is currently a hard cap of 32 lights per volume. This cap can be changed by editing the maximum light constants in VolumetricFog.shader and FogVolume.cs
Under Development
  • Does not use physically based light scattering through the volume, as lighting is single-bounce only. This means that for directional lights, volumes will be evenly lit regardless of density. Lightmarching is planned on being added.
  • Orthographic cameras do not work. This is planned on being fixed.
  • Baked lighting and light probes does not work at the moment. This is planned on being fixed.
Transparency Handling

Due to how transparent objects are rendered to the depth texture, transparency does not work out-of-the-box with Fog Volumes and requires some additional render feature setup detailed in this Forum Post, although a brief tutorial will be provided:

  1. Put all the transparent renderers you want affected by fog into their own seperate layer (i.e 'TransparentDepth).
  2. Remove the layer created just now from the Transparent Layer Mask field in the Filtering section of your active URP renderers. These objects will instead be rendered using the render feature.
  3. Add the Render Objects render feature to your renderers before the Fog Volume render reature.
  4. Set the Event field of Render Objects to AfterRenderingTransparents
  5. Under Filters, set the queue to Transparent and the layer mask to our custom transparent depth layer.
  6. Under Overrides, override Depth and enable Write Depth and set the Depth Test to Less Equal

Potential Issues

I am confident the the asset in its current state has no glaring or overly apparent issues. That said, this asset is not backed by heavy testing, and there is a chance that this package may have bugs or not work on some platforms.

This asset has been tested on:

  • OpenGL 4.5.
  • DirectX 11.
  • DirectX 12.
  • Vulkan.
  • Unity version 2022.3.
  • Windows.
  • Linux.

This asset has not been tested, but may work on:

  • Metal.
  • VR or AR platforms.
  • Versions of Unity below 2022.3.
  • macOS.
  • PlayStation devices.
  • Xbox devices.
  • Nintendo devices.
  • iOS.
  • visionOS.
  • Android.
  • WebGL.
  • UWP.
  • tvOS.

Examples

Japanese Forest with and without fog

Outdoors Fog Outdoors

Oasis with and without fog

Oasis Fog Oasis

Building with and without fog

Building Fog Building

Japanese Garden with and without fog

Garden Fog Garden

Gas station with and without fog

Gas Station Fog Gas Station

Demo Terminal Building with fog

Terminal Fog

评论

暂无评论