Added all the Metaball Assets

This commit is contained in:
Bronson Zgeb 2021-02-27 16:18:13 -05:00
parent 687e053e5f
commit 9be094431f
26 changed files with 4855 additions and 0 deletions

8
Assets/Metaballs.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b8c8ad10eb1600f4790eb599e1ac8161
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 98cd545ac62280f4699ed4795be1d76c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,123 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6663363066767020329
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Blur
m_Shader: {fileID: 4800000, guid: c2cce5cab35b66c4482bc5a1d6f4ad99, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
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}
- _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}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0359b9610290c564e9a85a22826ef73f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,127 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4732934821527111394
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: RenderMetaballRT
m_Shader: {fileID: 10751, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
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}
- _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}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.65
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _InvFade: 1
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _SampleGI: 0
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ba62d2f9845041e498edc0cfd32a8813
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,130 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-7183074880569773639
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SphereTraceMetaball
m_Shader: {fileID: -6465566751694194690, guid: f0ab7c2228d751f4ca364672fe5fb923, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2999
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
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}
- _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}
- _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}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- BOOLEAN_82BED64497D74FA4B186DD859BE61CB6: 0
- BOOLEAN_923933FC876E466F9751F89ADC0FDB12: 0
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 1
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- Vector3_ff841d114cec48548b0a41259e363307: {r: 0, g: 0, b: 0, a: 0}
- _Albedo: {r: 0, g: 0.30317068, b: 1, a: 0}
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Emission: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
- _Specular: {r: 0, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e7b8326262253394caa8c9c39653fc4f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e017e53c0b4150f49955b3ad696ff052
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,224 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.Rendering.Universal;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class RenderMetaballs : ScriptableRendererFeature
{
class RenderMetaballsPass : ScriptableRenderPass
{
const string MetaballRTSmallTextureId = "_MetaballRTSmall";
const string MetaballRTLargeTextureId = "_MetaballRTLarge";
const string MetaballRTLarge2TextureId = "_MetaballRTLarge2";
int _metaballRTSmallId;
int _metaballRTLargeId;
int _metaballRTLarge2Id;
public Material BlitMaterial;
public Material BlurMaterial;
public Material BlitCopyMaterial;
public Material BlitCopyWithDepthMaterial;
public Material BlitCopyDepthMaterial;
RenderTargetIdentifier _metaballRTSmall;
RenderTargetIdentifier _metaballRTLarge;
RenderTargetIdentifier _metaballRTLarge2;
RenderTargetIdentifier _cameraTargetId;
RenderTargetIdentifier _cameraDepthTargetId;
RenderQueueType renderQueueType;
FilteringSettings m_FilteringSettings;
RenderObjects.CustomCameraSettings m_CameraSettings;
string m_ProfilerTag;
ProfilingSampler m_ProfilingSampler;
public Material overrideMaterial { get; set; }
public int overrideMaterialPassIndex { get; set; }
List<ShaderTagId> m_ShaderTagIdList = new List<ShaderTagId>();
RenderStateBlock m_RenderStateBlock;
public RenderMetaballsPass(string profilerTag, RenderPassEvent renderPassEvent, string[] shaderTags,
RenderQueueType renderQueueType, int layerMask, RenderObjects.CustomCameraSettings cameraSettings)
{
profilingSampler = new ProfilingSampler(nameof(RenderObjectsPass));
m_ProfilerTag = profilerTag;
m_ProfilingSampler = new ProfilingSampler(profilerTag);
this.renderPassEvent = renderPassEvent;
this.renderQueueType = renderQueueType;
this.overrideMaterial = null;
this.overrideMaterialPassIndex = 0;
RenderQueueRange renderQueueRange = (renderQueueType == RenderQueueType.Transparent)
? RenderQueueRange.transparent
: RenderQueueRange.opaque;
m_FilteringSettings = new FilteringSettings(renderQueueRange, layerMask);
if (shaderTags != null && shaderTags.Length > 0)
{
foreach (var passName in shaderTags)
m_ShaderTagIdList.Add(new ShaderTagId(passName));
}
else
{
m_ShaderTagIdList.Add(new ShaderTagId("SRPDefaultUnlit"));
m_ShaderTagIdList.Add(new ShaderTagId("UniversalForward"));
m_ShaderTagIdList.Add(new ShaderTagId("UniversalForwardOnly"));
m_ShaderTagIdList.Add(new ShaderTagId("LightweightForward"));
}
m_RenderStateBlock = new RenderStateBlock(RenderStateMask.Nothing);
m_CameraSettings = cameraSettings;
BlitCopyMaterial = new Material(Shader.Find("Hidden/BlitCopy"));
BlitCopyWithDepthMaterial = new Material(Shader.Find("Hidden/BlitCopyWithDepth"));
BlitCopyDepthMaterial = new Material(Shader.Find("Hidden/BlitToDepth"));
}
// This method is called before executing the render pass.
// It can be used to configure render targets and their clear state. Also to create temporary render target textures.
// When empty this render pass will render to the active camera render target.
// You should never call CommandBuffer.SetRenderTarget. Instead call <c>ConfigureTarget</c> and <c>ConfigureClear</c>.
// The render pipeline will ensure target setup and clearing happens in a performant manner.
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
{
RenderTextureDescriptor smallBlitTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;
smallBlitTargetDescriptor.width /= 4;
smallBlitTargetDescriptor.height /= 4;
smallBlitTargetDescriptor.colorFormat = RenderTextureFormat.ARGB32;
RenderTextureDescriptor largeBlitTargetDescriptor = renderingData.cameraData.cameraTargetDescriptor;
largeBlitTargetDescriptor.colorFormat = RenderTextureFormat.ARGB32;
var renderer = renderingData.cameraData.renderer;
_metaballRTSmallId = Shader.PropertyToID(MetaballRTSmallTextureId);
_metaballRTLargeId = Shader.PropertyToID(MetaballRTLargeTextureId);
_metaballRTLarge2Id = Shader.PropertyToID(MetaballRTLarge2TextureId);
cmd.GetTemporaryRT(_metaballRTSmallId, smallBlitTargetDescriptor, FilterMode.Bilinear);
cmd.GetTemporaryRT(_metaballRTLargeId, largeBlitTargetDescriptor, FilterMode.Bilinear);
cmd.GetTemporaryRT(_metaballRTLarge2Id, largeBlitTargetDescriptor, FilterMode.Bilinear);
_metaballRTSmall = new RenderTargetIdentifier(_metaballRTSmallId);
_metaballRTLarge = new RenderTargetIdentifier(_metaballRTLargeId);
_metaballRTLarge2 = new RenderTargetIdentifier(_metaballRTLarge2Id);
ConfigureTarget(_metaballRTSmall);
_cameraTargetId = renderer.cameraColorTarget;
_cameraDepthTargetId = new RenderTargetIdentifier("_CameraDepthTexture");// renderer.cameraDepthTarget;
}
// Here you can implement the rendering logic.
// Use <c>ScriptableRenderContext</c> to issue drawing commands or execute command buffers
// https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html
// You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline.
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
{
/*
CommandBuffer cmd = CommandBufferPool.Get();
Blit(cmd, _source, _destination, BlitMaterial);
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
*/
SortingCriteria sortingCriteria = (renderQueueType == RenderQueueType.Transparent)
? SortingCriteria.CommonTransparent
: renderingData.cameraData.defaultOpaqueSortFlags;
DrawingSettings drawingSettings =
CreateDrawingSettings(m_ShaderTagIdList, ref renderingData, sortingCriteria);
drawingSettings.overrideMaterial = overrideMaterial;
drawingSettings.overrideMaterialPassIndex = overrideMaterialPassIndex;
ref CameraData cameraData = ref renderingData.cameraData;
// NOTE: Do NOT mix ProfilingScope with named CommandBuffers i.e. CommandBufferPool.Get("name").
// Currently there's an issue which results in mismatched markers.
CommandBuffer cmd = CommandBufferPool.Get();
using (new ProfilingScope(cmd, m_ProfilingSampler))
{
//Clear small RT
cmd.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
//Blit Camera Depth Texture
Blit(cmd, _cameraDepthTargetId, _metaballRTSmall, BlitCopyDepthMaterial);
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
//Draw to small RT
context.DrawRenderers(renderingData.cullResults, ref drawingSettings, ref m_FilteringSettings,
ref m_RenderStateBlock);
if (m_CameraSettings.overrideCamera && m_CameraSettings.restoreCamera)
{
RenderingUtils.SetViewAndProjectionMatrices(cmd, cameraData.GetViewMatrix(),
cameraData.GetGPUProjectionMatrix(), false);
}
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
//Draw to large RT
cmd.SetRenderTarget(_metaballRTLarge);
cmd.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
Blit(cmd, _metaballRTSmallId, _metaballRTLarge, BlitMaterial);
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
//Blur
cmd.SetGlobalVector("_Offsets", new Vector4(1.5f, 2.0f, 2.5f, 3.0f));
Blit(cmd, _metaballRTLargeId, _metaballRTLarge2, BlurMaterial);
context.ExecuteCommandBuffer(cmd);
cmd.Clear();
//Draw to Camera Target
Blit(cmd, _metaballRTLarge2, _cameraTargetId, BlitMaterial);
}
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);
}
// Cleanup any allocated resources that were created during the execution of this render pass.
public override void OnCameraCleanup(CommandBuffer cmd)
{
cmd.ReleaseTemporaryRT(_metaballRTSmallId);
cmd.ReleaseTemporaryRT(_metaballRTLargeId);
cmd.ReleaseTemporaryRT(_metaballRTLarge2Id);
}
}
public Material blitMaterial;
public Material blurMaterial;
RenderMetaballsPass _scriptableMetaballsPass;
public RenderObjects.RenderObjectsSettings renderObjectsSettings = new RenderObjects.RenderObjectsSettings();
/// <inheritdoc/>
public override void Create()
{
RenderObjects.FilterSettings filter = renderObjectsSettings.filterSettings;
_scriptableMetaballsPass = new RenderMetaballsPass(renderObjectsSettings.passTag, renderObjectsSettings.Event,
filter.PassNames, filter.RenderQueueType, filter.LayerMask, renderObjectsSettings.cameraSettings)
{
BlitMaterial = blitMaterial,
BlurMaterial = blurMaterial
};
}
// Here you can inject one or multiple render passes in the renderer.
// This method is called when setting up the renderer once per-camera.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(_scriptableMetaballsPass);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: df2b5599ec606184aa283db49989a228
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0691897efc7c969499d3bbd864921e79
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,59 @@
using System;
using UnityEngine;
[ExecuteAlways]
public class MetaballParticleManager : MonoBehaviour
{
[SerializeField] ParticleSystem _particleSystem;
Renderer _renderer;
MaterialPropertyBlock _materialPropertyBlock;
const int MaxParticles = 256;
int _numParticles;
ParticleSystem.Particle[] _particles = new ParticleSystem.Particle[MaxParticles];
readonly Vector4[] _particlesPos = new Vector4[MaxParticles];
readonly float[] _particlesSize = new float[MaxParticles];
static readonly int NumParticles = Shader.PropertyToID("_NumParticles");
static readonly int ParticlesSize = Shader.PropertyToID("_ParticlesSize");
static readonly int ParticlesPos = Shader.PropertyToID("_ParticlesPos");
void OnEnable()
{
_materialPropertyBlock = new MaterialPropertyBlock();
_materialPropertyBlock.SetInt(NumParticles, 0);
_renderer = _particleSystem.GetComponent<Renderer>();
_renderer.SetPropertyBlock(_materialPropertyBlock);
}
void OnDisable()
{
_materialPropertyBlock.Clear();
_materialPropertyBlock = null;
_renderer.SetPropertyBlock(null);
}
void Update()
{
_numParticles = _particleSystem.particleCount;
_particleSystem.GetParticles(_particles, MaxParticles);
int i = 0;
foreach (var particle in _particles)
{
_particlesPos[i] = particle.position;
_particlesSize[i] = particle.GetCurrentSize(_particleSystem);
++i;
if (i >= _numParticles) break;
}
_materialPropertyBlock.SetVectorArray(ParticlesPos, _particlesPos);
_materialPropertyBlock.SetFloatArray(ParticlesSize, _particlesSize);
_materialPropertyBlock.SetInt(NumParticles, _numParticles);
_renderer.SetPropertyBlock(_materialPropertyBlock);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 302a675dd757afc4997a7f4c5d7c71fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5125a9fd5171d50488a4e164778ebec2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d3750edc911a62048beecc6e3cbc5ccd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,219 @@
#ifndef METABALL_INCLUDE
#define METABALL_INCLUDE
// Credit to Scratchapixel at
// https://www.scratchapixel.com/lessons/advanced-rendering/rendering-distance-fields/basic-sphere-tracer
// for the explanation on Metaballs and example code
#define MAX_PARTICLES 256
float4 _ParticlesPos[MAX_PARTICLES];
float _ParticlesSize[MAX_PARTICLES];
float _NumParticles;
float GetDistanceSphere(float3 from, float3 center, float radius)
{
return length(from - center) - radius;
}
float GetDistanceMetaball(float3 from)
{
float sumDensity = 0;
float sumRi = 0;
float minDistance = 100000;
for (int i = 0; i < _NumParticles; ++i)
{
float4 center = _ParticlesPos[i];
float radius = 0.3 * _ParticlesSize[i];
float r = length(center - from);
if (r <= radius)
{
sumDensity += 2 * (r * r * r) / (radius * radius * radius) - 3 * (r * r) / (radius * radius) + 1;
}
minDistance = min(minDistance, r - radius);
sumRi += radius;
}
return max(minDistance, (0.2 - sumDensity) / (3 / 2.0 * sumRi));
}
float3 CalculateNormalMetaball(float3 from)
{
float delta = 10e-5;
float3 normal = float3(
GetDistanceMetaball(from + float3(delta, 0, 0)) - GetDistanceMetaball(from + float3(-delta, 0, 0)),
GetDistanceMetaball(from + float3(0, delta, 0)) - GetDistanceMetaball(from + float3(-0, -delta, 0)),
GetDistanceMetaball(from + float3(0, 0, delta)) - GetDistanceMetaball(from + float3(0, 0, -delta))
);
return normalize(normal);
}
void SphereTraceSphereP1_float(float3 WorldPosition, float3 ObjectPosition, out float Alpha)
{
#if defined(SHADERGRAPH_PREVIEW)
Alpha = 1;
#else
float maxDistance = 100;
float threshold = 0.00001;
float t = 0;
int numSteps = 0;
float outAlpha = 0;
float3 viewPosition = GetCurrentViewPosition();
half3 viewDir = SafeNormalize(WorldPosition - viewPosition);
while (t < maxDistance)
{
float minDistance = 1000000;
float3 from = viewPosition + t * viewDir;
float d = GetDistanceSphere(from, float3(0, 0, 0), 0.2);
if (d < minDistance)
{
minDistance = d;
}
if (minDistance <= threshold * t)
{
outAlpha = 1;
break;
}
t += minDistance;
++numSteps;
}
Alpha = outAlpha;
#endif
}
void SphereTraceMetaballs_float(float3 WorldPosition, out float3 PositionWS, out float3 NormalWS, out float Alpha,
out float3 ViewDirection)
{
#if defined(SHADERGRAPH_PREVIEW)
PositionWS = float3(0, 0, 0);
NormalWS = float3(0, 0, 0);
ViewDirection = float3(0, 0, 0);
Alpha = 0;
#else
float maxDistance = 100;
float threshold = 0.00001;
float t = 0;
int numSteps = 0;
float outAlpha = 0;
float3 viewPosition = GetCurrentViewPosition();
half3 viewDir = SafeNormalize(WorldPosition - viewPosition);
while (t < maxDistance)
{
float minDistance = 1000000;
float3 from = viewPosition + t * viewDir;
float d = GetDistanceMetaball(from);
if (d < minDistance)
{
minDistance = d;
}
if (minDistance <= threshold * t)
{
PositionWS = from;
NormalWS = CalculateNormalMetaball(from);
ViewDirection = viewDir;
outAlpha = 1;
break;
}
t += minDistance;
++numSteps;
}
Alpha = outAlpha;
#endif
}
void SphereTraceMetaballs_half(half3 WorldPosition, half3 CameraPosition, out half3 PositionWS, out half3 NormalWS,
out half Alpha, out half3 ViewDirection)
{
#if defined(SHADERGRAPH_PREVIEW)
PositionWS = half3(0, 0, 0);
NormalWS = half3(0, 0, 0);
ViewDirection = half3(0, 0, 0);
Alpha = 0;
#else
half maxDistance = 100;
half threshold = 0.00001;
half t = 0;
int numSteps = 0;
half outAlpha = 0;
half3 viewPosition = GetCurrentViewPosition();
half3 viewDir = SafeNormalize(WorldPosition - viewPosition);
while (t < maxDistance)
{
half minDistance = 1000000;
half3 from = CameraPosition + t * viewDir;
half d = GetDistanceMetaball(from);
if (d < minDistance)
{
minDistance = d;
}
if (minDistance <= threshold * t)
{
PositionWS = from;
NormalWS = CalculateNormalMetaball(from);
ViewDirection = viewDir;
outAlpha = 1;
break;
}
t += minDistance;
++numSteps;
}
Alpha = outAlpha;
#endif
}
void PBR_float(float3 positionWS, half3 normalWS, half3 viewDirectionWS, half3 bakedGI, half3 albedo,
half metallic, half3 specular, half smoothness, half occlusion, half3 emission, half alpha, out float3 Color)
{
#if defined(SHADERGRAPH_PREVIEW)
Color = float3(1, 1, 1);
#else
InputData inputData;
inputData.positionWS = positionWS;
inputData.normalWS = NormalizeNormalPerPixel(normalWS);
inputData.viewDirectionWS = SafeNormalize(-viewDirectionWS);
inputData.shadowCoord = half4(0, 0, 0, 0);
inputData.fogCoord = 0;
inputData.vertexLighting = half3(0, 0, 0);
inputData.normalizedScreenSpaceUV = half2(0, 0);
inputData.shadowMask = half4(0, 0, 0, 0);
inputData.bakedGI = bakedGI;
Color = UniversalFragmentPBR(inputData, albedo, metallic, specular, smoothness, occlusion, emission, alpha);
#endif
}
void PBR_half(half3 positionWS, half3 normalWS, half3 viewDirectionWS, half3 bakedGI, half3 albedo,
half metallic, half3 specular, half smoothness, half occlusion, half3 emission, half alpha, out half3 Color)
{
#if defined(SHADERGRAPH_PREVIEW)
Color = half3(1, 1, 1);
#else
InputData inputData;
inputData.positionWS = positionWS;
inputData.normalWS = NormalizeNormalPerPixel(normalWS);
inputData.viewDirectionWS = SafeNormalize(-viewDirectionWS);
inputData.shadowCoord = half4(0, 0, 0, 0);
inputData.fogCoord = 0;
inputData.vertexLighting = half3(0, 0, 0);
inputData.normalizedScreenSpaceUV = half2(0, 0);
inputData.shadowMask = half4(0, 0, 0, 0);
inputData.bakedGI = bakedGI;
Color = UniversalFragmentPBR(inputData, albedo, metallic, specular, smoothness, occlusion, emission, alpha);
#endif
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: caf3c88af57121045bf42c51439afbe9
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,89 @@
Shader "Custom/KawaseBlur"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
ZWrite Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
half4 _Offsets;
sampler2D _MainTex;
float4 _MainTex_ST;
float4 _MainTex_TexelSize;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 applyBlur(const fixed4 color, const half2 uv, const half2 texelResolution, const half offset)
{
fixed4 result = color;
result += tex2D(_MainTex, uv + half2( offset, offset) * texelResolution);
result += tex2D(_MainTex, uv + half2( offset, -offset) * texelResolution);
result += tex2D(_MainTex, uv + half2(-offset, offset) * texelResolution);
result += tex2D(_MainTex, uv + half2(-offset, -offset) * texelResolution);
result /= 5.0h;
return result;
}
fixed applyAlphaBlur(const fixed4 color, const half2 uv, const half2 texelResolution, const half offset)
{
fixed result = color.a;
result += tex2D(_MainTex, uv + half2( offset, offset) * texelResolution).a;
result += tex2D(_MainTex, uv + half2( offset, -offset) * texelResolution).a;
result += tex2D(_MainTex, uv + half2(-offset, offset) * texelResolution).a;
result += tex2D(_MainTex, uv + half2(-offset, -offset) * texelResolution).a;
result /= 5.0h;
return result;
}
fixed4 frag (const v2f input) : SV_Target
{
const half2 texelResolution = _MainTex_TexelSize.xy;
const half2 uv = input.uv;
fixed4 color = tex2D(_MainTex, uv);
color = applyBlur(color, uv, texelResolution, _Offsets.x);
color.a = applyAlphaBlur(color, uv, texelResolution, _Offsets.y);
color.a = applyAlphaBlur(color, uv, texelResolution, _Offsets.z);
//color.a = applyAlphaBlur(color, uv, texelResolution, _Offsets.w);
return color;
}
ENDCG
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c2cce5cab35b66c4482bc5a1d6f4ad99
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f0ab7c2228d751f4ca364672fe5fb923
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3e0425aecc67598429823555b3a9d936
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}

View File

@ -0,0 +1,675 @@
{
"m_SGVersion": 2,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "c67f2755610844b0bbfd88fca164fd74",
"m_Properties": [],
"m_Keywords": [],
"m_Nodes": [
{
"m_Id": "f0d30474499b41b9918549f2376b3fde"
},
{
"m_Id": "ad6563ebae25440890aa4218c71277ff"
},
{
"m_Id": "539f686a001048859e16d920f18bc6f0"
},
{
"m_Id": "2a4632e7ca3d44308e4c1cb4701ddf52"
},
{
"m_Id": "34dfd4d62933443ab9198502a6c138ae"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "2a4632e7ca3d44308e4c1cb4701ddf52"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "ad6563ebae25440890aa4218c71277ff"
},
"m_SlotId": 5
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "34dfd4d62933443ab9198502a6c138ae"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "ad6563ebae25440890aa4218c71277ff"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "539f686a001048859e16d920f18bc6f0"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "ad6563ebae25440890aa4218c71277ff"
},
"m_SlotId": 1
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "ad6563ebae25440890aa4218c71277ff"
},
"m_SlotId": 3
},
"m_InputSlot": {
"m_Node": {
"m_Id": "f0d30474499b41b9918549f2376b3fde"
},
"m_SlotId": 1
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "ad6563ebae25440890aa4218c71277ff"
},
"m_SlotId": 4
},
"m_InputSlot": {
"m_Node": {
"m_Id": "f0d30474499b41b9918549f2376b3fde"
},
"m_SlotId": 2
}
}
],
"m_VertexContext": {
"m_Position": {
"x": 0.0,
"y": 0.0
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 0.0,
"y": 0.0
},
"m_Blocks": []
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
}
},
"m_Path": "Sub Graphs",
"m_ConcretePrecision": 0,
"m_OutputNode": {
"m_Id": "f0d30474499b41b9918549f2376b3fde"
},
"m_ActiveTargets": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "0281192c2568467bbe25449a4cc300b6",
"m_Id": 1,
"m_DisplayName": "Scale",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Scale",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "0782c357414b405f98e1cea7c8e492aa",
"m_Id": 2,
"m_DisplayName": "Orthographic",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Orthographic",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "0a6bbd9c218541a19ef38e1f602bee58",
"m_Id": 2,
"m_DisplayName": "Alpha",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "11c25e7d94814da696123a9ceda94dbf",
"m_Id": 3,
"m_DisplayName": "Color",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Color",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "143fe474d07e44c5bfb4bef5878a3fd4",
"m_Id": 0,
"m_DisplayName": "Position",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Position",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ObjectNode",
"m_ObjectId": "2a4632e7ca3d44308e4c1cb4701ddf52",
"m_Group": {
"m_Id": ""
},
"m_Name": "Object",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -314.25,
"y": -71.74998474121094,
"width": 99.00000762939453,
"height": 101.0
}
},
"m_Slots": [
{
"m_Id": "143fe474d07e44c5bfb4bef5878a3fd4"
},
{
"m_Id": "0281192c2568467bbe25449a4cc300b6"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_CustomColors": {
"m_SerializableColors": []
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "320dc748e9b64060857be0d7e2645ae8",
"m_Id": 4,
"m_DisplayName": "Alpha",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Alpha",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.PositionNode",
"m_ObjectId": "34dfd4d62933443ab9198502a6c138ae",
"m_Group": {
"m_Id": ""
},
"m_Name": "Position",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -314.25,
"y": -217.75,
"width": 206.0,
"height": 132.0
}
},
"m_Slots": [
{
"m_Id": "b2f86d9c66a145babd15c0d57f776458"
}
],
"synonyms": [],
"m_Precision": 1,
"m_PreviewExpanded": false,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Space": 2
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "3bdde64bcc7f49818b3f58c975d108b2",
"m_Id": 1,
"m_DisplayName": "CameraPosition",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "CameraPosition",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": -0.8999999761581421
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "3f58411f7dab4c629b571402bd57795f",
"m_Id": 6,
"m_DisplayName": "Width",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Width",
"m_StageCapability": 3,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "40231d63c2a141218c2d506494024fb1",
"m_Id": 1,
"m_DisplayName": "Direction",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Direction",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CameraNode",
"m_ObjectId": "539f686a001048859e16d920f18bc6f0",
"m_Group": {
"m_Id": ""
},
"m_Name": "Camera",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -314.25,
"y": 29.25000762939453,
"width": 124.0,
"height": 245.0
}
},
"m_Slots": [
{
"m_Id": "f548c0bc60aa477cb20aed7446053316"
},
{
"m_Id": "40231d63c2a141218c2d506494024fb1"
},
{
"m_Id": "0782c357414b405f98e1cea7c8e492aa"
},
{
"m_Id": "9bee60408d8449a3a4753212596f0093"
},
{
"m_Id": "c2d97606f1f2447b94e4f9b6c2e99b18"
},
{
"m_Id": "bf676bb4c3ca4e6e9f55b54db8c06682"
},
{
"m_Id": "3f58411f7dab4c629b571402bd57795f"
},
{
"m_Id": "ac6b2b428d7b4b70a20a86909fbebfbe"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_CustomColors": {
"m_SerializableColors": []
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "7ac940d20dd64bc693863b3cec444649",
"m_Id": 5,
"m_DisplayName": "ObjWorldPosition",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "ObjWorldPosition",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "8175d4cc33034bd3b134f5e5b5d018b0",
"m_Id": 1,
"m_DisplayName": "Color",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Color",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "9bee60408d8449a3a4753212596f0093",
"m_Id": 3,
"m_DisplayName": "Near Plane",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Near Plane",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "ac6b2b428d7b4b70a20a86909fbebfbe",
"m_Id": 7,
"m_DisplayName": "Height",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Height",
"m_StageCapability": 3,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
"m_ObjectId": "ad6563ebae25440890aa4218c71277ff",
"m_Group": {
"m_Id": ""
},
"m_Name": "Custom Function",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 151.75,
"y": -136.75,
"width": 226.00001525878907,
"height": 142.0
}
},
"m_Slots": [
{
"m_Id": "11c25e7d94814da696123a9ceda94dbf"
},
{
"m_Id": "320dc748e9b64060857be0d7e2645ae8"
},
{
"m_Id": "f027bb40f2da44acbd2f1a492a7ee2b1"
},
{
"m_Id": "7ac940d20dd64bc693863b3cec444649"
},
{
"m_Id": "3bdde64bcc7f49818b3f58c975d108b2"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SourceType": 0,
"m_FunctionName": "SphereTraceSphere",
"m_FunctionSource": "caf3c88af57121045bf42c51439afbe9",
"m_FunctionBody": "Enter function body here..."
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "b2f86d9c66a145babd15c0d57f776458",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "bf676bb4c3ca4e6e9f55b54db8c06682",
"m_Id": 5,
"m_DisplayName": "Z Buffer Sign",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Z Buffer Sign",
"m_StageCapability": 3,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "c2d97606f1f2447b94e4f9b6c2e99b18",
"m_Id": 4,
"m_DisplayName": "Far Plane",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Far Plane",
"m_StageCapability": 3,
"m_Value": 1.0,
"m_DefaultValue": 1.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "f027bb40f2da44acbd2f1a492a7ee2b1",
"m_Id": 0,
"m_DisplayName": "WorldPosition",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "WorldPosition",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SubGraphOutputNode",
"m_ObjectId": "f0d30474499b41b9918549f2376b3fde",
"m_Group": {
"m_Id": ""
},
"m_Name": "Output",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 470.0,
"y": -137.0,
"width": 85.0,
"height": 101.0
}
},
"m_Slots": [
{
"m_Id": "8175d4cc33034bd3b134f5e5b5d018b0"
},
{
"m_Id": "0a6bbd9c218541a19ef38e1f602bee58"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_CustomColors": {
"m_SerializableColors": []
},
"IsFirstSlotValid": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "f548c0bc60aa477cb20aed7446053316",
"m_Id": 0,
"m_DisplayName": "Position",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Position",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0405b877a6048b544bef763a89fc664b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}