forked from mlavik1/UnityVolumeRendering
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add inverse masking function for de-occlusion component
- Loading branch information
Showing
21 changed files
with
2,083 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using UnityEngine; | ||
|
||
namespace UnityVolumeRendering | ||
{ | ||
public class ShaderDebugging_Mask : MonoBehaviour | ||
{ | ||
public GameObject target_Mask; | ||
|
||
private Material material_Mask; | ||
private ComputeBuffer buffer_Mask; | ||
public Vector4[] element_Mask; | ||
private string label_Mask; | ||
private Renderer render_Mask; | ||
|
||
MeshRenderer meshRenderer_Mask; | ||
Material mat_Mask; | ||
|
||
|
||
void Load() | ||
{ | ||
buffer_Mask = new ComputeBuffer(10, 16, ComputeBufferType.Default); | ||
element_Mask = new Vector4[10]; | ||
for(int i=0; i < buffer_Mask.count; i++) | ||
{ | ||
element_Mask[i] = new Vector4(0, 0, 0, 0); | ||
} | ||
buffer_Mask.SetData(element_Mask); | ||
|
||
label_Mask = string.Empty; | ||
render_Mask = target_Mask.GetComponent<Renderer>(); | ||
material_Mask = render_Mask.material; | ||
} | ||
|
||
void Start() | ||
{ | ||
Load(); | ||
VolumeRenderedObject_Mask[] objects_Mask = FindObjectsOfType<VolumeRenderedObject_Mask>(); | ||
if (objects_Mask.Length == 1) | ||
{ | ||
meshRenderer_Mask = objects_Mask[0].meshRenderer; | ||
mat_Mask = meshRenderer_Mask.material; | ||
} | ||
} | ||
|
||
void Update() | ||
{ | ||
Graphics.ClearRandomWriteTargets(); | ||
material_Mask.SetPass(0); | ||
material_Mask.SetBuffer("buffer_Mask", buffer_Mask); | ||
Graphics.SetRandomWriteTarget(2, buffer_Mask, false); | ||
|
||
buffer_Mask.GetData(element_Mask); | ||
|
||
label_Mask = (element_Mask != null && render_Mask.isVisible) ? element_Mask[0].ToString() : string.Empty; | ||
} | ||
|
||
void OnGUI() | ||
{ | ||
GUIStyle style = new GUIStyle(); | ||
|
||
GUI.color = Color.white; | ||
style.fontSize = 32; | ||
} | ||
|
||
void OnDestroy() | ||
{ | ||
buffer_Mask.Dispose(); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
100 changes: 100 additions & 0 deletions
100
Assets/Materials/DirectVolumeRenderingMaterial_Mask.mat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!21 &2100000 | ||
Material: | ||
serializedVersion: 6 | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_Name: DirectVolumeRenderingMaterial_Mask | ||
m_Shader: {fileID: 4800000, guid: a20d4a69f209bf64ea10de5efd333aa5, type: 3} | ||
m_ShaderKeywords: MODE_DVR TF2D_ON _MODE_DVR _MODE_MIP | ||
m_LightmapFlags: 4 | ||
m_EnableInstancingVariants: 0 | ||
m_DoubleSidedGI: 0 | ||
m_CustomRenderQueue: -1 | ||
stringTagMap: {} | ||
disabledShaderPasses: | ||
- pass0 | ||
m_SavedProperties: | ||
serializedVersion: 3 | ||
m_TexEnvs: | ||
- _BumpMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _DataTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _DetailAlbedoMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _DetailMask: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _DetailNormalMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _EmissionMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _GradientTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _MainTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _MetallicGlossMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _NoiseTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _OcclusionMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _ParallaxMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _SegmentTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _TFTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
m_Floats: | ||
- _BumpScale: 1 | ||
- _Cutoff: 0.5 | ||
- _DetailNormalMapScale: 1 | ||
- _DstBlend: 0 | ||
- _GlossMapScale: 1 | ||
- _Glossiness: 0.5 | ||
- _GlossyReflections: 1 | ||
- _MaxVal: 1 | ||
- _Metallic: 0 | ||
- _MinVal: 0 | ||
- _Mode: 0 | ||
- _OcclusionStrength: 1 | ||
- _Parallax: 0.02 | ||
- _SmoothnessTextureChannel: 0 | ||
- _SpecularHighlights: 1 | ||
- _SrcBlend: 1 | ||
- _UVSec: 0 | ||
- _ZWrite: 1 | ||
m_Colors: | ||
- _Color: {r: 1, g: 1, b: 1, a: 1} | ||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &1642054173293210335 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 3483431779698201852} | ||
- component: {fileID: 4600922654780393457} | ||
- component: {fileID: 1185744897911437941} | ||
m_Layer: 0 | ||
m_Name: VolumeContainer_Mask | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &3483431779698201852 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1642054173293210335} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!33 &4600922654780393457 | ||
MeshFilter: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1642054173293210335} | ||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} | ||
--- !u!23 &1185744897911437941 | ||
MeshRenderer: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 1642054173293210335} | ||
m_Enabled: 1 | ||
m_CastShadows: 1 | ||
m_ReceiveShadows: 1 | ||
m_DynamicOccludee: 1 | ||
m_MotionVectors: 1 | ||
m_LightProbeUsage: 1 | ||
m_ReflectionProbeUsage: 1 | ||
m_RayTracingMode: 2 | ||
m_RenderingLayerMask: 4294967295 | ||
m_RendererPriority: 0 | ||
m_Materials: | ||
- {fileID: 2100000, guid: dff8f83be22f4104b838e8253440b566, type: 2} | ||
m_StaticBatchInfo: | ||
firstSubMesh: 0 | ||
subMeshCount: 0 | ||
m_StaticBatchRoot: {fileID: 0} | ||
m_ProbeAnchor: {fileID: 0} | ||
m_LightProbeVolumeOverride: {fileID: 0} | ||
m_ScaleInLightmap: 1 | ||
m_ReceiveGI: 1 | ||
m_PreserveUVs: 0 | ||
m_IgnoreNormalsForChartDetection: 0 | ||
m_ImportantGI: 0 | ||
m_StitchLightmapSeams: 0 | ||
m_SelectedEditorRenderState: 3 | ||
m_MinimumChartSize: 4 | ||
m_AutoUVMaxDistance: 0.5 | ||
m_AutoUVMaxAngle: 89 | ||
m_LightmapParameters: {fileID: 0} | ||
m_SortingLayerID: 0 | ||
m_SortingLayer: 0 | ||
m_SortingOrder: 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.