Skip to content

Commit 0137dcb

Browse files
authored
Merge pull request #63 from Looooong/add-usage-to-readme
Add Usage to Readme
2 parents aec64ad + 44889b0 commit 0137dcb

16 files changed

+231
-63
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
# These are supported funding model platforms
2-
3-
github: []
41
patreon: Looooong
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
custom: # Replace with a single custom sponsorship URL

Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Looooong.SRP.VXGI.Editor",
3+
"references": [
4+
"GUID:2518aed04e27c9a489552a3a49b8243f"
5+
],
6+
"includePlatforms": [
7+
"Editor"
8+
],
9+
"excludePlatforms": [],
10+
"allowUnsafeCode": false,
11+
"overrideReferences": false,
12+
"precompiledReferences": [],
13+
"autoReferenced": true,
14+
"defineConstraints": [],
15+
"versionDefines": [],
16+
"noEngineReferences": false
17+
}

Runtime/ShaderStructs/Looooong.SRP.VXGI.Runtime.ShaderStructs.asmdef.meta renamed to Editor/Looooong.SRP.VXGI.Editor.asmdef.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/VXGIEditor.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace VXGIEditor {
5+
[CustomEditor(typeof(VXGI))]
6+
public class VXGIEditor : Editor {
7+
MonoScript _script;
8+
SerializedProperty _antiAliasing;
9+
SerializedProperty _bound;
10+
SerializedProperty _center;
11+
SerializedProperty _diffuseResolutionScale;
12+
SerializedProperty _followCamera;
13+
SerializedProperty _indirectDiffuseModifier;
14+
SerializedProperty _indirectSpecularModifier;
15+
SerializedProperty _limitRefreshRate;
16+
SerializedProperty _mipmapFilterMode;
17+
SerializedProperty _refreshRate;
18+
SerializedProperty _resolution;
19+
20+
public override void OnInspectorGUI() {
21+
serializedObject.Update();
22+
23+
using (new EditorGUI.DisabledScope(true)) {
24+
EditorGUILayout.ObjectField("Script", _script, typeof(MonoScript), false);
25+
}
26+
27+
EditorGUILayout.PropertyField(_followCamera);
28+
29+
using (new EditorGUI.DisabledScope(_followCamera.boolValue)) {
30+
EditorGUILayout.PropertyField(_center);
31+
}
32+
33+
EditorGUILayout.PropertyField(_bound);
34+
EditorGUILayout.PropertyField(_resolution);
35+
EditorGUILayout.PropertyField(_antiAliasing);
36+
EditorGUILayout.PropertyField(_mipmapFilterMode);
37+
EditorGUILayout.PropertyField(_limitRefreshRate);
38+
39+
if (_limitRefreshRate.boolValue) EditorGUILayout.PropertyField(_refreshRate);
40+
41+
EditorGUILayout.PropertyField(_indirectDiffuseModifier);
42+
EditorGUILayout.PropertyField(_indirectSpecularModifier);
43+
EditorGUILayout.PropertyField(_diffuseResolutionScale);
44+
45+
serializedObject.ApplyModifiedProperties();
46+
}
47+
48+
void OnEnable() {
49+
_script = MonoScript.FromMonoBehaviour((VXGI)target);
50+
_antiAliasing = serializedObject.FindProperty("antiAliasing");
51+
_bound = serializedObject.FindProperty("bound");
52+
_center = serializedObject.FindProperty("center");
53+
_diffuseResolutionScale = serializedObject.FindProperty("diffuseResolutionScale");
54+
_followCamera = serializedObject.FindProperty("followCamera");
55+
_indirectDiffuseModifier = serializedObject.FindProperty("indirectDiffuseModifier");
56+
_indirectSpecularModifier = serializedObject.FindProperty("indirectSpecularModifier");
57+
_limitRefreshRate = serializedObject.FindProperty("limitRefreshRate");
58+
_mipmapFilterMode = serializedObject.FindProperty("mipmapFilterMode");
59+
_refreshRate = serializedObject.FindProperty("refreshRate");
60+
_resolution = serializedObject.FindProperty("resolution");
61+
}
62+
}
63+
}

Editor/VXGIEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/VXGIMipmapDebugEditor.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace VXGIEditor {
5+
[CustomEditor(typeof(VXGIMipmapDebug))]
6+
public class VXGIMipmapDebugEditor : Editor {
7+
public override void OnInspectorGUI() {
8+
DrawDefaultInspector();
9+
}
10+
}
11+
}

Editor/VXGIMipmapDebugEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,62 @@ If you want to fiddle with the source code while using this package, you can [in
3535

3636
For more information on how to manage UPM package, please refer to [this](https://docs.unity3d.com/Manual/upm-ui-actions.html).
3737

38+
## Usage
39+
40+
### Enable VXGI Render Pipeline
41+
42+
+ Goto `Asset/Rendering/VXGI Render Pipeline Asset` to create a new VXGI render pipeline asset.
43+
+ Open **Project Settings** window by going to `Edit/Project Settings...`.
44+
+ Assign the newly created render pipeline asset to `Graphics/Scriptable Render Pipeline Settings`.
45+
46+
### Enable VXGI Rendering on a Camera
47+
48+
+ Add `VXGI` component to a Camera.
49+
+ Assign tag `MainCamera` to the same Camera to preview VXGI rendering in Scene View.
50+
+ *Optional:* Add `VXGI Mipmap Debug` to the same Camera to visualize the voxel mipmap volume.
51+
52+
### Apply VXGI materials to objects in the Scene
53+
54+
Apply the material that uses one of the following VXGI shaders:
55+
56+
+ `VXGI/Standard` and `VXGI/Standard (Specular setup)`
57+
+ Only `Albedo`, `Metallic`, `Specular`, `Smoothness`, `Normal Map` and `Emission` are supported.
58+
+ `VXGI/Particles/Standard Unlit`
59+
+ Only `Additive` rendering mode is supported.
60+
61+
### Light Sources
62+
63+
Directional light, point light and spot light are supported. Lighting fall-off follows the inverse-squared distance model without range attenuation. The fall-off model will be expanded with more options in the future.
64+
65+
## Configuration
66+
67+
### VXGI Component Properties
68+
69+
+ **Voxel Volume**:
70+
+ **Follow Camera**: make the voxel volume center follow the camera position.
71+
+ **Center**: the center of the voxel volume in World Space.
72+
+ **Bound**: the size of the voxel volume in World Space.
73+
+ **Resolution**: the resolution of the voxel volume.
74+
+ **Anti Aliasing**: the anti-aliasing level of the voxelization process.
75+
+ **Mipmap Filter Mode**: specify the method to generate the voxel mipmap volume.
76+
+ **Limit Refresh Rate**: limit the voxel volume refresh rate.
77+
+ **Refresh Rate**: the target refresh rate of the voxel volume.
78+
+ **Rendering**:
79+
+ **Indirect Diffuse Modifier**: how strong the diffuse cone tracing can affect the scene.
80+
+ **Indirect Specular Modifier**: how strong the specular cone tracing can affect the scene.
81+
+ **Diffuse Resolution Scale**: downscale the diffuse cone tracing pass.
82+
83+
### VXGI Mipmap Debug Component Properties
84+
85+
+ **Mipmap Level**: Mipmap level to visualize.
86+
+ **Ray Tracing Step**: how big is a step when ray tracing through the voxel volume.
87+
+ **Filter Mode**: visualization filter mode.
88+
89+
## Known Issues and Limitations
90+
91+
+ VXGI uses geometry shader, which is not supported by few graphics APIs, e.g., Metal.
92+
+ The content of Unity UI element is not displayed in Scene View, but only bounding Rect Transform is displayed. Unity UI element is displayed normally in Game View.
93+
3894
## Contributing
3995

4096
All pull requests are welcome.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "Looooong.SRP.VXGI.Runtime",
33
"references": [
4-
"Unity.Postprocessing.Runtime",
5-
"Looooong.SRP.VXGI.Runtime.ShaderStructs"
4+
"Unity.Postprocessing.Runtime"
65
],
7-
"optionalUnityReferences": [],
86
"includePlatforms": [],
97
"excludePlatforms": [],
108
"allowUnsafeCode": false,
119
"overrideReferences": false,
1210
"precompiledReferences": [],
1311
"autoReferenced": true,
14-
"defineConstraints": []
12+
"defineConstraints": [],
13+
"versionDefines": [],
14+
"noEngineReferences": false
1515
}

0 commit comments

Comments
 (0)