init 1.7.1
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24135be3592d84e49a9079004cf1f7a0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,94 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.HighDefinition;
|
||||
using UnityEngine.Rendering;
|
||||
using System.Reflection;
|
||||
namespace Artngame.LUMINA
|
||||
{
|
||||
class CameraDepthBake : CustomPass
|
||||
{
|
||||
public Camera bakingCamera = null;
|
||||
public RenderTexture depthTexture = null;
|
||||
public RenderTexture normalTexture = null;
|
||||
public RenderTexture tangentTexture = null;
|
||||
public bool render = true;
|
||||
|
||||
//v1.0k
|
||||
public int downscale = 1;
|
||||
|
||||
protected override bool executeInSceneView => false;
|
||||
|
||||
void SyncRenderTextureAspect(RenderTexture rt, Camera camera)
|
||||
{
|
||||
float aspect = rt.width / (float)rt.height;
|
||||
|
||||
if (!Mathf.Approximately(aspect, camera.aspect))
|
||||
{
|
||||
rt.Release();
|
||||
rt.width = camera.pixelWidth / downscale;
|
||||
rt.height = camera.pixelHeight / downscale;
|
||||
rt.Create();
|
||||
}
|
||||
}
|
||||
|
||||
//v0.1
|
||||
bool reset_sync = false;
|
||||
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
|
||||
{
|
||||
reset_sync = true;
|
||||
}
|
||||
|
||||
protected override void Execute(CustomPassContext ctx)
|
||||
{
|
||||
if (!render || ctx.hdCamera.camera == bakingCamera || bakingCamera == null || ctx.hdCamera.camera.cameraType == CameraType.SceneView)
|
||||
return;
|
||||
|
||||
if (depthTexture == null && normalTexture == null && tangentTexture == null)
|
||||
return;
|
||||
|
||||
//depthTexture.width = Screen.width;
|
||||
//depthTexture.height = Screen.height;
|
||||
|
||||
// We need to be careful about the aspect ratio of render textures when doing the culling, otherwise it could result in objects poping:
|
||||
//if (depthTexture != null)
|
||||
// bakingCamera.aspect = Mathf.Max(bakingCamera.aspect, depthTexture.width / (float)depthTexture.height);
|
||||
|
||||
if (reset_sync)
|
||||
{
|
||||
//Debug.Log("Sync texture");
|
||||
SyncRenderTextureAspect(depthTexture, ctx.hdCamera.camera);
|
||||
reset_sync = false;
|
||||
}
|
||||
|
||||
//if(Camera.main != null)
|
||||
//{
|
||||
// bakingCamera.aspect = Camera.main.aspect;
|
||||
// bakingCamera.CopyFrom(Camera.main);
|
||||
//}
|
||||
|
||||
if (normalTexture != null)
|
||||
bakingCamera.aspect = Mathf.Max(bakingCamera.aspect, normalTexture.width / (float)normalTexture.height);
|
||||
if (tangentTexture != null)
|
||||
bakingCamera.aspect = Mathf.Max(bakingCamera.aspect, tangentTexture.width / (float)tangentTexture.height);
|
||||
bakingCamera.TryGetCullingParameters(out var cullingParams);
|
||||
cullingParams.cullingOptions = CullingOptions.None;
|
||||
|
||||
// Assign the custom culling result to the context
|
||||
// so it'll be used for the following operations
|
||||
ctx.cullingResults = ctx.renderContext.Cull(ref cullingParams);
|
||||
var overrideDepthTest = new RenderStateBlock(RenderStateMask.Depth) { depthState = new DepthState(true, CompareFunction.LessEqual) };
|
||||
|
||||
//// Depth
|
||||
// Debug.Log("DEPTH grab");
|
||||
if (depthTexture != null)
|
||||
CustomPassUtils.RenderDepthFromCamera(ctx, bakingCamera, depthTexture, ClearFlag.Depth, bakingCamera.cullingMask, overrideRenderState: overrideDepthTest);
|
||||
|
||||
// Normal
|
||||
if (normalTexture != null)
|
||||
CustomPassUtils.RenderNormalFromCamera(ctx, bakingCamera, normalTexture, ClearFlag.All, bakingCamera.cullingMask, overrideRenderState: overrideDepthTest);
|
||||
|
||||
// Tangent
|
||||
if (tangentTexture != null)
|
||||
CustomPassUtils.RenderTangentFromCamera(ctx, bakingCamera, tangentTexture, ClearFlag.All, bakingCamera.cullingMask, overrideRenderState: overrideDepthTest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 069a2d4d7f7c9884489c448ed40f45db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DepthTexture
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1250
|
||||
m_Height: 693
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 92
|
||||
m_ColorFormat: 0
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86ad3f803cba4e74ca4db7709ccc9ddb
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DepthTextureINTERNAL
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1072
|
||||
m_Height: 554
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 25
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 303909b81613a404a81823b6de2772cc
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,281 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-8379790522900627376
|
||||
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 13
|
||||
hdPluginSubTargetMaterialVersions:
|
||||
m_Keys: []
|
||||
m_Values:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: New Material
|
||||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _DISABLE_SSR_TRANSPARENT
|
||||
- _NORMALMAP_TANGENT_SPACE
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 2225
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses:
|
||||
- TransparentDepthPrepass
|
||||
- TransparentDepthPostpass
|
||||
- TransparentBackface
|
||||
- RayTracingPrepass
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AnisotropyMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseColorMap:
|
||||
m_Texture: {fileID: 8400000, guid: 86ad3f803cba4e74ca4db7709ccc9ddb, type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _CoatMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissiveColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _HeightMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 8400000, guid: 86ad3f803cba4e74ca4db7709ccc9ddb, type: 2}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecularColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SubsurfaceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmissionMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmittanceColorMap:
|
||||
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_Ints: []
|
||||
m_Floats:
|
||||
- _AORemapMax: 1
|
||||
- _AORemapMin: 0
|
||||
- _ATDistance: 1
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlbedoAffectEmissive: 0
|
||||
- _AlphaCutoff: 0.5
|
||||
- _AlphaCutoffEnable: 0
|
||||
- _AlphaCutoffPostpass: 0.5
|
||||
- _AlphaCutoffPrepass: 0.5
|
||||
- _AlphaCutoffShadow: 0.5
|
||||
- _AlphaDstBlend: 0
|
||||
- _AlphaRemapMax: 1
|
||||
- _AlphaRemapMin: 0
|
||||
- _AlphaSrcBlend: 1
|
||||
- _AlphaToMask: 0
|
||||
- _AlphaToMaskInspectorValue: 0
|
||||
- _Anisotropy: 0
|
||||
- _BlendMode: 0
|
||||
- _CoatMask: 0
|
||||
- _CullMode: 2
|
||||
- _CullModeForward: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DepthOffsetEnable: 0
|
||||
- _DetailAlbedoScale: 1
|
||||
- _DetailNormalScale: 1
|
||||
- _DetailSmoothnessScale: 1
|
||||
- _DiffusionProfile: 0
|
||||
- _DiffusionProfileHash: 0
|
||||
- _DisplacementLockObjectScale: 1
|
||||
- _DisplacementLockTilingScale: 1
|
||||
- _DisplacementMode: 0
|
||||
- _DoubleSidedEnable: 0
|
||||
- _DoubleSidedGIMode: 0
|
||||
- _DoubleSidedNormalMode: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlend2: 0
|
||||
- _EmissiveColorMode: 1
|
||||
- _EmissiveExposureWeight: 1
|
||||
- _EmissiveIntensity: 1
|
||||
- _EmissiveIntensityUnit: 0
|
||||
- _EnableBlendModePreserveSpecularLighting: 1
|
||||
- _EnableFogOnTransparent: 1
|
||||
- _EnableGeometricSpecularAA: 0
|
||||
- _EnergyConservingSpecularColor: 1
|
||||
- _HeightAmplitude: 0.02
|
||||
- _HeightCenter: 0.5
|
||||
- _HeightMapParametrization: 0
|
||||
- _HeightMax: 1
|
||||
- _HeightMin: -1
|
||||
- _HeightOffset: 0
|
||||
- _HeightPoMAmplitude: 2
|
||||
- _HeightTessAmplitude: 2
|
||||
- _HeightTessCenter: 0.5
|
||||
- _InvTilingScale: 1
|
||||
- _Ior: 1.5
|
||||
- _IridescenceMask: 1
|
||||
- _IridescenceThickness: 1
|
||||
- _LinkDetailsWithBase: 1
|
||||
- _MaterialID: 1
|
||||
- _Metallic: 0
|
||||
- _MetallicRemapMax: 1
|
||||
- _MetallicRemapMin: 0
|
||||
- _NormalMapSpace: 0
|
||||
- _NormalScale: 1
|
||||
- _ObjectSpaceUVMapping: 0
|
||||
- _ObjectSpaceUVMappingEmissive: 0
|
||||
- _OpaqueCullMode: 2
|
||||
- _PPDLodThreshold: 5
|
||||
- _PPDMaxSamples: 15
|
||||
- _PPDMinSamples: 5
|
||||
- _PPDPrimitiveLength: 1
|
||||
- _PPDPrimitiveWidth: 1
|
||||
- _PerPixelSorting: 0
|
||||
- _RayTracing: 0
|
||||
- _ReceivesSSR: 1
|
||||
- _ReceivesSSRTransparent: 0
|
||||
- _RefractionModel: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessRemapMax: 1
|
||||
- _SmoothnessRemapMin: 0
|
||||
- _SpecularAAScreenSpaceVariance: 0.1
|
||||
- _SpecularAAThreshold: 0.2
|
||||
- _SpecularOcclusionMode: 1
|
||||
- _SrcBlend: 1
|
||||
- _StencilRef: 0
|
||||
- _StencilRefDepth: 8
|
||||
- _StencilRefGBuffer: 10
|
||||
- _StencilRefMV: 40
|
||||
- _StencilWriteMask: 6
|
||||
- _StencilWriteMaskDepth: 9
|
||||
- _StencilWriteMaskGBuffer: 15
|
||||
- _StencilWriteMaskMV: 41
|
||||
- _SubsurfaceMask: 1
|
||||
- _SupportDecals: 1
|
||||
- _SurfaceType: 0
|
||||
- _TexWorldScale: 1
|
||||
- _TexWorldScaleEmissive: 1
|
||||
- _Thickness: 1
|
||||
- _TransmissionEnable: 1
|
||||
- _TransmissionMask: 1
|
||||
- _TransparentBackfaceEnable: 0
|
||||
- _TransparentCullMode: 2
|
||||
- _TransparentDepthPostpassEnable: 0
|
||||
- _TransparentDepthPrepassEnable: 0
|
||||
- _TransparentSortPriority: 0
|
||||
- _TransparentWritingMotionVec: 0
|
||||
- _TransparentZWrite: 0
|
||||
- _UVBase: 0
|
||||
- _UVDetail: 0
|
||||
- _UVEmissive: 0
|
||||
- _UseEmissiveIntensity: 0
|
||||
- _UseShadowThreshold: 0
|
||||
- _ZTestDepthEqualForOpaque: 3
|
||||
- _ZTestGBuffer: 4
|
||||
- _ZTestTransparent: 4
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
|
||||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ef00123947565f43b1e33f0ebe3d224
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: NormalTexture
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1024
|
||||
m_Height: 1024
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 92
|
||||
m_ColorFormat: 74
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 726599e2d3f407d4e9a8eb72cc6b4ce4
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: TangentTexture
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1024
|
||||
m_Height: 1024
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 92
|
||||
m_ColorFormat: 74
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 721fb50329773fa46818e397df5e6872
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,100 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Artngame.LUMINA
|
||||
{
|
||||
|
||||
#region Internal classes
|
||||
|
||||
static class CommonAssets
|
||||
{
|
||||
static Texture2D LoadNoiseTexture()
|
||||
=> Resources.Load<Texture2D>("KinoAquaNoise");
|
||||
|
||||
static Texture2D _noiseTexture;
|
||||
|
||||
public static Texture2D NoiseTexture
|
||||
=> _noiseTexture = _noiseTexture ?? LoadNoiseTexture();
|
||||
}
|
||||
|
||||
static class ShaderIDs
|
||||
{
|
||||
public static int EffectParams1 = Shader.PropertyToID("_EffectParams1");
|
||||
public static int EffectParams2 = Shader.PropertyToID("_EffectParams2");
|
||||
public static int EdgeColor = Shader.PropertyToID("_EdgeColor");
|
||||
public static int FillColor = Shader.PropertyToID("_FillColor");
|
||||
public static int Iteration = Shader.PropertyToID("_Iteration");
|
||||
public static int MainTex = Shader.PropertyToID("_MainTex");
|
||||
public static int NoiseTexture = Shader.PropertyToID("_NoiseTexture");
|
||||
public static int OverlayOpacity = Shader.PropertyToID("_OverlayOpacity");
|
||||
public static int OverlayTexture = Shader.PropertyToID("_OverlayTexture");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public classes
|
||||
|
||||
public enum OverlayMode { Off, Multiply, Overlay, Screen }
|
||||
|
||||
public static class ShaderHelper
|
||||
{
|
||||
public static void SetProperties
|
||||
(Material material,
|
||||
Texture inputTexture,
|
||||
float opacity,
|
||||
Color edgeColor,
|
||||
float edgeContrast,
|
||||
Color fillColor,
|
||||
float blurWidth,
|
||||
float blurFrequency,
|
||||
float hueShift,
|
||||
float interval,
|
||||
int iteration)
|
||||
{
|
||||
var bfreq = Mathf.Exp((blurFrequency - 0.5f) * 6);
|
||||
|
||||
material.SetVector(ShaderIDs.EffectParams1,
|
||||
new Vector4(opacity, interval,blurWidth, bfreq));
|
||||
|
||||
material.SetVector(ShaderIDs.EffectParams2,
|
||||
new Vector2(edgeContrast, hueShift));
|
||||
|
||||
material.SetColor(ShaderIDs.EdgeColor, edgeColor);
|
||||
material.SetColor(ShaderIDs.FillColor, fillColor);
|
||||
material.SetInt(ShaderIDs.Iteration, iteration);
|
||||
|
||||
material.SetTexture(ShaderIDs.MainTex, inputTexture);
|
||||
material.SetTexture(ShaderIDs.NoiseTexture, CommonAssets.NoiseTexture);
|
||||
}
|
||||
|
||||
public static void SetOverlayProperties
|
||||
(Material material, OverlayMode mode, Texture texture, float opacity)
|
||||
{
|
||||
if (mode == OverlayMode.Multiply)
|
||||
material.EnableKeyword("KINO_AQUA_MULTIPLY");
|
||||
else
|
||||
material.DisableKeyword("KINO_AQUA_MULTIPLY");
|
||||
|
||||
if (mode == OverlayMode.Overlay)
|
||||
material.EnableKeyword("KINO_AQUA_OVERLAY");
|
||||
else
|
||||
material.DisableKeyword("KINO_AQUA_OVERLAY");
|
||||
|
||||
if (mode == OverlayMode.Screen)
|
||||
material.EnableKeyword("KINO_AQUA_SCREEN");
|
||||
else
|
||||
material.DisableKeyword("KINO_AQUA_SCREEN");
|
||||
|
||||
if (mode == OverlayMode.Off)
|
||||
material.EnableKeyword("KINO_AQUA_OFF");
|
||||
else
|
||||
material.DisableKeyword("KINO_AQUA_OFF");
|
||||
|
||||
material.SetTexture(ShaderIDs.OverlayTexture, texture);
|
||||
material.SetFloat(ShaderIDs.OverlayOpacity, opacity);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd68995d365804c438447f4a5ba8786a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6bc36dad6a9c3d41a47a8dcef8339f5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Color Copy Pass
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 6
|
||||
m_Width: 244
|
||||
m_Height: 137
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 8
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_UseDynamicScaleExplicit: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84aca646aab26064881d7678e680ab9d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,108 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.HighDefinition;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering.HighDefinition;
|
||||
#endif
|
||||
namespace Artngame.LUMINA
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[CustomPassDrawer(typeof(CopyPassLuminaHDRP))]
|
||||
public class CopyPassLuminaHDRPDrawer : CustomPassDrawer
|
||||
{
|
||||
protected override PassUIFlag commonPassUIFlags => PassUIFlag.Name;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public class CopyPassLuminaHDRP : CustomPass
|
||||
{
|
||||
public enum BufferType
|
||||
{
|
||||
Color,
|
||||
Normal,
|
||||
Roughness,
|
||||
Depth,
|
||||
MotionVectors,
|
||||
}
|
||||
|
||||
public RenderTexture outputRenderTexture;
|
||||
|
||||
[SerializeField, HideInInspector]
|
||||
Shader customCopyShader;
|
||||
Material customCopyMaterial;
|
||||
|
||||
public BufferType bufferType;
|
||||
|
||||
protected override bool executeInSceneView => false;
|
||||
|
||||
int normalPass;
|
||||
int roughnessPass;
|
||||
int depthPass;
|
||||
|
||||
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
|
||||
{
|
||||
if (customCopyShader == null)
|
||||
customCopyShader = Shader.Find("Hidden/FullScreen/CustomCopy");
|
||||
customCopyMaterial = CoreUtils.CreateEngineMaterial(customCopyShader);
|
||||
|
||||
normalPass = customCopyMaterial.FindPass("Normal");
|
||||
roughnessPass = customCopyMaterial.FindPass("Roughness");
|
||||
depthPass = customCopyMaterial.FindPass("Depth");
|
||||
}
|
||||
|
||||
protected override void Execute(CustomPassContext ctx)
|
||||
{
|
||||
if (outputRenderTexture == null || customCopyMaterial == null)
|
||||
return;
|
||||
|
||||
SyncRenderTextureAspect(outputRenderTexture, ctx.hdCamera.camera);
|
||||
|
||||
var scale = RTHandles.rtHandleProperties.rtHandleScale;
|
||||
customCopyMaterial.SetVector("_Scale", scale * downscale); //v1.0k
|
||||
|
||||
switch (bufferType)
|
||||
{
|
||||
default:
|
||||
case BufferType.Color:
|
||||
ctx.cmd.Blit(ctx.cameraColorBuffer, outputRenderTexture, new Vector2(scale.x, scale.y), Vector2.zero, 0, 0);
|
||||
break;
|
||||
case BufferType.Normal:
|
||||
ctx.cmd.Blit(ctx.cameraNormalBuffer, outputRenderTexture, customCopyMaterial, normalPass);
|
||||
break;
|
||||
case BufferType.Roughness:
|
||||
ctx.cmd.Blit(ctx.cameraNormalBuffer, outputRenderTexture, customCopyMaterial, roughnessPass);
|
||||
break;
|
||||
case BufferType.Depth:
|
||||
ctx.cmd.Blit(ctx.cameraNormalBuffer, outputRenderTexture, customCopyMaterial, depthPass);
|
||||
break;
|
||||
case BufferType.MotionVectors:
|
||||
ctx.cmd.Blit(ctx.cameraMotionVectorsBuffer, outputRenderTexture, new Vector2(scale.x, scale.y), Vector2.zero, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//v1.0k
|
||||
public int downscale = 1;
|
||||
|
||||
void SyncRenderTextureAspect(RenderTexture rt, Camera camera)
|
||||
{
|
||||
float aspect = rt.width / (float)rt.height;
|
||||
|
||||
if (!Mathf.Approximately(aspect, camera.aspect))
|
||||
{
|
||||
rt.Release();
|
||||
rt.width = camera.pixelWidth / downscale;
|
||||
rt.height = camera.pixelHeight / downscale;
|
||||
rt.Create();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Cleanup()
|
||||
{
|
||||
CoreUtils.Destroy(customCopyMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69965020b157b6646861c7189ab136eb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,212 @@
|
||||
Shader "Hidden/FullScreen/CustomCopy"
|
||||
{
|
||||
HLSLINCLUDE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ENDHLSL
|
||||
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Name "Normal"
|
||||
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
Blend Off
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
|
||||
#pragma target 4.5
|
||||
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassCommon.hlsl"
|
||||
|
||||
float4 _Scale;
|
||||
float4 SampleBuffer(PositionInputs posInput);
|
||||
|
||||
float4 FullScreenPass(Varyings varyings) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(varyings);
|
||||
float depth = LoadCameraDepth(varyings.positionCS.xy);
|
||||
PositionInputs posInput = GetPositionInput(varyings.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
|
||||
|
||||
return SampleBuffer(posInput);
|
||||
}
|
||||
|
||||
#pragma fragment FullScreenPass
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl"
|
||||
float4 SampleBuffer(PositionInputs posInput)
|
||||
{
|
||||
NormalData normalData;
|
||||
DecodeFromNormalBuffer(posInput.positionSS.xy*_Scale, normalData);//v1.0k
|
||||
|
||||
return float4(normalData.normalWS, 1);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Roughness"
|
||||
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
Blend Off
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
|
||||
#pragma target 4.5
|
||||
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassCommon.hlsl"
|
||||
|
||||
float4 _Scale;
|
||||
float4 SampleBuffer(PositionInputs posInput);
|
||||
|
||||
float4 FullScreenPass(Varyings varyings) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(varyings);
|
||||
float depth = LoadCameraDepth(varyings.positionCS.xy);
|
||||
PositionInputs posInput = GetPositionInput(varyings.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
|
||||
|
||||
return SampleBuffer(posInput);
|
||||
}
|
||||
|
||||
#pragma fragment FullScreenPass
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl"
|
||||
float4 SampleBuffer(PositionInputs posInput)
|
||||
{
|
||||
NormalData normalData;
|
||||
DecodeFromNormalBuffer(posInput.positionSS.xy*_Scale, normalData);//v1.0k
|
||||
|
||||
return float4(normalData.perceptualRoughness, 0, 0, 1);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Depth"
|
||||
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
Blend Off
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
|
||||
/*
|
||||
//#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl"
|
||||
#include "UnityCG.cginc"
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
half4 uv2 : TEXCOORD1;
|
||||
#endif
|
||||
};
|
||||
|
||||
v2f vert(appdata_img v)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = float4(v.texcoord.xy, 1, 1);
|
||||
//o.uv = ComputeScreenPos(o.pos);
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
o.uv2 = float4(v.texcoord.xy, 1, 1);
|
||||
//if (_MainTex_TexelSize.y < 0.0)
|
||||
// o.uv.y = 1.0 - o.uv.y;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
//sampler2D _CameraDepthTexture;
|
||||
sampler2D sampler_CameraDepthTexture;
|
||||
TEXTURE2D_ARRAY(_CameraDepthTexture);
|
||||
//TEXTURE2D_SAMPLER2D(_CameraDepthTexture, sampler_CameraDepthTexture);
|
||||
|
||||
// float GetDepthTexture(float2 coord)
|
||||
//{
|
||||
//#if defined(UNITY_REVERSED_Z)
|
||||
// return 1.0 - tex2Dlod(_CameraDepthTexture, float4(coord.x, coord.y, 0.0, 0.0)).x;
|
||||
//#else
|
||||
// return tex2Dlod(_CameraDepthTexture, float4(coord.x, coord.y, 0.0, 0.0)).x;
|
||||
//#endif
|
||||
// }
|
||||
//#define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0))
|
||||
//#define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r
|
||||
float4 frag(v2f input) : SV_Target
|
||||
{
|
||||
//float depth = GetDepthTexture(input.uv);
|
||||
|
||||
float2 uv = input.uv.xy / input.uv.w;
|
||||
float depth = LOAD_TEXTURE2D_ARRAY(_CameraDepthTexture, uv* float2(1073,632),0 );// SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv);
|
||||
//float depth = UNITY_SAMPLE_TEX2DARRAY_LOD(_CameraDepthTexture, float4(uv* float2(1073, 632),0,0),0);
|
||||
//float depth = SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, sampler_CameraDepthTexture, uv* float2(1073, 632),0);
|
||||
float linearDepth = 1-pow(Linear01Depth(depth),0.02);
|
||||
|
||||
return float4(1, 1, 1, 1)*linearDepth;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#pragma vertex Vert
|
||||
|
||||
#pragma target 4.5
|
||||
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassCommon.hlsl"
|
||||
|
||||
float4 _Scale;
|
||||
float4 SampleBuffer(PositionInputs posInput);
|
||||
|
||||
float4 FullScreenPass(Varyings varyings) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(varyings);
|
||||
float depth = LoadCameraDepth(varyings.positionCS.xy);
|
||||
PositionInputs posInput = GetPositionInput(varyings.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
|
||||
float linearDepth = Linear01Depth(depth, _ZBufferParams);
|
||||
return depth * float4(1, 1, 1, 1);
|
||||
|
||||
return SampleBuffer(posInput);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma fragment FullScreenPass
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl"
|
||||
|
||||
// sampler2D _CameraDepthTexture;
|
||||
float4 SampleBuffer(PositionInputs posInput)
|
||||
{
|
||||
|
||||
|
||||
return float4(posInput.linearDepth, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 247f17c56ca52d245890a623d4453c20
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Depth Copy
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 6
|
||||
m_Width: 244
|
||||
m_Height: 137
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 49
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_UseDynamicScaleExplicit: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb58b2fb6a3f43442982dfdba44f317a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Motion vectors Copy
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 6
|
||||
m_Width: 244
|
||||
m_Height: 137
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 26
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_UseDynamicScaleExplicit: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 850e338cdc2b2f4488a51a9b8848e3c1
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,285 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-2713036762792436944
|
||||
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 13
|
||||
hdPluginSubTargetMaterialVersions:
|
||||
m_Keys: []
|
||||
m_Values:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: New Material
|
||||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _DISABLE_SSR_TRANSPARENT
|
||||
- _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
|
||||
- _MATERIAL_FEATURE_TRANSMISSION
|
||||
- _NORMALMAP_TANGENT_SPACE
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 2225
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses:
|
||||
- TransparentDepthPrepass
|
||||
- TransparentDepthPostpass
|
||||
- TransparentBackface
|
||||
- RayTracingPrepass
|
||||
- MOTIONVECTORS
|
||||
- ForwardEmissiveForDeferred
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AnisotropyMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _CoatMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissiveColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _HeightMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceThicknessMap:
|
||||
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}
|
||||
- _MaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecularColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SubsurfaceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmissionMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmittanceColorMap:
|
||||
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_Ints: []
|
||||
m_Floats:
|
||||
- _AORemapMax: 1
|
||||
- _AORemapMin: 0
|
||||
- _ATDistance: 1
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlbedoAffectEmissive: 0
|
||||
- _AlphaCutoff: 0.5
|
||||
- _AlphaCutoffEnable: 0
|
||||
- _AlphaCutoffPostpass: 0.5
|
||||
- _AlphaCutoffPrepass: 0.5
|
||||
- _AlphaCutoffShadow: 0.5
|
||||
- _AlphaDstBlend: 0
|
||||
- _AlphaRemapMax: 1
|
||||
- _AlphaRemapMin: 0
|
||||
- _AlphaSrcBlend: 1
|
||||
- _AlphaToMask: 0
|
||||
- _AlphaToMaskInspectorValue: 0
|
||||
- _Anisotropy: 0
|
||||
- _BlendMode: 0
|
||||
- _CoatMask: 0
|
||||
- _CullMode: 2
|
||||
- _CullModeForward: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DepthOffsetEnable: 0
|
||||
- _DetailAlbedoScale: 1
|
||||
- _DetailNormalScale: 1
|
||||
- _DetailSmoothnessScale: 1
|
||||
- _DiffusionProfile: 0
|
||||
- _DiffusionProfileHash: 0
|
||||
- _DisplacementLockObjectScale: 1
|
||||
- _DisplacementLockTilingScale: 1
|
||||
- _DisplacementMode: 0
|
||||
- _DoubleSidedEnable: 0
|
||||
- _DoubleSidedGIMode: 0
|
||||
- _DoubleSidedNormalMode: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlend2: 0
|
||||
- _EmissiveColorMode: 1
|
||||
- _EmissiveExposureWeight: 1
|
||||
- _EmissiveIntensity: 1
|
||||
- _EmissiveIntensityUnit: 0
|
||||
- _EnableBlendModePreserveSpecularLighting: 1
|
||||
- _EnableFogOnTransparent: 1
|
||||
- _EnableGeometricSpecularAA: 0
|
||||
- _EnergyConservingSpecularColor: 1
|
||||
- _ForceForwardEmissive: 0
|
||||
- _HeightAmplitude: 0.02
|
||||
- _HeightCenter: 0.5
|
||||
- _HeightMapParametrization: 0
|
||||
- _HeightMax: 1
|
||||
- _HeightMin: -1
|
||||
- _HeightOffset: 0
|
||||
- _HeightPoMAmplitude: 2
|
||||
- _HeightTessAmplitude: 2
|
||||
- _HeightTessCenter: 0.5
|
||||
- _InvTilingScale: 1
|
||||
- _Ior: 1.5
|
||||
- _IridescenceMask: 1
|
||||
- _IridescenceThickness: 1
|
||||
- _LinkDetailsWithBase: 1
|
||||
- _MaterialID: 0
|
||||
- _Metallic: 0
|
||||
- _MetallicRemapMax: 1
|
||||
- _MetallicRemapMin: 0
|
||||
- _NormalMapSpace: 0
|
||||
- _NormalScale: 1
|
||||
- _ObjectSpaceUVMapping: 0
|
||||
- _ObjectSpaceUVMappingEmissive: 0
|
||||
- _OpaqueCullMode: 2
|
||||
- _PPDLodThreshold: 5
|
||||
- _PPDMaxSamples: 15
|
||||
- _PPDMinSamples: 5
|
||||
- _PPDPrimitiveLength: 1
|
||||
- _PPDPrimitiveWidth: 1
|
||||
- _PerPixelSorting: 0
|
||||
- _RayTracing: 0
|
||||
- _ReceivesSSR: 1
|
||||
- _ReceivesSSRTransparent: 0
|
||||
- _RefractionModel: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessRemapMax: 1
|
||||
- _SmoothnessRemapMin: 0
|
||||
- _SpecularAAScreenSpaceVariance: 0.1
|
||||
- _SpecularAAThreshold: 0.2
|
||||
- _SpecularOcclusionMode: 1
|
||||
- _SrcBlend: 1
|
||||
- _StencilRef: 4
|
||||
- _StencilRefDepth: 8
|
||||
- _StencilRefGBuffer: 14
|
||||
- _StencilRefMV: 40
|
||||
- _StencilWriteMask: 6
|
||||
- _StencilWriteMaskDepth: 9
|
||||
- _StencilWriteMaskGBuffer: 15
|
||||
- _StencilWriteMaskMV: 41
|
||||
- _SubsurfaceMask: 1
|
||||
- _SupportDecals: 1
|
||||
- _SurfaceType: 0
|
||||
- _TexWorldScale: 1
|
||||
- _TexWorldScaleEmissive: 1
|
||||
- _Thickness: 1
|
||||
- _TransmissionEnable: 1
|
||||
- _TransmissionMask: 1
|
||||
- _TransparentBackfaceEnable: 0
|
||||
- _TransparentCullMode: 2
|
||||
- _TransparentDepthPostpassEnable: 0
|
||||
- _TransparentDepthPrepassEnable: 0
|
||||
- _TransparentSortPriority: 0
|
||||
- _TransparentWritingMotionVec: 0
|
||||
- _TransparentZWrite: 0
|
||||
- _UVBase: 0
|
||||
- _UVDetail: 0
|
||||
- _UVEmissive: 0
|
||||
- _UseEmissiveIntensity: 0
|
||||
- _UseShadowThreshold: 0
|
||||
- _ZTestDepthEqualForOpaque: 3
|
||||
- _ZTestGBuffer: 4
|
||||
- _ZTestTransparent: 4
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
|
||||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee25a8b313531ec46b372f25134eb379
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Normal Copy
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 6
|
||||
m_Width: 244
|
||||
m_Height: 137
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 48
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_UseDynamicScaleExplicit: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d3a0196f498f794a9de624264e2de25
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Roughness Copy
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 6
|
||||
m_Width: 244
|
||||
m_Height: 137
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 0
|
||||
m_ColorFormat: 45
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_UseDynamicScaleExplicit: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d53756b2322d1f4dbd5ccad36b279f7
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b62e07f633d75048b626bc393544c02
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,510 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Artngame.LUMINA
|
||||
{
|
||||
|
||||
[CustomEditor(typeof(LuminaHDRP))]
|
||||
public class LuminaHDRPEditor : Editor
|
||||
{
|
||||
SerializedObject serObj;
|
||||
|
||||
//v1.6
|
||||
SerializedProperty cutoff;
|
||||
|
||||
//v1.5
|
||||
SerializedProperty useInternalDepth;
|
||||
|
||||
//v1.5
|
||||
SerializedProperty enableLocalLightGI;
|
||||
SerializedProperty shadowedLocalPower;
|
||||
SerializedProperty shadowlessLocalPower;
|
||||
SerializedProperty shadowlessLocalOcclusion;
|
||||
|
||||
//v1.3
|
||||
SerializedProperty proxyNoGeom;
|
||||
|
||||
//v1.2
|
||||
SerializedProperty smoothNormals;
|
||||
|
||||
//v0.7
|
||||
SerializedProperty DitherControl;
|
||||
|
||||
//v0.6
|
||||
SerializedProperty contrastA;
|
||||
SerializedProperty ReflectControl;
|
||||
SerializedProperty disableGI;
|
||||
SerializedProperty updatePerDistance;
|
||||
SerializedProperty updatePerTime;
|
||||
SerializedProperty updateTime;
|
||||
SerializedProperty updateDistance;
|
||||
|
||||
SerializedProperty voxelResolution;
|
||||
SerializedProperty visualizeSunDepthTexture;
|
||||
SerializedProperty visualizeGI;
|
||||
SerializedProperty sun;
|
||||
SerializedProperty giCullingMask;
|
||||
SerializedProperty shadowSpaceSize;
|
||||
SerializedProperty temporalBlendWeight;
|
||||
SerializedProperty visualizeVoxels;
|
||||
SerializedProperty updateGI;
|
||||
SerializedProperty skyColor;
|
||||
SerializedProperty voxelSpaceSize;
|
||||
SerializedProperty useBilateralFiltering;
|
||||
SerializedProperty halfResolution;
|
||||
SerializedProperty stochasticSampling;
|
||||
SerializedProperty infiniteBounces;
|
||||
SerializedProperty followTransform;
|
||||
SerializedProperty cones;
|
||||
SerializedProperty coneTraceSteps;
|
||||
SerializedProperty coneLength;
|
||||
SerializedProperty coneWidth;
|
||||
SerializedProperty occlusionStrength;
|
||||
SerializedProperty nearOcclusionStrength;
|
||||
SerializedProperty occlusionPower;
|
||||
SerializedProperty coneTraceBias;
|
||||
SerializedProperty nearLightGain;
|
||||
SerializedProperty giGain;
|
||||
SerializedProperty secondaryBounceGain;
|
||||
SerializedProperty softSunlight;
|
||||
SerializedProperty doReflections;
|
||||
SerializedProperty voxelAA;
|
||||
SerializedProperty reflectionSteps;
|
||||
SerializedProperty skyReflectionIntensity;
|
||||
SerializedProperty gaussianMipFilter;
|
||||
SerializedProperty reflectionOcclusionPower;
|
||||
SerializedProperty farOcclusionStrength;
|
||||
SerializedProperty farthestOcclusionStrength;
|
||||
SerializedProperty secondaryCones;
|
||||
SerializedProperty secondaryOcclusionStrength;
|
||||
SerializedProperty skyIntensity;
|
||||
SerializedProperty sphericalSkylight;
|
||||
SerializedProperty innerOcclusionLayers;
|
||||
|
||||
LuminaHDRP instance;
|
||||
|
||||
const string presetPath = "Assets/ARTnGAME/Lumina/Scripts/SEGI/Resources/Presets";
|
||||
|
||||
GUIStyle headerStyle;
|
||||
GUIStyle vramLabelStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
GUIStyle s = new GUIStyle(EditorStyles.boldLabel);
|
||||
s.fontStyle = FontStyle.Italic;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
//v0.6
|
||||
bool showAdvancedTools = true;
|
||||
bool showAllParameters = false;
|
||||
bool showUpdateControls = true;
|
||||
|
||||
bool showMainConfig = true;
|
||||
bool showDebugTools = false;
|
||||
bool showTracingProperties = true;
|
||||
bool showEnvironmentProperties = true;
|
||||
bool showPresets = true;
|
||||
bool showReflectionProperties = true;
|
||||
|
||||
string presetToSaveName;
|
||||
|
||||
int presetPopupIndex;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
serObj = new SerializedObject(target);
|
||||
|
||||
//v1.6
|
||||
cutoff = serObj.FindProperty("cutoff");
|
||||
|
||||
//v1.5
|
||||
useInternalDepth = serObj.FindProperty("useInternalDepth");
|
||||
|
||||
//v1.5
|
||||
enableLocalLightGI = serObj.FindProperty("enableLocalLightGI");
|
||||
shadowedLocalPower = serObj.FindProperty("shadowedLocalPower");
|
||||
shadowlessLocalPower = serObj.FindProperty("shadowlessLocalPower");
|
||||
shadowlessLocalOcclusion = serObj.FindProperty("shadowlessLocalOcclusion");
|
||||
|
||||
//v1.3
|
||||
proxyNoGeom = serObj.FindProperty("proxyNoGeom");
|
||||
|
||||
//v1.2
|
||||
smoothNormals = serObj.FindProperty("smoothNormals");
|
||||
|
||||
//v0.7
|
||||
DitherControl = serObj.FindProperty("DitherControl");
|
||||
|
||||
//v0.6
|
||||
contrastA = serObj.FindProperty("contrastA");
|
||||
ReflectControl = serObj.FindProperty("ReflectControl");
|
||||
|
||||
disableGI = serObj.FindProperty("disableGI");
|
||||
updatePerDistance = serObj.FindProperty("updatePerDistance");
|
||||
updatePerTime = serObj.FindProperty("updatePerTime");
|
||||
updateTime = serObj.FindProperty("updateTime");
|
||||
updateDistance = serObj.FindProperty("updateDistance");
|
||||
|
||||
voxelResolution = serObj.FindProperty("voxelResolution");
|
||||
visualizeSunDepthTexture = serObj.FindProperty("visualizeSunDepthTexture");
|
||||
visualizeGI = serObj.FindProperty("visualizeGI");
|
||||
sun = serObj.FindProperty("sun");
|
||||
giCullingMask = serObj.FindProperty("giCullingMask");
|
||||
shadowSpaceSize = serObj.FindProperty("shadowSpaceSize");
|
||||
temporalBlendWeight = serObj.FindProperty("temporalBlendWeight");
|
||||
visualizeVoxels = serObj.FindProperty("visualizeVoxels");
|
||||
updateGI = serObj.FindProperty("updateGI");
|
||||
skyColor = serObj.FindProperty("skyColor");
|
||||
voxelSpaceSize = serObj.FindProperty("voxelSpaceSize");
|
||||
useBilateralFiltering = serObj.FindProperty("useBilateralFiltering");
|
||||
halfResolution = serObj.FindProperty("halfResolution");
|
||||
stochasticSampling = serObj.FindProperty("stochasticSampling");
|
||||
infiniteBounces = serObj.FindProperty("infiniteBounces");
|
||||
followTransform = serObj.FindProperty("followTransform");
|
||||
cones = serObj.FindProperty("cones");
|
||||
coneTraceSteps = serObj.FindProperty("coneTraceSteps");
|
||||
coneLength = serObj.FindProperty("coneLength");
|
||||
coneWidth = serObj.FindProperty("coneWidth");
|
||||
occlusionStrength = serObj.FindProperty("occlusionStrength");
|
||||
nearOcclusionStrength = serObj.FindProperty("nearOcclusionStrength");
|
||||
occlusionPower = serObj.FindProperty("occlusionPower");
|
||||
coneTraceBias = serObj.FindProperty("coneTraceBias");
|
||||
nearLightGain = serObj.FindProperty("nearLightGain");
|
||||
giGain = serObj.FindProperty("giGain");
|
||||
secondaryBounceGain = serObj.FindProperty("secondaryBounceGain");
|
||||
softSunlight = serObj.FindProperty("softSunlight");
|
||||
doReflections = serObj.FindProperty("doReflections");
|
||||
voxelAA = serObj.FindProperty("voxelAA");
|
||||
reflectionSteps = serObj.FindProperty("reflectionSteps");
|
||||
skyReflectionIntensity = serObj.FindProperty("skyReflectionIntensity");
|
||||
gaussianMipFilter = serObj.FindProperty("gaussianMipFilter");
|
||||
reflectionOcclusionPower = serObj.FindProperty("reflectionOcclusionPower");
|
||||
farOcclusionStrength = serObj.FindProperty("farOcclusionStrength");
|
||||
farthestOcclusionStrength = serObj.FindProperty("farthestOcclusionStrength");
|
||||
secondaryCones = serObj.FindProperty("secondaryCones");
|
||||
secondaryOcclusionStrength = serObj.FindProperty("secondaryOcclusionStrength");
|
||||
skyIntensity = serObj.FindProperty("skyIntensity");
|
||||
sphericalSkylight = serObj.FindProperty("sphericalSkylight");
|
||||
innerOcclusionLayers = serObj.FindProperty("innerOcclusionLayers");
|
||||
|
||||
|
||||
instance = target as LuminaHDRP;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serObj.Update();
|
||||
|
||||
//Presets
|
||||
showPresets = EditorGUILayout.Foldout(showPresets, new GUIContent("Presets"));
|
||||
if (showPresets)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
string[] presetGUIDs = AssetDatabase.FindAssets("t:LUMINAPreset", new string[1] { presetPath });
|
||||
string[] presetNames = new string[presetGUIDs.Length];
|
||||
string[] presetPaths = new string[presetGUIDs.Length];
|
||||
|
||||
for (int i = 0; i < presetGUIDs.Length; i++)
|
||||
{
|
||||
presetPaths[i] = AssetDatabase.GUIDToAssetPath(presetGUIDs[i]);
|
||||
presetNames[i] = System.IO.Path.GetFileNameWithoutExtension(presetPaths[i]);
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
presetPopupIndex = EditorGUILayout.Popup("", presetPopupIndex, presetNames);
|
||||
|
||||
if (GUILayout.Button("Load"))
|
||||
{
|
||||
if (presetPaths.Length > 0)
|
||||
{
|
||||
LUMINAPreset preset = AssetDatabase.LoadAssetAtPath<LUMINAPreset>(presetPaths[presetPopupIndex]);
|
||||
Undo.RecordObject(target, "Loaded LUMINA Preset");
|
||||
instance.ApplyPreset(preset);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
presetToSaveName = EditorGUILayout.TextField(presetToSaveName);
|
||||
|
||||
if (GUILayout.Button("Save"))
|
||||
{
|
||||
SavePreset(presetToSaveName);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
|
||||
//v0.5
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//if (GUILayout.Button("Setup LUMINA on Default renderer"))
|
||||
//{
|
||||
// instance.setupForwardRendererLUMINA = true;
|
||||
//}
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
//EditorGUILayout.BeginHorizontal();
|
||||
//if (GUILayout.Button("Setup LUMINA Voxel Renderer on 2ond Pipeline renderer"))
|
||||
//{
|
||||
// instance.setupForwardRendererHELPER = true;
|
||||
//}
|
||||
//EditorGUILayout.EndHorizontal();
|
||||
|
||||
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
//Main Configuration
|
||||
EditorGUILayout.PropertyField(disableGI, new GUIContent("Disable GI", "Disable all GI calculations"));
|
||||
showMainConfig = EditorGUILayout.Foldout(showMainConfig, new GUIContent("Main Configuration"));
|
||||
if (showMainConfig)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
//v1.2
|
||||
EditorGUILayout.PropertyField(smoothNormals, new GUIContent("Smooth Normals", "Use one for precision normals and other values for artistic effects"));
|
||||
|
||||
EditorGUILayout.PropertyField(voxelResolution, new GUIContent("Voxel Resolution", "The resolution of the voxel texture used to calculate GI."));
|
||||
EditorGUILayout.PropertyField(voxelAA, new GUIContent("Voxel AA", "Enables anti-aliasing during voxelization for higher precision voxels."));
|
||||
EditorGUILayout.PropertyField(innerOcclusionLayers, new GUIContent("Inner Occlusion Layers", "Enables the writing of additional black occlusion voxel layers on the back face of geometry. Can help with light leaking but may cause artifacts with small objects."));
|
||||
EditorGUILayout.PropertyField(gaussianMipFilter, new GUIContent("Gaussian Mip Filter", "Enables gaussian filtering during mipmap generation. This can improve visual smoothness and consistency, particularly with large moving objects."));
|
||||
EditorGUILayout.PropertyField(voxelSpaceSize, new GUIContent("Voxel Space Size", "The size of the voxel volume in world units. Everything inside the voxel volume will contribute to GI."));
|
||||
EditorGUILayout.PropertyField(shadowSpaceSize, new GUIContent("Shadow Space Size", "The size of the sun shadow texture used to inject sunlight with shadows into the voxels in world units. It is recommended to set this value similar to Voxel Space Size."));
|
||||
EditorGUILayout.PropertyField(giCullingMask, new GUIContent("GI Culling Mask", "Which layers should be voxelized and contribute to GI."));
|
||||
EditorGUILayout.PropertyField(updateGI, new GUIContent("Update GI", "Whether voxelization and multi-bounce rendering should update every frame. When disabled, GI tracing will use cached data from the last time this was enabled."));
|
||||
EditorGUILayout.PropertyField(infiniteBounces, new GUIContent("Infinite Bounces", "Enables infinite bounces. This is expensive for complex scenes and is still experimental."));
|
||||
EditorGUILayout.PropertyField(followTransform, new GUIContent("Follow Transform", "If provided, the voxel volume will follow and be centered on this object instead of the camera. Useful for top-down scenes."));
|
||||
EditorGUILayout.EndVertical();
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("VRAM Usage: " + instance.vramUsage.ToString("F2") + " MB", vramLabelStyle);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
|
||||
|
||||
|
||||
//Environment
|
||||
showEnvironmentProperties = EditorGUILayout.Foldout(showEnvironmentProperties, new GUIContent("Environment Properties"));
|
||||
if (instance.sun == null)
|
||||
{
|
||||
showEnvironmentProperties = true;
|
||||
}
|
||||
if (showEnvironmentProperties)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(sun, new GUIContent("Sun", "The main directional light that will cast indirect light into the scene (sunlight or moonlight)."));
|
||||
EditorGUILayout.PropertyField(softSunlight, new GUIContent("Soft Sunlight", "The amount of soft diffuse sunlight that will be added to the scene. Use this to simulate the effect of clouds/haze scattering soft sunlight onto the scene."));
|
||||
EditorGUILayout.PropertyField(skyColor, new GUIContent("Sky Color", "The color of the light scattered onto the scene coming from the sky."));
|
||||
EditorGUILayout.PropertyField(skyIntensity, new GUIContent("Sky Intensity", "The brightness of the sky light."));
|
||||
EditorGUILayout.PropertyField(sphericalSkylight, new GUIContent("Spherical Skylight", "If enabled, light from the sky will come from all directions. If disabled, light from the sky will only come from the top hemisphere."));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
|
||||
//Tracing properties
|
||||
showTracingProperties = EditorGUILayout.Foldout(showTracingProperties, new GUIContent("Tracing Properties"));
|
||||
if (showTracingProperties)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(temporalBlendWeight, new GUIContent("Temporal Blend Weight", "The lower the value, the more previous frames will be blended with the current frame. Lower values result in smoother GI that updates less quickly."));
|
||||
EditorGUILayout.PropertyField(useBilateralFiltering, new GUIContent("Bilateral Filtering", "Enables filtering of the GI result to reduce noise."));
|
||||
EditorGUILayout.PropertyField(halfResolution, new GUIContent("Half Resolution", "If enabled, GI tracing will be done at half screen resolution. Improves speed of GI tracing."));
|
||||
EditorGUILayout.PropertyField(stochasticSampling, new GUIContent("Stochastic Sampling", "If enabled, uses random jitter to reduce banding and discontinuities during GI tracing."));
|
||||
|
||||
EditorGUILayout.PropertyField(cones, new GUIContent("Cones", "The number of cones that will be traced in different directions for diffuse GI tracing. More cones result in a smoother result at the cost of performance."));
|
||||
EditorGUILayout.PropertyField(coneTraceSteps, new GUIContent("Cone Trace Steps", "The number of tracing steps for each cone. Too few results in skipping thin features. Higher values result in more accuracy at the cost of performance."));
|
||||
EditorGUILayout.PropertyField(coneLength, new GUIContent("Cone length", "The number of cones that will be traced in different directions for diffuse GI tracing. More cones result in a smoother result at the cost of performance."));
|
||||
EditorGUILayout.PropertyField(coneWidth, new GUIContent("Cone Width", "The width of each cone. Wider cones cause a softer and smoother result but affect accuracy and incrase over-occlusion. Thinner cones result in more accurate tracing with less coherent (more noisy) results and a higher tracing cost."));
|
||||
EditorGUILayout.PropertyField(coneTraceBias, new GUIContent("Cone Trace Bias", "The amount of offset above a surface that cone tracing begins. Higher values reduce \"voxel acne\" (similar to \"shadow acne\"). Values that are too high result in light-leaking."));
|
||||
EditorGUILayout.PropertyField(occlusionStrength, new GUIContent("Occlusion Strength", "The strength of shadowing solid objects will cause. Affects the strength of all indirect shadows."));
|
||||
EditorGUILayout.PropertyField(nearOcclusionStrength, new GUIContent("Near Occlusion Strength", "The strength of shadowing nearby solid objects will cause. Only affects the strength of very close blockers."));
|
||||
EditorGUILayout.PropertyField(farOcclusionStrength, new GUIContent("Far Occlusion Strength", "How much light far occluders block. This value gives additional light blocking proportional to the width of the cone at each trace step."));
|
||||
EditorGUILayout.PropertyField(farthestOcclusionStrength, new GUIContent("Farthest Occlusion Strength", "How much light the farthest occluders block. This value gives additional light blocking proportional to (cone width)^2 at each trace step."));
|
||||
EditorGUILayout.PropertyField(occlusionPower, new GUIContent("Occlusion Power", "The strength of shadowing far solid objects will cause. Only affects the strength of far blockers. Decrease this value if wide cones are causing over-occlusion."));
|
||||
EditorGUILayout.PropertyField(nearLightGain, new GUIContent("Near Light Gain", "Affects the attenuation of indirect light. Higher values allow for more close-proximity indirect light. Lower values reduce close-proximity indirect light, sometimes resulting in a cleaner result."));
|
||||
EditorGUILayout.PropertyField(giGain, new GUIContent("GI Gain", "The overall brightness of indirect light. For Near Light Gain values around 1, a value of 1 for this property is recommended for a physically-accurate result."));
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.PropertyField(secondaryBounceGain, new GUIContent("Secondary Bounce Gain", "Affects the strength of secondary/infinite bounces. Be careful, values above 1 can cause runaway light bouncing and flood areas with extremely bright light!"));
|
||||
EditorGUILayout.PropertyField(secondaryCones, new GUIContent("Secondary Cones", "The number of secondary cones that will be traced for calculating infinte bounces. Increasing this value improves the accuracy of secondary bounces at the cost of performance. Note: the performance cost of this scales with voxelized scene complexity."));
|
||||
EditorGUILayout.PropertyField(secondaryOcclusionStrength, new GUIContent("Secondary Occlusion Strength", "The strength of light blocking during secondary bounce tracing. Be careful, a value too low can cause runaway light bouncing and flood areas with extremely bright light!"));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
showReflectionProperties = EditorGUILayout.Foldout(showReflectionProperties, new GUIContent("Reflection Properties"));
|
||||
if (showReflectionProperties)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(doReflections, new GUIContent("Do Reflections", "Enable this for cone-traced reflections."));
|
||||
EditorGUILayout.PropertyField(reflectionSteps, new GUIContent("Reflection Steps", "Number of reflection trace steps."));
|
||||
EditorGUILayout.PropertyField(reflectionOcclusionPower, new GUIContent("Reflection Occlusion Power", "Strength of light blocking during reflection tracing."));
|
||||
EditorGUILayout.PropertyField(skyReflectionIntensity, new GUIContent("Sky Reflection Intensity", "Intensity of sky reflections."));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
//Advanced Tools tools
|
||||
showAdvancedTools = EditorGUILayout.Foldout(showAdvancedTools, new GUIContent("Advanced Settings"));
|
||||
if (showAdvancedTools)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(contrastA, new GUIContent("Contrast", "Change scene Contrast (1-contrastA)*_GBuffer3 +(contrastA * _GBuffer1*_GBuffer3)"));
|
||||
EditorGUILayout.PropertyField(ReflectControl, new GUIContent("Reflection and blend controls", "Specular power(X), _GBuffer0(Y), _GBuffer1(Z) powers, Z=Not used "));
|
||||
|
||||
//v0.7
|
||||
EditorGUILayout.PropertyField(DitherControl, new GUIContent("Dither optimization controls", "Dirther Power(x)-Trace Directions(y)-Trece Steps(z)-Reflections Steps(w) Dividers"));
|
||||
|
||||
//v1.3
|
||||
EditorGUILayout.PropertyField(proxyNoGeom, new GUIContent("Approximation Mode", "Approximation Mode, without use of Geometry Shader"));
|
||||
|
||||
//v1.5
|
||||
EditorGUILayout.PropertyField(enableLocalLightGI, new GUIContent("Enable GI from Local Lights", "Enable GI from Local Spot and Point lights"));
|
||||
EditorGUILayout.PropertyField(shadowedLocalPower, new GUIContent("Shadowed local lights GI Power", "Shadowed local lights GI Power"));
|
||||
EditorGUILayout.PropertyField(shadowlessLocalPower, new GUIContent("Shadowless local lights GI Power", "The GI will be in the whole volume of lights."));
|
||||
EditorGUILayout.PropertyField(shadowlessLocalOcclusion, new GUIContent("Shadowless local lights GI Occlusion Power", "Enable occlusion in the shadowless mode."));
|
||||
|
||||
//v1.5
|
||||
EditorGUILayout.PropertyField(useInternalDepth, new GUIContent("use Internal HDRP Depth buffer", "Use Internal HDRP Depth buffer to remove custom depth rendering."));
|
||||
|
||||
//v1.6
|
||||
EditorGUILayout.PropertyField(cutoff, new GUIContent("Depth Based Occlusion Cutoff)", "Depth Based Occlusion Cutoff, Depth Offset(x), Depth Mult(y), Power(z)"));
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
//Debug tools
|
||||
showDebugTools = EditorGUILayout.Foldout(showDebugTools, new GUIContent("Debug Tools"));
|
||||
if (showDebugTools)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(visualizeSunDepthTexture, new GUIContent("Visualize Sun Depth Texture", "Visualize the depth texture used to render proper shadows while injecting sunlight into voxel data."));
|
||||
EditorGUILayout.PropertyField(visualizeGI, new GUIContent("Visualize GI", "Visualize GI result only (no textures)."));
|
||||
EditorGUILayout.PropertyField(visualizeVoxels, new GUIContent("Visualize Voxels", "Directly view the voxels in the scene."));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
//v0.6
|
||||
showUpdateControls = EditorGUILayout.Foldout(showUpdateControls, new GUIContent("Time and Distance Based Update Optimization"));
|
||||
if (showUpdateControls)
|
||||
{
|
||||
|
||||
|
||||
EditorGUILayout.PropertyField(updatePerDistance, new GUIContent("Update Per Distance", "Update GI result Per Distance."));
|
||||
EditorGUILayout.PropertyField(updatePerTime, new GUIContent("Update Per Time", "Update GI result Per Time."));
|
||||
EditorGUILayout.PropertyField(updateDistance, new GUIContent("Update Distance", "Define distance to last position to update the scene Voxelization"));
|
||||
EditorGUILayout.PropertyField(updateTime, new GUIContent("Update Time", "Define time to last update to recalculate the scene Voxelization."));
|
||||
|
||||
}
|
||||
|
||||
serObj.ApplyModifiedProperties();
|
||||
|
||||
|
||||
//v0.5
|
||||
EditorGUILayout.LabelField("_____________________________________________________________________________");
|
||||
EditorGUILayout.LabelField("_____________________________________________________________________________");
|
||||
showAllParameters = EditorGUILayout.Foldout(showAllParameters, new GUIContent("Show all Parameters"));
|
||||
if (showAllParameters)
|
||||
{
|
||||
EditorGUILayout.LabelField("_____________________________________________________________________________");
|
||||
// Show default inspector property editor
|
||||
DrawDefaultInspector();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SavePreset(string name)
|
||||
{
|
||||
if (name == "")
|
||||
{
|
||||
Debug.LogWarning("LUMINA: Type in a name for the preset to be saved!");
|
||||
return;
|
||||
}
|
||||
|
||||
//LUMINAPreset preset = new LUMINAPreset();
|
||||
LUMINAPreset preset = ScriptableObject.CreateInstance<LUMINAPreset>();
|
||||
|
||||
preset.voxelResolution = instance.voxelResolution;
|
||||
preset.voxelAA = instance.voxelAA;
|
||||
preset.innerOcclusionLayers = instance.innerOcclusionLayers;
|
||||
preset.infiniteBounces = instance.infiniteBounces;
|
||||
|
||||
preset.temporalBlendWeight = instance.temporalBlendWeight;
|
||||
preset.useBilateralFiltering = instance.useBilateralFiltering;
|
||||
preset.halfResolution = instance.halfResolution;
|
||||
preset.stochasticSampling = instance.stochasticSampling;
|
||||
preset.doReflections = instance.doReflections;
|
||||
|
||||
preset.cones = instance.cones;
|
||||
preset.coneTraceSteps = instance.coneTraceSteps;
|
||||
preset.coneLength = instance.coneLength;
|
||||
preset.coneWidth = instance.coneWidth;
|
||||
preset.coneTraceBias = instance.coneTraceBias;
|
||||
preset.occlusionStrength = instance.occlusionStrength;
|
||||
preset.nearOcclusionStrength = instance.nearOcclusionStrength;
|
||||
preset.occlusionPower = instance.occlusionPower;
|
||||
preset.nearLightGain = instance.nearLightGain;
|
||||
preset.giGain = instance.giGain;
|
||||
preset.secondaryBounceGain = instance.secondaryBounceGain;
|
||||
|
||||
preset.reflectionSteps = instance.reflectionSteps;
|
||||
preset.reflectionOcclusionPower = instance.reflectionOcclusionPower;
|
||||
preset.skyReflectionIntensity = instance.skyReflectionIntensity;
|
||||
preset.gaussianMipFilter = instance.gaussianMipFilter;
|
||||
|
||||
preset.farOcclusionStrength = instance.farOcclusionStrength;
|
||||
preset.farthestOcclusionStrength = instance.farthestOcclusionStrength;
|
||||
preset.secondaryCones = instance.secondaryCones;
|
||||
preset.secondaryOcclusionStrength = instance.secondaryOcclusionStrength;
|
||||
|
||||
//v0.6
|
||||
preset.contrastA = instance.contrastA;
|
||||
preset.ReflectControl = instance.ReflectControl;
|
||||
|
||||
//v0.7
|
||||
preset.DitherControl = instance.DitherControl;
|
||||
|
||||
//v1.2
|
||||
preset.smoothNormals = instance.smoothNormals;
|
||||
|
||||
//v1.3
|
||||
preset.proxyNoGeom = instance.proxyNoGeom;
|
||||
|
||||
//v1.5
|
||||
preset.enableLocalLightGI = instance.enableLocalLightGI;
|
||||
preset.shadowedLocalPower = instance.shadowedLocalPower;
|
||||
preset.shadowlessLocalPower = instance.shadowlessLocalPower;
|
||||
preset.shadowlessLocalOcclusion = instance.shadowlessLocalOcclusion;
|
||||
|
||||
//v1.6
|
||||
preset.cutoff = instance.cutoff;
|
||||
|
||||
string path = presetPath + "/";
|
||||
|
||||
AssetDatabase.CreateAsset(preset, path + name + ".asset");
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
void LoadPreset()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb40b4b6e504cc34e9508aab0766f9e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Artngame.LUMINA {//Kino.PostProcessing {
|
||||
|
||||
[VolumeComponentEditor(typeof(LuminaHDRPVolumeBeforePostProcess))]
|
||||
sealed class LuminaHDRPVolumeBeforePostProcessEditor : VolumeComponentEditor
|
||||
{
|
||||
SerializedDataParameter _opacity;
|
||||
SerializedDataParameter _edgeColor;
|
||||
SerializedDataParameter _edgeContrast;
|
||||
SerializedDataParameter _fillColor;
|
||||
SerializedDataParameter _blurWidth;
|
||||
SerializedDataParameter _blurFrequency;
|
||||
SerializedDataParameter _hueShift;
|
||||
SerializedDataParameter _interval;
|
||||
SerializedDataParameter _iteration;
|
||||
SerializedDataParameter _overlayMode;
|
||||
SerializedDataParameter _overlayTexture;
|
||||
SerializedDataParameter _overlayOpacity;
|
||||
|
||||
static class Labels
|
||||
{
|
||||
public static GUIContent Opacity = new GUIContent("Opacity");
|
||||
public static GUIContent Texture = new GUIContent("Texture");
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
var o = new PropertyFetcher<LuminaHDRPVolumeBeforePostProcess>(serializedObject);
|
||||
|
||||
_opacity = Unpack(o.Find(x => x.opacity ));
|
||||
_edgeColor = Unpack(o.Find(x => x.edgeColor ));
|
||||
_edgeContrast = Unpack(o.Find(x => x.edgeContrast ));
|
||||
_fillColor = Unpack(o.Find(x => x.fillColor ));
|
||||
_blurWidth = Unpack(o.Find(x => x.blurWidth ));
|
||||
_blurFrequency = Unpack(o.Find(x => x.blurFrequency ));
|
||||
_hueShift = Unpack(o.Find(x => x.hueShift ));
|
||||
_interval = Unpack(o.Find(x => x.interval ));
|
||||
_iteration = Unpack(o.Find(x => x.iteration ));
|
||||
_overlayMode = Unpack(o.Find(x => x.overlayMode ));
|
||||
_overlayTexture = Unpack(o.Find(x => x.overlayTexture));
|
||||
_overlayOpacity = Unpack(o.Find(x => x.overlayOpacity));
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
PropertyField(_opacity);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_edgeColor);
|
||||
PropertyField(_edgeContrast);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_fillColor);
|
||||
PropertyField(_blurWidth);
|
||||
PropertyField(_blurFrequency);
|
||||
PropertyField(_hueShift);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_interval);
|
||||
PropertyField(_iteration);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_overlayMode);
|
||||
|
||||
if (_overlayMode.value.hasMultipleDifferentValues ||
|
||||
_overlayMode.value.enumValueIndex != 0)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
PropertyField(_overlayTexture, Labels.Texture);
|
||||
PropertyField(_overlayOpacity, Labels.Opacity);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Kino.PostProcessing
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4f43f65fa902ab40891de0c54c56442
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Artngame.LUMINA {//Kino.PostProcessing {
|
||||
|
||||
[VolumeComponentEditor(typeof(LuminaHDRPVolume))]
|
||||
sealed class LuminaHDRPVolumeEditor : VolumeComponentEditor
|
||||
{
|
||||
SerializedDataParameter _opacity;
|
||||
SerializedDataParameter _edgeColor;
|
||||
SerializedDataParameter _edgeContrast;
|
||||
SerializedDataParameter _fillColor;
|
||||
SerializedDataParameter _blurWidth;
|
||||
SerializedDataParameter _blurFrequency;
|
||||
SerializedDataParameter _hueShift;
|
||||
SerializedDataParameter _interval;
|
||||
SerializedDataParameter _iteration;
|
||||
SerializedDataParameter _overlayMode;
|
||||
SerializedDataParameter _overlayTexture;
|
||||
SerializedDataParameter _overlayOpacity;
|
||||
|
||||
static class Labels
|
||||
{
|
||||
public static GUIContent Opacity = new GUIContent("Opacity");
|
||||
public static GUIContent Texture = new GUIContent("Texture");
|
||||
}
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
var o = new PropertyFetcher<LuminaHDRPVolume>(serializedObject);
|
||||
|
||||
_opacity = Unpack(o.Find(x => x.opacity ));
|
||||
_edgeColor = Unpack(o.Find(x => x.edgeColor ));
|
||||
_edgeContrast = Unpack(o.Find(x => x.edgeContrast ));
|
||||
_fillColor = Unpack(o.Find(x => x.fillColor ));
|
||||
_blurWidth = Unpack(o.Find(x => x.blurWidth ));
|
||||
_blurFrequency = Unpack(o.Find(x => x.blurFrequency ));
|
||||
_hueShift = Unpack(o.Find(x => x.hueShift ));
|
||||
_interval = Unpack(o.Find(x => x.interval ));
|
||||
_iteration = Unpack(o.Find(x => x.iteration ));
|
||||
_overlayMode = Unpack(o.Find(x => x.overlayMode ));
|
||||
_overlayTexture = Unpack(o.Find(x => x.overlayTexture));
|
||||
_overlayOpacity = Unpack(o.Find(x => x.overlayOpacity));
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
PropertyField(_opacity);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_edgeColor);
|
||||
PropertyField(_edgeContrast);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_fillColor);
|
||||
PropertyField(_blurWidth);
|
||||
PropertyField(_blurFrequency);
|
||||
PropertyField(_hueShift);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_interval);
|
||||
PropertyField(_iteration);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
PropertyField(_overlayMode);
|
||||
|
||||
if (_overlayMode.value.hasMultipleDifferentValues ||
|
||||
_overlayMode.value.enumValueIndex != 0)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
PropertyField(_overlayTexture, Labels.Texture);
|
||||
PropertyField(_overlayOpacity, Labels.Opacity);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Kino.PostProcessing
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fd0c609745582849b1b9e963824699e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ccb6d50a41566d47ba896b83b4d7ce9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ece8ea8d624ff347b8c8def987b32cc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Antoine Lelievre
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21b9d22da73f097409619f83696114ea
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,61 @@
|
||||
KinoAqua
|
||||
========
|
||||
|
||||

|
||||

|
||||
|
||||
**KinoAqua** is a custom post-processing effect for Unity URP/HDRP that creates
|
||||
a watercolor effect. The shader implementation of the effect is inspired by
|
||||
[a Shadertoy effect] created by Florian Berger (flockaroo).
|
||||
|
||||
[a Shadertoy effect]: https://www.shadertoy.com/view/ltyGRV#
|
||||
|
||||
System Requirements
|
||||
-------------------
|
||||
|
||||
- Unity 2021.3 or later
|
||||
|
||||
Note that the shader hasn't been optimized enough for practical use. Although
|
||||
it's compatible with most of the platforms, it may run significantly slow on
|
||||
some devices like mobiles.
|
||||
|
||||
How to Install
|
||||
--------------
|
||||
|
||||
This package uses the [scoped registry] feature to resolve package
|
||||
dependencies. Open the Package Manager page in the Project Settings window and
|
||||
add the following entry to the Scoped Registries list:
|
||||
|
||||
- Name: `Keijiro`
|
||||
- URL: `https://registry.npmjs.com`
|
||||
- Scope: `jp.keijiro`
|
||||
|
||||

|
||||
|
||||
Now you can install the package from My Registries page in the Package Manager
|
||||
window.
|
||||
|
||||

|
||||
|
||||
[scoped registry]: https://docs.unity3d.com/Manual/upm-scoped.html
|
||||
|
||||
How to Use on URP
|
||||
-----------------
|
||||
|
||||
The effect is implemented as a renderer feature on URP. To use the effect, add
|
||||
the **Aqua Effect Feature** to the renderer feature list.
|
||||
|
||||
You also have to add the **Aqua Effect** component to camera objects. You can
|
||||
control the effect parameters via it, and the effect is only enabled within the
|
||||
attached camera objects.
|
||||
|
||||
[renderer feature]:
|
||||
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/urp-renderer-feature.html
|
||||
|
||||
How to Use on HDRP
|
||||
------------------
|
||||
|
||||
The effect is implemented as a custom post-processing effect on HDRP. To use
|
||||
the effect, add `Kino.PostProcessing.Aqua` to the Custom Post Process Orders
|
||||
list in the HDRP Global Settings (you can find the entry in the "After Post
|
||||
Process" list box).
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d98e2bf3e8dead44392cf12ef4e6163f
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,147 @@
|
||||
# HDRP-Custom-Passes
|
||||
A bunch of custom passes made for HDRP. This project have been setup for Unity 2021.1 version with HDRP 12.x.
|
||||
|
||||
## TIPS Effect:
|
||||
|
||||
Features:
|
||||
+ Edge detect
|
||||
+ Draw Mesh
|
||||
+ Compositing with fullscreen pass
|
||||
|
||||
Source file link for this effect: [TIPS.cs](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/TIPS/TIPS.cs) and [TIPS.shader](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/TIPS/Resources/TIPS.shader)
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Slight Blur Effect:
|
||||
|
||||
Features:
|
||||
+ 2 Pass gaussian blur and a downscale
|
||||
+ Masking to not blur certain part of the screen using meshes
|
||||
|
||||
Source file link for this effect: [SlightBlur.cs](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/Blur/SlightBlur.cs) and [Blur.shader](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/Blur/Resources/CompositeBlur.shader)
|
||||

|
||||
|
||||
## Outline Effect:
|
||||
|
||||
Source file link for this effect: [02_Selection_Objects.shader](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/Selection/Shaders/02_Selection_Objects.shader) and [02_Selection_Fullscreen.shader](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/Selection/Shaders/02_Selection_Fullscreen.shader)
|
||||
|
||||
Effect made without custom C#, setup in the inspector:
|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
## See Through Effect:
|
||||
|
||||
Source file link for this effect: [SeeThrough.cs](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/SeeThrough/SeeThrough.cs) and [SeeThroughStencil.shader](https://github.com/alelievr/HDRP-Custom-Passes/blob/master/Assets/CustomPasses/SeeThrough/SeeThroughStencil.shader)
|
||||

|
||||
|
||||
|
||||
## AR Effect:
|
||||
|
||||
Features:
|
||||
+ Early depth pass
|
||||
+ Composite with video in background
|
||||
|
||||

|
||||
|
||||
## Glitch Effect:
|
||||
|
||||
Features:
|
||||
+ Display a "bad reception" effect over objects of specified layer, using the following shader:
|
||||

|
||||
|
||||

|
||||
|
||||
## Scrolling Formulas Effect:
|
||||
|
||||
Features:
|
||||
+ Uses a builtin fullscreen custom pass and a custom pass fullscreen shader
|
||||
+ Triplanar mapping
|
||||

|
||||
|
||||
## Liquid
|
||||
|
||||
Features:
|
||||
+ Meta balls made by bluring normals
|
||||
+ Visual Effect Graph inside a custom pass
|
||||
+ Overriding depth and normals of a fullscreen transparent to emulate a surface
|
||||

|
||||
|
||||
## Glass
|
||||
|
||||
Features:
|
||||
+ Thickness aproximation using a custom pass rendering backfaces in custom depth
|
||||

|
||||
|
||||
## Depth Capture
|
||||
|
||||
Features:
|
||||
+ Render objects from a different camera and output their depth in a depth buffer
|
||||

|
||||
|
||||
## Render With Normal Buffer
|
||||
|
||||
Rendering objects in the normal buffer is essential to make objects work with screen space effects. This example show how to create a custom pass that renders an object in the depth, normal and color buffer so the SSAO can correctly be applied (you can see the exagerated SSAO effect in this screenshot)
|
||||
|
||||

|
||||
|
||||
And this is the same image without rendering the object to the normal buffer:
|
||||

|
||||
As you can see the SSAO is completely messed-up
|
||||
|
||||
|
||||
Note that because you need to render the object in both depth-prepass and forward pass, you need two custom passes volume with different injection points:
|
||||

|
||||
|
||||
## ScreenSpace Camera UI Blur
|
||||
|
||||
This effect blurs the camera color buffer and renders the screenspace UI on top of it. It is intended to be used in the after post process injection point
|
||||

|
||||
|
||||
Note that this custom pass also avoid z test issues when doing this kind of as the transparent objects are rendered after everything.
|
||||
|
||||

|
||||
|
||||
|
||||
## Render Video Without TAA
|
||||
|
||||
This effect allows you to render an object (for example a video player) without TAA. It uses custom post processes to achieve this, so be sure to have the "VideoPlaybackWithoutTAAPostProcess" post process in your HDRP default settings:
|
||||
|
||||
.
|
||||
|
||||
As you can see in the videos, this pass will remove all artifacts visible when an object doesn't have valid motion vector data (which is the case for most texture animation or video playback):
|
||||
|
||||
With TAA:
|
||||
|
||||
https://user-images.githubusercontent.com/6877923/116881360-77e10300-ac23-11eb-8a19-f176d2364f11.mp4
|
||||
|
||||
Without TAA:
|
||||
|
||||
https://user-images.githubusercontent.com/6877923/116881366-78799980-ac23-11eb-97b0-5f8aa18f9b3c.mp4
|
||||
|
||||
By default in this effect, the `fixDepthBufferJittering` field is disabled because it's a very costly operation (re-render all the objects in the scene into an unjittered depth buffer) but it allows to get rid of all TAA artifacts remaining after you add this effect (mainly depth jittering).
|
||||
|
||||
Custom pass effect sources: [Assets/CustomPasses/Video Playback Without TAA](https://github.com/alelievr/HDRP-Custom-Passes/tree/master/Assets/CustomPasses/Video%20Playback%20Without%20TAA).
|
||||
|
||||
## Render Object Motion Vectors
|
||||
|
||||
Render the Object motion vectors (not camera motion vectors!) into a render texture
|
||||

|
||||
|
||||
Sources: [Assets/CustomPasses/RenderMotionVectors](https://github.com/alelievr/HDRP-Custom-Passes/tree/master/Assets/CustomPasses/RenderMotionVectors)
|
||||
|
||||
## Copy Buffer
|
||||
|
||||
Custom pass that can copy the following buffers to a render texture:
|
||||
- Color
|
||||
- Normal
|
||||
- Roughness
|
||||
- Depth
|
||||
- Motion Vectors
|
||||
|
||||

|
||||
|
||||
Source: [Assets/CustomPasses/CopyPass](https://github.com/alelievr/HDRP-Custom-Passes/tree/master/Assets/CustomPasses/CopyPass)
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3d18479cb1b9e644bac58ab2cbf4087
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 445e1c300d11879409c65f6d70a8d67c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- preRenderers: {fileID: 2100000, guid: 7ecff14460b43eb468145b44fd891a92, type: 2}
|
||||
- debugSceneColorMat: {instanceID: 0}
|
||||
- sun: {instanceID: 0}
|
||||
- followTransform: {instanceID: 0}
|
||||
- material: {instanceID: 0}
|
||||
- attachedCamera: {instanceID: 0}
|
||||
- shadowCamTransform: {instanceID: 0}
|
||||
- shadowCam: {instanceID: 0}
|
||||
- shadowCamGameObject: {instanceID: 0}
|
||||
- sunDepthShader: {instanceID: 0}
|
||||
- sunDepthTexture: {instanceID: 0}
|
||||
- previousGIResult: {instanceID: 0}
|
||||
- previousCameraDepth: {instanceID: 0}
|
||||
- integerVolume: {instanceID: 0}
|
||||
- secondaryIrradianceVolume: {instanceID: 0}
|
||||
- volumeTextureB: {instanceID: 0}
|
||||
- activeVolume: {instanceID: 0}
|
||||
- previousActiveVolume: {instanceID: 0}
|
||||
- dummyVoxelTextureAAScaled: {instanceID: 0}
|
||||
- dummyVoxelTextureFixed: {instanceID: 0}
|
||||
- voxelizationShader: {instanceID: 0}
|
||||
- voxelTracingShader: {instanceID: 0}
|
||||
- clearCompute: {instanceID: 0}
|
||||
- transferIntsCompute: {instanceID: 0}
|
||||
- mipFilterCompute: {instanceID: 0}
|
||||
- voxelCamera: {instanceID: 0}
|
||||
- voxelCameraGO: {instanceID: 0}
|
||||
- leftViewPoint: {instanceID: 0}
|
||||
- topViewPoint: {instanceID: 0}
|
||||
- savedCam: {instanceID: 0}
|
||||
- gi1: {instanceID: 0}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,772 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.HighDefinition;
|
||||
|
||||
namespace Artngame.LUMINA {
|
||||
|
||||
[System.Serializable]
|
||||
[VolumeComponentMenu("Post-processing/ARTnGAME/LuminaHDRP")]
|
||||
public sealed class LuminaHDRPVolume
|
||||
: CustomPostProcessVolumeComponent, IPostProcessComponent
|
||||
{
|
||||
#region Effect parameters
|
||||
|
||||
public ClampedFloatParameter opacity
|
||||
= new ClampedFloatParameter(0, 0, 1);
|
||||
|
||||
public ColorParameter edgeColor
|
||||
= new ColorParameter(Color.black);
|
||||
|
||||
public ClampedFloatParameter edgeContrast
|
||||
= new ClampedFloatParameter(1.2f, 0.01f, 4);
|
||||
|
||||
public ColorParameter fillColor
|
||||
= new ColorParameter(Color.white);
|
||||
|
||||
public ClampedFloatParameter blurWidth
|
||||
= new ClampedFloatParameter(1, 0, 2);
|
||||
|
||||
public ClampedFloatParameter blurFrequency
|
||||
= new ClampedFloatParameter(0.5f, 0, 1);
|
||||
|
||||
public ClampedFloatParameter hueShift
|
||||
= new ClampedFloatParameter(0.1f, 0, 0.3f);
|
||||
|
||||
public ClampedFloatParameter interval
|
||||
= new ClampedFloatParameter(1, 0.1f, 5);
|
||||
|
||||
public ClampedIntParameter iteration
|
||||
= new ClampedIntParameter(20, 4, 32);
|
||||
|
||||
public VolumeParameter<OverlayMode> overlayMode
|
||||
= new VolumeParameter<OverlayMode>();
|
||||
|
||||
public NoInterpTextureParameter overlayTexture
|
||||
= new NoInterpTextureParameter(null);
|
||||
|
||||
public ClampedFloatParameter overlayOpacity
|
||||
= new ClampedFloatParameter(0, 0, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private members
|
||||
|
||||
static readonly string ShaderName
|
||||
= "Hidden/Kino/Aqua/HighDefinition";
|
||||
|
||||
Material _material;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPostProcessComponent implementation
|
||||
|
||||
public bool IsActive()
|
||||
=> _material != null && opacity.value > 0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region CustomPostProcessVolumeComponent implementation
|
||||
|
||||
public override CustomPostProcessInjectionPoint injectionPoint
|
||||
=> CustomPostProcessInjectionPoint.AfterPostProcess;
|
||||
|
||||
//LUMINA
|
||||
//RTHandle lrDepthBuffer;
|
||||
RTHandle skyA;
|
||||
RTHandle gi1;
|
||||
RTHandle gi2;
|
||||
RTHandle gi3;
|
||||
RTHandle gi4;
|
||||
RTHandle reflections;
|
||||
RTHandle currentDepth;
|
||||
RTHandle currentNormal;
|
||||
|
||||
//gi2.filterMode = FilterMode.Point;
|
||||
// gi4.filterMode = FilterMode.Point;
|
||||
// gi3.filterMode = FilterMode.Point;
|
||||
// RenderTexture skyA = RenderTexture.GetTemporary(srcRT.rt.width, srcRT.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
//RenderTexture gi1 = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
//RenderTexture gi2 = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
//reflections = RenderTexture.GetTemporary(source.width, source.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
// RenderTexture currentDepth = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.RFloat, RenderTextureReadWrite.Linear);
|
||||
//RenderTexture currentNormal = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
|
||||
//currentNormal.filterMode = FilterMode.Point;
|
||||
|
||||
|
||||
public override void Setup()
|
||||
{
|
||||
if (Camera.main == null || Camera.current != null)//v0.2
|
||||
{
|
||||
//Debug.Log("No cam5b");
|
||||
return;
|
||||
}
|
||||
|
||||
_material = CoreUtils.CreateEngineMaterial(ShaderName);
|
||||
|
||||
//LUMINA
|
||||
var hdrpAsset = (GraphicsSettings.defaultRenderPipeline as HDRenderPipelineAsset);
|
||||
var colorBufferFormat = hdrpAsset.currentPlatformRenderPipelineSettings.colorBufferFormat;
|
||||
//if (lrDepthBuffer == null)
|
||||
//{
|
||||
// lrDepthBuffer = RTHandles.Alloc(
|
||||
// Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
// colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)colorBufferFormat, // We don't need alpha in the blur
|
||||
// useDynamicScale: true, name: "lrDepthBuffer"
|
||||
// );
|
||||
//}
|
||||
|
||||
UnityEngine.Experimental.Rendering.GraphicsFormat format1 = UnityEngine.Experimental.Rendering.GraphicsFormat.R16G16B16A16_SFloat;
|
||||
|
||||
if (gi1 == null)
|
||||
{
|
||||
gi1 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi1"
|
||||
);
|
||||
}
|
||||
if (gi2== null)
|
||||
{
|
||||
gi2 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi2"
|
||||
);
|
||||
}
|
||||
if (gi3 == null)
|
||||
{
|
||||
gi3 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi3"
|
||||
);
|
||||
}
|
||||
if (gi4 == null)
|
||||
{
|
||||
gi4 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi4"
|
||||
);
|
||||
}
|
||||
if (reflections == null)
|
||||
{
|
||||
reflections = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "reflections"
|
||||
);
|
||||
}
|
||||
if (currentDepth == null)
|
||||
{
|
||||
currentDepth = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "currentDepth"
|
||||
);
|
||||
}
|
||||
if (currentNormal == null)
|
||||
{
|
||||
currentNormal = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "currentNormal"
|
||||
);
|
||||
}
|
||||
if (skyA == null)
|
||||
{
|
||||
skyA = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "skyA"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
//=> _material = CoreUtils.CreateEngineMaterial(ShaderName);
|
||||
|
||||
public override void Render
|
||||
(CommandBuffer cmd, HDCamera camera, RTHandle srcRT, RTHandle destRT)
|
||||
{
|
||||
|
||||
|
||||
//v0.1
|
||||
bool enableGI = false;
|
||||
if (Camera.main != null)
|
||||
{
|
||||
LuminaHDRP segi = Camera.main.GetComponent<LuminaHDRP>();
|
||||
if (segi != null)
|
||||
{
|
||||
enableGI = !segi.disableGI;
|
||||
}
|
||||
}
|
||||
if (//RenderSettings.sun == null || !RenderSettings.sun.enabled ||
|
||||
!enableGI || (Camera.main != null && Camera.current != null && Camera.current != Camera.main) || Camera.main == null || Camera.current != null //v0.2
|
||||
) { return; }
|
||||
|
||||
|
||||
ShaderHelper.SetProperties
|
||||
(_material, srcRT,
|
||||
opacity: opacity.value,
|
||||
edgeColor: edgeColor.value,
|
||||
edgeContrast: edgeContrast.value,
|
||||
fillColor: fillColor.value,
|
||||
blurWidth: blurWidth.value,
|
||||
blurFrequency: blurFrequency.value,
|
||||
hueShift: hueShift.value,
|
||||
interval: interval.value,
|
||||
iteration: iteration.value);
|
||||
|
||||
ShaderHelper.SetOverlayProperties
|
||||
(_material,
|
||||
overlayMode.value,
|
||||
overlayTexture.value,
|
||||
overlayOpacity.value);
|
||||
|
||||
|
||||
//LUMINA
|
||||
//// Target ID
|
||||
//var rt = camera.camera.targetTexture;
|
||||
//var rtid = rt != null ?
|
||||
// new RenderTargetIdentifier(rt) :
|
||||
// new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget);
|
||||
|
||||
|
||||
|
||||
//Camera cameraA = renderingData.cameraData.camera;
|
||||
//RenderTextureDescriptor cameraTextureDescriptor = renderingData.cameraData.cameraTargetDescriptor;
|
||||
// RenderTexture skyA = RenderTexture.GetTemporary(srcRT.rt.width, srcRT.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
//var skyA_RTID = new RenderTargetIdentifier(skyA);
|
||||
//HDUtils.BlitCameraTexture()
|
||||
//Graphics.Blit(destRT, skyA); //Blit(cmd, source, skyA);
|
||||
RenderTexture.active = skyA;
|
||||
GL.ClearWithSkybox(false, camera.camera);
|
||||
|
||||
|
||||
// RenderTexture gi1 = RenderTexture.GetTemporary(srcRT.rt.width, srcRT.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
|
||||
OnRenderImageA(camera.camera, cmd, srcRT, gi1);
|
||||
|
||||
// Graphics.Blit(gi1, destRT);
|
||||
//Blit(cmd, gi1, _cameraColorTargetIdent);
|
||||
//context.ExecuteCommandBuffer(cmd);
|
||||
//CommandBufferPool.Release(cmd);
|
||||
|
||||
|
||||
|
||||
//var downsampleProperties = new MaterialPropertyBlock();
|
||||
//downsampleProperties.SetTexture("_InputTextureA", destRT);
|
||||
//downsampleProperties.SetFloat("_Height", Camera.main.transform.position.y);
|
||||
//HDUtils.DrawFullScreen(cmd, sheetSHAFTS, m_TemporaryColorTextureScaled, downsampleProperties, 11);
|
||||
|
||||
|
||||
|
||||
|
||||
// Change render target type
|
||||
// RenderTargetHandle renderTarget;
|
||||
// RTHandle renderTarget;
|
||||
// Associate the shader property with the render target using RTHandles.Alloc instead of renderTarget.Init
|
||||
// renderTarget.Init("_ShaderProperty");
|
||||
// renderTarget = RTHandles.Alloc("_ShaderProperty", name: "_ShaderProperty");
|
||||
// Assign temporary render texture using the shader property identifier
|
||||
// cmd.GetTemporaryRT(renderTarget.id, targetDescriptor, filterMode);
|
||||
// cmd.GetTemporaryRT(Shader.PropertyToID(renderTarget.name), targetDescriptor, filterMode);
|
||||
// Modify ConfigureTarget to use the new RTHandle instead of the old RenderTargetIdentifier
|
||||
// ConfigureTarget(renderTarget.id);
|
||||
// ConfigureTarget(renderTarget);
|
||||
// Get the render texture identifier from the shader property
|
||||
// cmd.ReleaseTemporaryRT(renderTarget.id);
|
||||
// cmd.ReleaseTemporaryRT(Shader.PropertyToID(renderTarget.name));
|
||||
////END LUMINA
|
||||
|
||||
HDUtils.BlitCameraTexture(cmd, gi1, destRT);
|
||||
//HDUtils.DrawFullScreen(cmd, _material, destRT, null, 0);
|
||||
//HDUtils.DrawFullScreen(cmd, _material, destRT, null, 0);
|
||||
|
||||
//LUMINA
|
||||
// RenderTexture.ReleaseTemporary(skyA);
|
||||
// RenderTexture.ReleaseTemporary(gi1);
|
||||
|
||||
//ExecuteCommandBuffer(cmd);
|
||||
//CommandBufferPool.Release(cmd);
|
||||
}
|
||||
|
||||
//LUMINA
|
||||
void BlitG(CommandBuffer cmd, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
//material.SetTexture(ShaderIDs.MainTex, source);
|
||||
Graphics.Blit(source, destination);
|
||||
}
|
||||
void BlitG(CommandBuffer cmd, RenderTexture source, RenderTexture destination, Material material, int pass)
|
||||
{
|
||||
//material.SetTexture(ShaderIDs.MainTex, source);
|
||||
Graphics.Blit(source, destination, material, pass, pass);
|
||||
}
|
||||
void Blit(CommandBuffer cmd, RTHandle source, RTHandle destination)
|
||||
{
|
||||
_material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
HDUtils.DrawFullScreen(cmd, _material, destination, null, 0);//CORRECT
|
||||
}
|
||||
void BlitCMD(CommandBuffer cmd, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
//_material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
cmd.Blit(source, destination);
|
||||
}
|
||||
void BlitCMDF(CommandBuffer cmd, RenderTexture source, RenderTexture destination, Material material, int pass)
|
||||
{
|
||||
//_material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
cmd.Blit(source, destination, material,pass);
|
||||
}
|
||||
void BlitCMDF3D(CommandBuffer cmd, RenderTexture source, RenderTexture destination, Material material, int pass)
|
||||
{
|
||||
// material.SetTexture("_MainTexARRAY", source);
|
||||
cmd.Blit(source, destination, material, pass);
|
||||
}
|
||||
void Blit(CommandBuffer cmd, RTHandle source, RTHandle destination, Material material, int pass)
|
||||
{
|
||||
material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
HDUtils.DrawFullScreen(cmd, material, destination, null, pass);
|
||||
}
|
||||
void Blit3D(CommandBuffer cmd, RTHandle source, RTHandle destination, Material material, int pass)
|
||||
{
|
||||
material.SetTexture("_MainTexARRAY", source.rt);
|
||||
HDUtils.DrawFullScreen(cmd, material, destination, null, pass);
|
||||
}
|
||||
void OnRenderImageA(Camera camera, CommandBuffer cmd, RTHandle source, RTHandle destination) //void OnRenderImageA(Camera camera, CommandBuffer cmd, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
// Graphics.Blit(source, destination);
|
||||
//Blit(cmd, source, destination);
|
||||
//return;
|
||||
|
||||
if (Camera.main == null || Camera.current != null)//v0.2
|
||||
{
|
||||
//Debug.Log("No cam5b");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Camera.main != null && camera != Camera.main || Camera.current != null)//v0.2
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Debug.Log(Camera.main.orthographic);
|
||||
Camera.main.depthTextureMode = DepthTextureMode.Depth;
|
||||
|
||||
//v0.1
|
||||
if (Camera.main != null)
|
||||
{
|
||||
LuminaHDRP segi = Camera.main.GetComponent<LuminaHDRP>(); //LUMINA segi = Camera.main.GetComponent<LUMINA>();
|
||||
if (segi != null && segi.enabled)
|
||||
{
|
||||
if (segi.notReadyToRender)
|
||||
{
|
||||
//Blit(cmd, source, source);
|
||||
//Graphics.Blit(source, destination);
|
||||
//Graphics.Blit();
|
||||
//HDUtils.BlitCameraTexture()
|
||||
//Blit(cmd, source, destination);
|
||||
cmd.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
|
||||
//Set parameters
|
||||
Shader.SetGlobalFloat("SEGIVoxelScaleFactor", segi.voxelScaleFactor);
|
||||
|
||||
if (!segi.material)//v0.2a
|
||||
{
|
||||
segi.material = new Material(Shader.Find("Hidden/SEGI"));
|
||||
//material.hideFlags = HideFlags.HideAndDontSave;//v0.2
|
||||
}
|
||||
|
||||
segi.material.SetMatrix("CameraToWorld", segi.attachedCamera.cameraToWorldMatrix);
|
||||
segi.material.SetMatrix("WorldToCamera", segi.attachedCamera.worldToCameraMatrix);
|
||||
segi.material.SetMatrix("ProjectionMatrixInverse", segi.attachedCamera.projectionMatrix.inverse);
|
||||
segi.material.SetMatrix("ProjectionMatrix", segi.attachedCamera.projectionMatrix);
|
||||
segi.material.SetInt("FrameSwitch", segi.frameCounter);
|
||||
Shader.SetGlobalInt("SEGIFrameSwitch", segi.frameCounter);
|
||||
segi.material.SetVector("CameraPosition", segi.transform.position);
|
||||
segi.material.SetFloat("DeltaTime", Time.deltaTime);
|
||||
|
||||
segi.material.SetInt("StochasticSampling", segi.stochasticSampling ? 1 : 0);
|
||||
segi.material.SetInt("TraceDirections", segi.cones);
|
||||
segi.material.SetInt("TraceSteps", segi.coneTraceSteps);
|
||||
segi.material.SetFloat("TraceLength", segi.coneLength);
|
||||
segi.material.SetFloat("ConeSize", segi.coneWidth);
|
||||
segi.material.SetFloat("OcclusionStrength", segi.occlusionStrength);
|
||||
segi.material.SetFloat("OcclusionPower", segi.occlusionPower);
|
||||
segi.material.SetFloat("ConeTraceBias", segi.coneTraceBias);
|
||||
segi.material.SetFloat("GIGain", segi.giGain);
|
||||
segi.material.SetFloat("NearLightGain", segi.nearLightGain);
|
||||
segi.material.SetFloat("NearOcclusionStrength", segi.nearOcclusionStrength);
|
||||
segi.material.SetInt("DoReflections", segi.doReflections ? 1 : 0);
|
||||
segi.material.SetInt("HalfResolution", segi.halfResolution ? 1 : 0);
|
||||
segi.material.SetInt("ReflectionSteps", segi.reflectionSteps);
|
||||
segi.material.SetFloat("ReflectionOcclusionPower", segi.reflectionOcclusionPower);
|
||||
segi.material.SetFloat("SkyReflectionIntensity", segi.skyReflectionIntensity);
|
||||
segi.material.SetFloat("FarOcclusionStrength", segi.farOcclusionStrength);
|
||||
segi.material.SetFloat("FarthestOcclusionStrength", segi.farthestOcclusionStrength);
|
||||
segi.material.SetTexture("NoiseTexture", segi.blueNoise[segi.frameCounter % 64]);
|
||||
segi.material.SetFloat("BlendWeight", segi.temporalBlendWeight);
|
||||
|
||||
//v0.4
|
||||
segi.material.SetFloat("contrastA", segi.contrastA);
|
||||
segi.material.SetVector("ReflectControl", segi.ReflectControl);
|
||||
|
||||
//v0.7
|
||||
segi.material.SetVector("ditherControl",
|
||||
new Vector4(segi.DitherControl.x,
|
||||
Mathf.Clamp(segi.DitherControl.y, 0.1f, 10),
|
||||
Mathf.Clamp(segi.DitherControl.z, 0.1f, 10),
|
||||
Mathf.Clamp(segi.DitherControl.w, 0.1f, 10))); //v1.2b
|
||||
|
||||
//v1.2
|
||||
segi.material.SetFloat("smoothNormals", segi.smoothNormals);
|
||||
|
||||
//If Visualize Voxels is enabled, just render the voxel visualization shader pass and return
|
||||
if (segi.visualizeVoxels)
|
||||
{
|
||||
//Blit(cmd, source, destination);
|
||||
//Debug.Log("AA");
|
||||
//segi.material.SetTexture("_MainTexARRAY", source.rt);
|
||||
Blit3D(cmd, source, destination, segi.material, LuminaHDRP.Pass.VisualizeVoxels);
|
||||
//Blit(cmd, source, destination, segi.material, LUMINA.Pass.VisualizeVoxels);
|
||||
return;
|
||||
}
|
||||
|
||||
//Setup temporary textures
|
||||
// RenderTexture gi1 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
//RenderTexture gi2 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
RenderTexture gi11 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBFloat);
|
||||
RenderTexture gi22 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBFloat);
|
||||
RenderTexture reflectionsA = null;
|
||||
|
||||
//If reflections are enabled, create a temporary render buffer to hold them
|
||||
if (segi.doReflections)
|
||||
{
|
||||
reflectionsA = RenderTexture.GetTemporary(source.rt.width, source.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Setup textures to hold the current camera depth and normal
|
||||
// RenderTexture currentDepth = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.RFloat, RenderTextureReadWrite.Linear);
|
||||
// currentDepth.filterMode = FilterMode.Point;
|
||||
|
||||
// RenderTexture currentNormal = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
|
||||
// currentNormal.filterMode = FilterMode.Point;
|
||||
|
||||
|
||||
// //HDRP2
|
||||
// cmd.Blit(segi.DepthBUFFER, currentDepth);
|
||||
|
||||
//Get the camera depth and normals
|
||||
//// Blit(cmd, source, currentDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);//v0.1
|
||||
//Blit(cmd, source, currentDepth, segi.material, VolumeLitSEGI.Pass.GetCameraDepthTexture);
|
||||
// cmd.Blit(source, currentDepth, segi.material, 13);// LUMINA.Pass.GetCameraDepthTexture);
|
||||
// cmd.Blit(source, currentDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);// LUMINA.Pass.GetCameraDepthTexture);
|
||||
// segi.material.SetTexture("CurrentDepth", currentDepth);
|
||||
//Graphics.Blit(segi.NormalBUFFER, segi.DepthBUFFERH);
|
||||
//cmd.Blit(segi.NormalBUFFER, segi.DepthBUFFERH);
|
||||
segi.material.SetTexture("CurrentDepth", segi.DepthBUFFER);// currentDepth); //segi.NormalBUFFER);
|
||||
|
||||
//v1.5
|
||||
if (!segi.useInternalDepth)
|
||||
{
|
||||
segi.material.SetTexture("_CameraDepthTexture", segi.DepthBUFFER); //currentDepth); //// HDRP !!!! //HDRP2
|
||||
}
|
||||
else
|
||||
{
|
||||
segi.material.SetTexture("_CameraDepthTexture", segi.DepthBUFFERInternal); //v1.6
|
||||
}
|
||||
|
||||
//// Blit(cmd, source, currentNormal, segi.material, LUMINA.Pass.GetWorldNormals);
|
||||
//// segi.material.SetTexture("CurrentNormal", currentNormal);
|
||||
//cmd.Blit(segi.NormalBUFFER, segi.NormalBUFFERH);
|
||||
segi.material.SetTexture("CurrentNormal", segi.NormalBUFFER);// segi.DepthBUFFER);
|
||||
|
||||
|
||||
//v0.1 - check depths
|
||||
if (segi.visualizeNORMALS)
|
||||
{
|
||||
cmd.Blit(segi.NormalBUFFER, destination);
|
||||
// Blit(cmd, segi.NormalBUFFERH, destination);
|
||||
//BlitG(cmd, segi.NormalBUFFER, destination);
|
||||
//Blit(cmd, currentNormal, destination);
|
||||
//RenderTexture.ReleaseTemporary(currentDepth);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
return;
|
||||
}
|
||||
if (segi.visualizeDEPTH)
|
||||
{
|
||||
|
||||
//cmd.Blit(segi.DepthBUFFER, destination); //HDRP2
|
||||
if (!segi.useInternalDepth)
|
||||
{
|
||||
cmd.Blit(segi.DepthBUFFER, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Blit(segi.DepthBUFFERInternal, destination);
|
||||
}
|
||||
//Blit(cmd, currentDepth, destination);
|
||||
// RenderTexture.ReleaseTemporary(currentDepth);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Set the previous GI result and camera depth textures to access them in the shader
|
||||
segi.material.SetTexture("PreviousGITexture", segi.previousGIResult);
|
||||
Shader.SetGlobalTexture("PreviousGITexture", segi.previousGIResult);
|
||||
segi.material.SetTexture("PreviousDepth", segi.previousCameraDepth);
|
||||
|
||||
//Render diffuse GI tracing result
|
||||
// Blit3D(cmd, source, gi2, segi.material, LUMINA.Pass.DiffuseTrace);
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
//Blit3D(cmd, source, gi22, segi.material, LUMINA.Pass.DiffuseTrace);
|
||||
//Blit3D(cmd, source, destination, segi.material, LUMINA.Pass.DiffuseTrace); return;
|
||||
|
||||
|
||||
cmd.Blit(source, gi22, segi.material, LuminaHDRP.Pass.DiffuseTrace);
|
||||
// cmd.Blit(gi22, destination);
|
||||
//RenderTexture.ReleaseTemporary(gi11);
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
//return;
|
||||
|
||||
if (segi.visualizeGI)
|
||||
{
|
||||
//Blit(cmd, gi2, destination);
|
||||
cmd.Blit(gi22, destination);
|
||||
|
||||
//RenderTexture.ReleaseTemporary(currentDepth);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
return;
|
||||
}
|
||||
|
||||
if (segi.doReflections)
|
||||
{
|
||||
//Render GI reflections result
|
||||
BlitCMDF3D(cmd, source, reflectionsA, segi.material, LuminaHDRP.Pass.SpecularTrace);
|
||||
//Blit(cmd, source, reflections, segi.material, LuminaHDRP.Pass.SpecularTrace);
|
||||
segi.material.SetTexture("Reflections", reflectionsA);
|
||||
}
|
||||
|
||||
|
||||
//Perform bilateral filtering
|
||||
if (segi.useBilateralFiltering)
|
||||
{
|
||||
segi.material.SetVector("Kernel", new Vector2(0.0f, 1.0f));
|
||||
BlitCMDF(cmd, gi22, gi11, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
|
||||
segi.material.SetVector("Kernel", new Vector2(1.0f, 0.0f));
|
||||
BlitCMDF(cmd, gi11, gi22, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
|
||||
segi.material.SetVector("Kernel", new Vector2(0.0f, 1.0f));
|
||||
BlitCMDF(cmd, gi22, gi11, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
|
||||
segi.material.SetVector("Kernel", new Vector2(1.0f, 0.0f));
|
||||
BlitCMDF(cmd, gi11, gi22, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
}
|
||||
|
||||
//If Half Resolution tracing is enabled
|
||||
if (segi.giRenderRes == 2)
|
||||
{
|
||||
// Debug.Log("HALF RES");
|
||||
|
||||
// RenderTexture.ReleaseTemporary(gi1);
|
||||
RenderTexture.ReleaseTemporary(gi11);//HDRP
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
|
||||
//Setup temporary textures
|
||||
// RenderTexture gi3 = RenderTexture.GetTemporary(source.width, source.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
// RenderTexture gi4 = RenderTexture.GetTemporary(source.width, source.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
RenderTexture gi33 = RenderTexture.GetTemporary(source.rt.width, source.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
RenderTexture gi44 = RenderTexture.GetTemporary(source.rt.width, source.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
|
||||
|
||||
//Prepare the half-resolution diffuse GI result to be bilaterally upsampled
|
||||
// gi2.filterMode = FilterMode.Point;
|
||||
gi22.filterMode = FilterMode.Point;
|
||||
// Blit(cmd, gi2, gi4);
|
||||
cmd.Blit(gi22, gi44);
|
||||
|
||||
// RenderTexture.ReleaseTemporary(gi2);
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
|
||||
// gi4.filterMode = FilterMode.Point;
|
||||
// gi3.filterMode = FilterMode.Point;
|
||||
gi44.filterMode = FilterMode.Point;
|
||||
gi33.filterMode = FilterMode.Point;
|
||||
|
||||
|
||||
//Perform bilateral upsampling on half-resolution diffuse GI result
|
||||
segi.material.SetVector("Kernel", new Vector2(1.0f, 0.0f));
|
||||
//Blit3D(cmd, gi4, gi3, segi.material, LuminaHDRP.Pass.BilateralUpsample);
|
||||
BlitCMDF3D(cmd, gi44, gi33, segi.material, LuminaHDRP.Pass.BilateralUpsample);
|
||||
segi.material.SetVector("Kernel", new Vector2(0.0f, 1.0f));
|
||||
|
||||
//Perform temporal reprojection and blending
|
||||
if (segi.temporalBlendWeight < 1.0f)
|
||||
{
|
||||
cmd.Blit(gi33, gi44); //Blit(cmd, gi3, gi4);
|
||||
BlitCMDF3D(cmd, gi44, gi33, segi.material, LuminaHDRP.Pass.TemporalBlend);
|
||||
//Blit3D(cmd, gi4, gi3, segi.material, LUMINA.Pass.TemporalBlend);
|
||||
//Blit(cmd, gi3, segi.previousGIResult);
|
||||
//Blit(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
//BlitG(cmd, gi3, segi.previousGIResult);
|
||||
//BlitG(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(gi33, segi.previousGIResult);
|
||||
//cmd.Blit(source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(segi.DepthBUFFER, segi.previousCameraDepth);
|
||||
}
|
||||
|
||||
//Set the result to be accessed in the shader
|
||||
segi.material.SetTexture("GITexture", gi33);
|
||||
|
||||
//Actually apply the GI to the scene using gbuffer data
|
||||
segi.material.SetTexture("_MainTexSKY", source.rt); //skyA.rt); // source.rt);
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
//Blit3D(cmd, source, destination, segi.material, segi.visualizeGI ? LUMINA.Pass.VisualizeGI : LUMINA.Pass.BlendWithScene);
|
||||
|
||||
//v1.1
|
||||
//BlitCMDF3D(cmd, source, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
cmd.Blit(gi33, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
|
||||
//Release temporary textures
|
||||
// RenderTexture.ReleaseTemporary(gi3);
|
||||
// RenderTexture.ReleaseTemporary(gi4);
|
||||
RenderTexture.ReleaseTemporary(gi33);
|
||||
RenderTexture.ReleaseTemporary(gi44);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
}
|
||||
else //If Half Resolution tracing is disabled
|
||||
{
|
||||
//Perform temporal reprojection and blending
|
||||
if (segi.temporalBlendWeight < 1.0f)
|
||||
{
|
||||
BlitCMDF3D(cmd, gi22, gi11, segi.material, LuminaHDRP.Pass.TemporalBlend);
|
||||
//Blit3D(cmd, gi2, gi1, segi.material, LUMINA.Pass.TemporalBlend);
|
||||
// Blit(cmd, gi1, segi.previousGIResult);
|
||||
// Blit(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
//BlitG(cmd, gi1, segi.previousGIResult);
|
||||
//BlitG(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(gi11, segi.previousGIResult);
|
||||
//cmd.Blit(source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(segi.DepthBUFFER, segi.previousCameraDepth);
|
||||
}
|
||||
|
||||
//Actually apply the GI to the scene using gbuffer data
|
||||
segi.material.SetTexture("GITexture", segi.temporalBlendWeight < 1.0f ? gi11 : gi22);
|
||||
|
||||
//cmd.Blit(gi11, destination);
|
||||
//RenderTexture.ReleaseTemporary(gi11);
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
//return;
|
||||
segi.material.SetTexture("_MainTexSKY", source.rt); //skyA.rt); // source.rt);
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
|
||||
//v1.1
|
||||
//Blit3D(cmd, source, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
cmd.Blit(gi22, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
//Release temporary textures
|
||||
// RenderTexture.ReleaseTemporary(gi1);
|
||||
// RenderTexture.ReleaseTemporary(gi2);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
}
|
||||
|
||||
//Release temporary textures
|
||||
// RenderTexture.ReleaseTemporary(currentDepth);
|
||||
// RenderTexture.ReleaseTemporary(currentNormal);
|
||||
|
||||
//Visualize the sun depth texture
|
||||
if (segi.visualizeSunDepthTexture)
|
||||
{
|
||||
//Blit(cmd, segi.sunDepthTexture, destination);
|
||||
//BlitG(cmd, segi.sunDepthTexture, destination);
|
||||
cmd.Blit(segi.sunDepthTexture, destination);
|
||||
}
|
||||
|
||||
|
||||
//Release the temporary reflections result texture
|
||||
if (segi.doReflections)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(reflectionsA);
|
||||
}
|
||||
|
||||
//Set matrices/vectors for use during temporal reprojection
|
||||
segi.material.SetMatrix("ProjectionPrev", segi.attachedCamera.projectionMatrix);
|
||||
segi.material.SetMatrix("ProjectionPrevInverse", segi.attachedCamera.projectionMatrix.inverse);
|
||||
segi.material.SetMatrix("WorldToCameraPrev", segi.attachedCamera.worldToCameraMatrix);
|
||||
segi.material.SetMatrix("CameraToWorldPrev", segi.attachedCamera.cameraToWorldMatrix);
|
||||
segi.material.SetVector("CameraPositionPrev", segi.transform.position);
|
||||
|
||||
//Advance the frame counter
|
||||
segi.frameCounter = (segi.frameCounter + 1) % (64);
|
||||
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
//Debug.Log("Clean AQUA");
|
||||
//=> CoreUtils.Destroy(_material);
|
||||
CoreUtils.Destroy(_material);
|
||||
if (gi1 != null)//v0.2
|
||||
{
|
||||
gi1.Release();
|
||||
}
|
||||
if (gi2!= null)
|
||||
{
|
||||
gi2.Release();
|
||||
}
|
||||
if (gi3 != null)
|
||||
{
|
||||
gi3.Release();
|
||||
}
|
||||
if (gi4 != null)
|
||||
{
|
||||
gi4.Release();
|
||||
}
|
||||
if (skyA != null)
|
||||
{
|
||||
skyA.Release();
|
||||
}
|
||||
if (reflections != null)
|
||||
{
|
||||
reflections.Release();
|
||||
}
|
||||
if (currentDepth != null)
|
||||
{
|
||||
currentDepth.Release();
|
||||
}
|
||||
if (currentNormal != null)
|
||||
{
|
||||
currentNormal.Release();
|
||||
}
|
||||
// skyA.Release(); reflections.Release();
|
||||
//currentDepth.Release();
|
||||
//currentNormal.Release();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7f6452fa9c094046b05286fdd9c3185
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- _noiseTexture: {fileID: 2800000, guid: 78b5e41a3a01c4aca9be171d2c3e33f5, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,771 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.HighDefinition;
|
||||
|
||||
namespace Artngame.LUMINA {
|
||||
|
||||
[System.Serializable]
|
||||
[VolumeComponentMenu("Post-processing/ARTnGAME/LuminaHDRP Before Post Process")]
|
||||
public sealed class LuminaHDRPVolumeBeforePostProcess
|
||||
: CustomPostProcessVolumeComponent, IPostProcessComponent
|
||||
{
|
||||
#region Effect parameters
|
||||
|
||||
public ClampedFloatParameter opacity
|
||||
= new ClampedFloatParameter(0, 0, 1);
|
||||
|
||||
public ColorParameter edgeColor
|
||||
= new ColorParameter(Color.black);
|
||||
|
||||
public ClampedFloatParameter edgeContrast
|
||||
= new ClampedFloatParameter(1.2f, 0.01f, 4);
|
||||
|
||||
public ColorParameter fillColor
|
||||
= new ColorParameter(Color.white);
|
||||
|
||||
public ClampedFloatParameter blurWidth
|
||||
= new ClampedFloatParameter(1, 0, 2);
|
||||
|
||||
public ClampedFloatParameter blurFrequency
|
||||
= new ClampedFloatParameter(0.5f, 0, 1);
|
||||
|
||||
public ClampedFloatParameter hueShift
|
||||
= new ClampedFloatParameter(0.1f, 0, 0.3f);
|
||||
|
||||
public ClampedFloatParameter interval
|
||||
= new ClampedFloatParameter(1, 0.1f, 5);
|
||||
|
||||
public ClampedIntParameter iteration
|
||||
= new ClampedIntParameter(20, 4, 32);
|
||||
|
||||
public VolumeParameter<OverlayMode> overlayMode
|
||||
= new VolumeParameter<OverlayMode>();
|
||||
|
||||
public NoInterpTextureParameter overlayTexture
|
||||
= new NoInterpTextureParameter(null);
|
||||
|
||||
public ClampedFloatParameter overlayOpacity
|
||||
= new ClampedFloatParameter(0, 0, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private members
|
||||
|
||||
static readonly string ShaderName
|
||||
= "Hidden/Kino/Aqua/HighDefinition";
|
||||
|
||||
Material _material;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IPostProcessComponent implementation
|
||||
|
||||
public bool IsActive()
|
||||
=> _material != null && opacity.value > 0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region CustomPostProcessVolumeComponent implementation
|
||||
|
||||
public override CustomPostProcessInjectionPoint injectionPoint
|
||||
=> CustomPostProcessInjectionPoint.AfterOpaqueAndSky;
|
||||
|
||||
//LUMINA
|
||||
//RTHandle lrDepthBuffer;
|
||||
RTHandle skyA;
|
||||
RTHandle gi1;
|
||||
RTHandle gi2;
|
||||
RTHandle gi3;
|
||||
RTHandle gi4;
|
||||
RTHandle reflections;
|
||||
RTHandle currentDepth;
|
||||
RTHandle currentNormal;
|
||||
|
||||
//gi2.filterMode = FilterMode.Point;
|
||||
// gi4.filterMode = FilterMode.Point;
|
||||
// gi3.filterMode = FilterMode.Point;
|
||||
// RenderTexture skyA = RenderTexture.GetTemporary(srcRT.rt.width, srcRT.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
//RenderTexture gi1 = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
//RenderTexture gi2 = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
//reflections = RenderTexture.GetTemporary(source.width, source.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
// RenderTexture currentDepth = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.RFloat, RenderTextureReadWrite.Linear);
|
||||
//RenderTexture currentNormal = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
|
||||
//currentNormal.filterMode = FilterMode.Point;
|
||||
|
||||
|
||||
public override void Setup()
|
||||
{
|
||||
if (Camera.main == null || Camera.current != null)//v0.2
|
||||
{
|
||||
//Debug.Log("No cam5b");
|
||||
return;
|
||||
}
|
||||
|
||||
_material = CoreUtils.CreateEngineMaterial(ShaderName);
|
||||
|
||||
//LUMINA
|
||||
var hdrpAsset = (GraphicsSettings.defaultRenderPipeline as HDRenderPipelineAsset);
|
||||
var colorBufferFormat = hdrpAsset.currentPlatformRenderPipelineSettings.colorBufferFormat;
|
||||
//if (lrDepthBuffer == null)
|
||||
//{
|
||||
// lrDepthBuffer = RTHandles.Alloc(
|
||||
// Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
// colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)colorBufferFormat, // We don't need alpha in the blur
|
||||
// useDynamicScale: true, name: "lrDepthBuffer"
|
||||
// );
|
||||
//}
|
||||
|
||||
UnityEngine.Experimental.Rendering.GraphicsFormat format1 = UnityEngine.Experimental.Rendering.GraphicsFormat.R16G16B16A16_SFloat;
|
||||
|
||||
if (gi1 == null)
|
||||
{
|
||||
gi1 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi1"
|
||||
);
|
||||
}
|
||||
if (gi2== null)
|
||||
{
|
||||
gi2 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi2"
|
||||
);
|
||||
}
|
||||
if (gi3 == null)
|
||||
{
|
||||
gi3 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi3"
|
||||
);
|
||||
}
|
||||
if (gi4 == null)
|
||||
{
|
||||
gi4 = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "gi4"
|
||||
);
|
||||
}
|
||||
if (reflections == null)
|
||||
{
|
||||
reflections = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "reflections"
|
||||
);
|
||||
}
|
||||
if (currentDepth == null)
|
||||
{
|
||||
currentDepth = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "currentDepth"
|
||||
);
|
||||
}
|
||||
if (currentNormal == null)
|
||||
{
|
||||
currentNormal = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "currentNormal"
|
||||
);
|
||||
}
|
||||
if (skyA == null)
|
||||
{
|
||||
skyA = RTHandles.Alloc(
|
||||
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
|
||||
colorFormat: (UnityEngine.Experimental.Rendering.GraphicsFormat)format1, // We don't need alpha in the blur
|
||||
useDynamicScale: true, name: "skyA"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
//=> _material = CoreUtils.CreateEngineMaterial(ShaderName);
|
||||
|
||||
public override void Render
|
||||
(CommandBuffer cmd, HDCamera camera, RTHandle srcRT, RTHandle destRT)
|
||||
{
|
||||
|
||||
|
||||
//v0.1
|
||||
bool enableGI = false;
|
||||
if (Camera.main != null)
|
||||
{
|
||||
LuminaHDRP segi = Camera.main.GetComponent<LuminaHDRP>();
|
||||
if (segi != null)
|
||||
{
|
||||
enableGI = !segi.disableGI;
|
||||
}
|
||||
}
|
||||
if (//RenderSettings.sun == null || !RenderSettings.sun.enabled ||
|
||||
!enableGI || (Camera.main != null && Camera.current != null && Camera.current != Camera.main) || Camera.main == null || Camera.current != null //v0.2
|
||||
) { return; }
|
||||
|
||||
|
||||
ShaderHelper.SetProperties
|
||||
(_material, srcRT,
|
||||
opacity: opacity.value,
|
||||
edgeColor: edgeColor.value,
|
||||
edgeContrast: edgeContrast.value,
|
||||
fillColor: fillColor.value,
|
||||
blurWidth: blurWidth.value,
|
||||
blurFrequency: blurFrequency.value,
|
||||
hueShift: hueShift.value,
|
||||
interval: interval.value,
|
||||
iteration: iteration.value);
|
||||
|
||||
ShaderHelper.SetOverlayProperties
|
||||
(_material,
|
||||
overlayMode.value,
|
||||
overlayTexture.value,
|
||||
overlayOpacity.value);
|
||||
|
||||
|
||||
//LUMINA
|
||||
//// Target ID
|
||||
//var rt = camera.camera.targetTexture;
|
||||
//var rtid = rt != null ?
|
||||
// new RenderTargetIdentifier(rt) :
|
||||
// new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget);
|
||||
|
||||
|
||||
|
||||
//Camera cameraA = renderingData.cameraData.camera;
|
||||
//RenderTextureDescriptor cameraTextureDescriptor = renderingData.cameraData.cameraTargetDescriptor;
|
||||
// RenderTexture skyA = RenderTexture.GetTemporary(srcRT.rt.width, srcRT.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
//var skyA_RTID = new RenderTargetIdentifier(skyA);
|
||||
//HDUtils.BlitCameraTexture()
|
||||
//Graphics.Blit(destRT, skyA); //Blit(cmd, source, skyA);
|
||||
RenderTexture.active = skyA;
|
||||
GL.ClearWithSkybox(false, camera.camera);
|
||||
|
||||
|
||||
// RenderTexture gi1 = RenderTexture.GetTemporary(srcRT.rt.width, srcRT.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
|
||||
OnRenderImageA(camera.camera, cmd, srcRT, gi1);
|
||||
|
||||
// Graphics.Blit(gi1, destRT);
|
||||
//Blit(cmd, gi1, _cameraColorTargetIdent);
|
||||
//context.ExecuteCommandBuffer(cmd);
|
||||
//CommandBufferPool.Release(cmd);
|
||||
|
||||
|
||||
|
||||
//var downsampleProperties = new MaterialPropertyBlock();
|
||||
//downsampleProperties.SetTexture("_InputTextureA", destRT);
|
||||
//downsampleProperties.SetFloat("_Height", Camera.main.transform.position.y);
|
||||
//HDUtils.DrawFullScreen(cmd, sheetSHAFTS, m_TemporaryColorTextureScaled, downsampleProperties, 11);
|
||||
|
||||
|
||||
|
||||
|
||||
// Change render target type
|
||||
// RenderTargetHandle renderTarget;
|
||||
// RTHandle renderTarget;
|
||||
// Associate the shader property with the render target using RTHandles.Alloc instead of renderTarget.Init
|
||||
// renderTarget.Init("_ShaderProperty");
|
||||
// renderTarget = RTHandles.Alloc("_ShaderProperty", name: "_ShaderProperty");
|
||||
// Assign temporary render texture using the shader property identifier
|
||||
// cmd.GetTemporaryRT(renderTarget.id, targetDescriptor, filterMode);
|
||||
// cmd.GetTemporaryRT(Shader.PropertyToID(renderTarget.name), targetDescriptor, filterMode);
|
||||
// Modify ConfigureTarget to use the new RTHandle instead of the old RenderTargetIdentifier
|
||||
// ConfigureTarget(renderTarget.id);
|
||||
// ConfigureTarget(renderTarget);
|
||||
// Get the render texture identifier from the shader property
|
||||
// cmd.ReleaseTemporaryRT(renderTarget.id);
|
||||
// cmd.ReleaseTemporaryRT(Shader.PropertyToID(renderTarget.name));
|
||||
////END LUMINA
|
||||
|
||||
HDUtils.BlitCameraTexture(cmd, gi1, destRT);
|
||||
//HDUtils.DrawFullScreen(cmd, _material, destRT, null, 0);
|
||||
//HDUtils.DrawFullScreen(cmd, _material, destRT, null, 0);
|
||||
|
||||
//LUMINA
|
||||
// RenderTexture.ReleaseTemporary(skyA);
|
||||
// RenderTexture.ReleaseTemporary(gi1);
|
||||
|
||||
//ExecuteCommandBuffer(cmd);
|
||||
//CommandBufferPool.Release(cmd);
|
||||
}
|
||||
|
||||
//LUMINA
|
||||
void BlitG(CommandBuffer cmd, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
//material.SetTexture(ShaderIDs.MainTex, source);
|
||||
Graphics.Blit(source, destination);
|
||||
}
|
||||
void BlitG(CommandBuffer cmd, RenderTexture source, RenderTexture destination, Material material, int pass)
|
||||
{
|
||||
//material.SetTexture(ShaderIDs.MainTex, source);
|
||||
Graphics.Blit(source, destination, material, pass, pass);
|
||||
}
|
||||
void Blit(CommandBuffer cmd, RTHandle source, RTHandle destination)
|
||||
{
|
||||
_material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
HDUtils.DrawFullScreen(cmd, _material, destination, null, 0);//CORRECT
|
||||
}
|
||||
void BlitCMD(CommandBuffer cmd, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
//_material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
cmd.Blit(source, destination);
|
||||
}
|
||||
void BlitCMDF(CommandBuffer cmd, RenderTexture source, RenderTexture destination, Material material, int pass)
|
||||
{
|
||||
//_material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
cmd.Blit(source, destination, material,pass);
|
||||
}
|
||||
void BlitCMDF3D(CommandBuffer cmd, RenderTexture source, RenderTexture destination, Material material, int pass)
|
||||
{
|
||||
// material.SetTexture("_MainTexARRAY", source);
|
||||
cmd.Blit(source, destination, material, pass);
|
||||
}
|
||||
void Blit(CommandBuffer cmd, RTHandle source, RTHandle destination, Material material, int pass)
|
||||
{
|
||||
material.SetTexture(ShaderIDs.MainTex, source.rt);
|
||||
HDUtils.DrawFullScreen(cmd, material, destination, null, pass);
|
||||
}
|
||||
void Blit3D(CommandBuffer cmd, RTHandle source, RTHandle destination, Material material, int pass)
|
||||
{
|
||||
material.SetTexture("_MainTexARRAY", source.rt);
|
||||
HDUtils.DrawFullScreen(cmd, material, destination, null, pass);
|
||||
}
|
||||
void OnRenderImageA(Camera camera, CommandBuffer cmd, RTHandle source, RTHandle destination) //void OnRenderImageA(Camera camera, CommandBuffer cmd, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
// Graphics.Blit(source, destination);
|
||||
//Blit(cmd, source, destination);
|
||||
//return;
|
||||
|
||||
if (Camera.main == null || Camera.current != null)//v0.2
|
||||
{
|
||||
//Debug.Log("No cam5b");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Camera.main != null && camera != Camera.main || Camera.current != null)//v0.2
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Debug.Log(Camera.main.orthographic);
|
||||
Camera.main.depthTextureMode = DepthTextureMode.Depth;
|
||||
|
||||
//v0.1
|
||||
if (Camera.main != null)
|
||||
{
|
||||
LuminaHDRP segi = Camera.main.GetComponent<LuminaHDRP>(); //LUMINA segi = Camera.main.GetComponent<LUMINA>();
|
||||
if (segi != null && segi.enabled)
|
||||
{
|
||||
if (segi.notReadyToRender)
|
||||
{
|
||||
//Blit(cmd, source, source);
|
||||
//Graphics.Blit(source, destination);
|
||||
//Graphics.Blit();
|
||||
//HDUtils.BlitCameraTexture()
|
||||
//Blit(cmd, source, destination);
|
||||
cmd.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
|
||||
//Set parameters
|
||||
Shader.SetGlobalFloat("SEGIVoxelScaleFactor", segi.voxelScaleFactor);
|
||||
|
||||
if (!segi.material)//v0.2a
|
||||
{
|
||||
segi.material = new Material(Shader.Find("Hidden/SEGI"));
|
||||
//material.hideFlags = HideFlags.HideAndDontSave;//v0.2
|
||||
}
|
||||
|
||||
segi.material.SetMatrix("CameraToWorld", segi.attachedCamera.cameraToWorldMatrix);
|
||||
segi.material.SetMatrix("WorldToCamera", segi.attachedCamera.worldToCameraMatrix);
|
||||
segi.material.SetMatrix("ProjectionMatrixInverse", segi.attachedCamera.projectionMatrix.inverse);
|
||||
segi.material.SetMatrix("ProjectionMatrix", segi.attachedCamera.projectionMatrix);
|
||||
segi.material.SetInt("FrameSwitch", segi.frameCounter);
|
||||
Shader.SetGlobalInt("SEGIFrameSwitch", segi.frameCounter);
|
||||
segi.material.SetVector("CameraPosition", segi.transform.position);
|
||||
segi.material.SetFloat("DeltaTime", Time.deltaTime);
|
||||
|
||||
segi.material.SetInt("StochasticSampling", segi.stochasticSampling ? 1 : 0);
|
||||
segi.material.SetInt("TraceDirections", segi.cones);
|
||||
segi.material.SetInt("TraceSteps", segi.coneTraceSteps);
|
||||
segi.material.SetFloat("TraceLength", segi.coneLength);
|
||||
segi.material.SetFloat("ConeSize", segi.coneWidth);
|
||||
segi.material.SetFloat("OcclusionStrength", segi.occlusionStrength);
|
||||
segi.material.SetFloat("OcclusionPower", segi.occlusionPower);
|
||||
segi.material.SetFloat("ConeTraceBias", segi.coneTraceBias);
|
||||
segi.material.SetFloat("GIGain", segi.giGain);
|
||||
segi.material.SetFloat("NearLightGain", segi.nearLightGain);
|
||||
segi.material.SetFloat("NearOcclusionStrength", segi.nearOcclusionStrength);
|
||||
segi.material.SetInt("DoReflections", segi.doReflections ? 1 : 0);
|
||||
segi.material.SetInt("HalfResolution", segi.halfResolution ? 1 : 0);
|
||||
segi.material.SetInt("ReflectionSteps", segi.reflectionSteps);
|
||||
segi.material.SetFloat("ReflectionOcclusionPower", segi.reflectionOcclusionPower);
|
||||
segi.material.SetFloat("SkyReflectionIntensity", segi.skyReflectionIntensity);
|
||||
segi.material.SetFloat("FarOcclusionStrength", segi.farOcclusionStrength);
|
||||
segi.material.SetFloat("FarthestOcclusionStrength", segi.farthestOcclusionStrength);
|
||||
segi.material.SetTexture("NoiseTexture", segi.blueNoise[segi.frameCounter % 64]);
|
||||
segi.material.SetFloat("BlendWeight", segi.temporalBlendWeight);
|
||||
|
||||
//v0.4
|
||||
segi.material.SetFloat("contrastA", segi.contrastA);
|
||||
segi.material.SetVector("ReflectControl", segi.ReflectControl);
|
||||
|
||||
//v0.7
|
||||
segi.material.SetVector("ditherControl",
|
||||
new Vector4(segi.DitherControl.x,
|
||||
Mathf.Clamp(segi.DitherControl.y, 0.1f, 10),
|
||||
Mathf.Clamp(segi.DitherControl.z, 0.1f, 10),
|
||||
Mathf.Clamp(segi.DitherControl.w, 0.1f, 10))); //v1.2b
|
||||
|
||||
//v1.2
|
||||
segi.material.SetFloat("smoothNormals", segi.smoothNormals);
|
||||
|
||||
//If Visualize Voxels is enabled, just render the voxel visualization shader pass and return
|
||||
if (segi.visualizeVoxels)
|
||||
{
|
||||
//Blit(cmd, source, destination);
|
||||
//Debug.Log("AA");
|
||||
//segi.material.SetTexture("_MainTexARRAY", source.rt);
|
||||
Blit3D(cmd, source, destination, segi.material, LuminaHDRP.Pass.VisualizeVoxels);
|
||||
//Blit(cmd, source, destination, segi.material, LUMINA.Pass.VisualizeVoxels);
|
||||
return;
|
||||
}
|
||||
|
||||
//Setup temporary textures
|
||||
// RenderTexture gi1 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
//RenderTexture gi2 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf);
|
||||
RenderTexture gi11 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBFloat);
|
||||
RenderTexture gi22 = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBFloat);
|
||||
RenderTexture reflectionsA = null;
|
||||
|
||||
//If reflections are enabled, create a temporary render buffer to hold them
|
||||
if (segi.doReflections)
|
||||
{
|
||||
reflectionsA = RenderTexture.GetTemporary(source.rt.width, source.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Setup textures to hold the current camera depth and normal
|
||||
// RenderTexture currentDepth = RenderTexture.GetTemporary(source.rt.width / segi.giRenderRes, source.rt.height / segi.giRenderRes, 0, RenderTextureFormat.RFloat, RenderTextureReadWrite.Linear);
|
||||
// currentDepth.filterMode = FilterMode.Point;
|
||||
|
||||
// RenderTexture currentNormal = RenderTexture.GetTemporary(source.width / segi.giRenderRes, source.height / segi.giRenderRes, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
|
||||
// currentNormal.filterMode = FilterMode.Point;
|
||||
|
||||
|
||||
// //HDRP2
|
||||
// cmd.Blit(segi.DepthBUFFER, currentDepth);
|
||||
|
||||
//Get the camera depth and normals
|
||||
//// Blit(cmd, source, currentDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);//v0.1
|
||||
//Blit(cmd, source, currentDepth, segi.material, VolumeLitSEGI.Pass.GetCameraDepthTexture);
|
||||
// cmd.Blit(source, currentDepth, segi.material, 13);// LUMINA.Pass.GetCameraDepthTexture);
|
||||
// cmd.Blit(source, currentDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);// LUMINA.Pass.GetCameraDepthTexture);
|
||||
// segi.material.SetTexture("CurrentDepth", currentDepth);
|
||||
//Graphics.Blit(segi.NormalBUFFER, segi.DepthBUFFERH);
|
||||
//cmd.Blit(segi.NormalBUFFER, segi.DepthBUFFERH);
|
||||
segi.material.SetTexture("CurrentDepth", segi.DepthBUFFER);// currentDepth); //segi.NormalBUFFER);
|
||||
|
||||
//v1.5
|
||||
if (!segi.useInternalDepth)
|
||||
{
|
||||
segi.material.SetTexture("_CameraDepthTexture", segi.DepthBUFFER); //currentDepth); //// HDRP !!!! //HDRP2
|
||||
}
|
||||
else
|
||||
{
|
||||
segi.material.SetTexture("_CameraDepthTexture", segi.DepthBUFFERInternal);//v1.6
|
||||
}
|
||||
|
||||
//// Blit(cmd, source, currentNormal, segi.material, LUMINA.Pass.GetWorldNormals);
|
||||
//// segi.material.SetTexture("CurrentNormal", currentNormal);
|
||||
//cmd.Blit(segi.NormalBUFFER, segi.NormalBUFFERH);
|
||||
segi.material.SetTexture("CurrentNormal", segi.NormalBUFFER);// segi.DepthBUFFER);
|
||||
|
||||
|
||||
//v0.1 - check depths
|
||||
if (segi.visualizeNORMALS)
|
||||
{
|
||||
cmd.Blit(segi.NormalBUFFER, destination);
|
||||
// Blit(cmd, segi.NormalBUFFERH, destination);
|
||||
//BlitG(cmd, segi.NormalBUFFER, destination);
|
||||
//Blit(cmd, currentNormal, destination);
|
||||
//RenderTexture.ReleaseTemporary(currentDepth);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
return;
|
||||
}
|
||||
if (segi.visualizeDEPTH)
|
||||
{
|
||||
|
||||
//cmd.Blit(segi.DepthBUFFER, destination); //HDRP2
|
||||
if (!segi.useInternalDepth)
|
||||
{
|
||||
cmd.Blit(segi.DepthBUFFER, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Blit(segi.DepthBUFFERInternal, destination);
|
||||
}
|
||||
//Blit(cmd, currentDepth, destination);
|
||||
// RenderTexture.ReleaseTemporary(currentDepth);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Set the previous GI result and camera depth textures to access them in the shader
|
||||
segi.material.SetTexture("PreviousGITexture", segi.previousGIResult);
|
||||
Shader.SetGlobalTexture("PreviousGITexture", segi.previousGIResult);
|
||||
segi.material.SetTexture("PreviousDepth", segi.previousCameraDepth);
|
||||
|
||||
//Render diffuse GI tracing result
|
||||
// Blit3D(cmd, source, gi2, segi.material, LUMINA.Pass.DiffuseTrace);
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
//Blit3D(cmd, source, gi22, segi.material, LUMINA.Pass.DiffuseTrace);
|
||||
//Blit3D(cmd, source, destination, segi.material, LUMINA.Pass.DiffuseTrace); return;
|
||||
|
||||
|
||||
cmd.Blit(source, gi22, segi.material, LuminaHDRP.Pass.DiffuseTrace);
|
||||
// cmd.Blit(gi22, destination);
|
||||
//RenderTexture.ReleaseTemporary(gi11);
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
//return;
|
||||
|
||||
if (segi.visualizeGI)
|
||||
{
|
||||
//Blit(cmd, gi2, destination);
|
||||
cmd.Blit(gi22, destination);
|
||||
|
||||
//RenderTexture.ReleaseTemporary(currentDepth);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
return;
|
||||
}
|
||||
|
||||
if (segi.doReflections)
|
||||
{
|
||||
//Render GI reflections result
|
||||
BlitCMDF3D(cmd, source, reflectionsA, segi.material, LuminaHDRP.Pass.SpecularTrace);
|
||||
//Blit(cmd, source, reflections, segi.material, LuminaHDRP.Pass.SpecularTrace);
|
||||
segi.material.SetTexture("Reflections", reflectionsA);
|
||||
}
|
||||
|
||||
|
||||
//Perform bilateral filtering
|
||||
if (segi.useBilateralFiltering)
|
||||
{
|
||||
segi.material.SetVector("Kernel", new Vector2(0.0f, 1.0f));
|
||||
BlitCMDF(cmd, gi22, gi11, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
|
||||
segi.material.SetVector("Kernel", new Vector2(1.0f, 0.0f));
|
||||
BlitCMDF(cmd, gi11, gi22, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
|
||||
segi.material.SetVector("Kernel", new Vector2(0.0f, 1.0f));
|
||||
BlitCMDF(cmd, gi22, gi11, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
|
||||
segi.material.SetVector("Kernel", new Vector2(1.0f, 0.0f));
|
||||
BlitCMDF(cmd, gi11, gi22, segi.material, LuminaHDRP.Pass.BilateralBlur);
|
||||
}
|
||||
|
||||
//If Half Resolution tracing is enabled
|
||||
if (segi.giRenderRes == 2)
|
||||
{
|
||||
// Debug.Log("HALF RES");
|
||||
|
||||
// RenderTexture.ReleaseTemporary(gi1);
|
||||
RenderTexture.ReleaseTemporary(gi11);//HDRP
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
|
||||
//Setup temporary textures
|
||||
// RenderTexture gi3 = RenderTexture.GetTemporary(source.width, source.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
// RenderTexture gi4 = RenderTexture.GetTemporary(source.width, source.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
RenderTexture gi33 = RenderTexture.GetTemporary(source.rt.width, source.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
RenderTexture gi44 = RenderTexture.GetTemporary(source.rt.width, source.rt.height, 0, RenderTextureFormat.ARGBHalf);
|
||||
|
||||
|
||||
//Prepare the half-resolution diffuse GI result to be bilaterally upsampled
|
||||
// gi2.filterMode = FilterMode.Point;
|
||||
gi22.filterMode = FilterMode.Point;
|
||||
// Blit(cmd, gi2, gi4);
|
||||
cmd.Blit(gi22, gi44);
|
||||
|
||||
// RenderTexture.ReleaseTemporary(gi2);
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
|
||||
// gi4.filterMode = FilterMode.Point;
|
||||
// gi3.filterMode = FilterMode.Point;
|
||||
gi44.filterMode = FilterMode.Point;
|
||||
gi33.filterMode = FilterMode.Point;
|
||||
|
||||
|
||||
//Perform bilateral upsampling on half-resolution diffuse GI result
|
||||
segi.material.SetVector("Kernel", new Vector2(1.0f, 0.0f));
|
||||
//Blit3D(cmd, gi4, gi3, segi.material, LuminaHDRP.Pass.BilateralUpsample);
|
||||
BlitCMDF3D(cmd, gi44, gi33, segi.material, LuminaHDRP.Pass.BilateralUpsample);
|
||||
segi.material.SetVector("Kernel", new Vector2(0.0f, 1.0f));
|
||||
|
||||
//Perform temporal reprojection and blending
|
||||
if (segi.temporalBlendWeight < 1.0f)
|
||||
{
|
||||
cmd.Blit(gi33, gi44); //Blit(cmd, gi3, gi4);
|
||||
BlitCMDF3D(cmd, gi44, gi33, segi.material, LuminaHDRP.Pass.TemporalBlend);
|
||||
//Blit3D(cmd, gi4, gi3, segi.material, LUMINA.Pass.TemporalBlend);
|
||||
//Blit(cmd, gi3, segi.previousGIResult);
|
||||
//Blit(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
//BlitG(cmd, gi3, segi.previousGIResult);
|
||||
//BlitG(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(gi33, segi.previousGIResult);
|
||||
//cmd.Blit(source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(segi.DepthBUFFER, segi.previousCameraDepth);
|
||||
}
|
||||
|
||||
//Set the result to be accessed in the shader
|
||||
segi.material.SetTexture("GITexture", gi33);
|
||||
|
||||
//Actually apply the GI to the scene using gbuffer data
|
||||
segi.material.SetTexture("_MainTexSKY", source.rt); //skyA.rt); // source.rt);
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
//Blit3D(cmd, source, destination, segi.material, segi.visualizeGI ? LUMINA.Pass.VisualizeGI : LUMINA.Pass.BlendWithScene);
|
||||
|
||||
//v1.1
|
||||
//BlitCMDF3D(cmd, source, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
cmd.Blit(gi33, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
|
||||
//Release temporary textures
|
||||
// RenderTexture.ReleaseTemporary(gi3);
|
||||
// RenderTexture.ReleaseTemporary(gi4);
|
||||
RenderTexture.ReleaseTemporary(gi33);
|
||||
RenderTexture.ReleaseTemporary(gi44);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
}
|
||||
else //If Half Resolution tracing is disabled
|
||||
{
|
||||
//Perform temporal reprojection and blending
|
||||
if (segi.temporalBlendWeight < 1.0f)
|
||||
{
|
||||
BlitCMDF3D(cmd, gi22, gi11, segi.material, LuminaHDRP.Pass.TemporalBlend);
|
||||
//Blit3D(cmd, gi2, gi1, segi.material, LUMINA.Pass.TemporalBlend);
|
||||
// Blit(cmd, gi1, segi.previousGIResult);
|
||||
// Blit(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
//BlitG(cmd, gi1, segi.previousGIResult);
|
||||
//BlitG(cmd, source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(gi11, segi.previousGIResult);
|
||||
//cmd.Blit(source, segi.previousCameraDepth, segi.material, LUMINA.Pass.GetCameraDepthTexture);
|
||||
cmd.Blit(segi.DepthBUFFER, segi.previousCameraDepth);
|
||||
}
|
||||
|
||||
//Actually apply the GI to the scene using gbuffer data
|
||||
segi.material.SetTexture("GITexture", segi.temporalBlendWeight < 1.0f ? gi11 : gi22);
|
||||
|
||||
//cmd.Blit(gi11, destination);
|
||||
//RenderTexture.ReleaseTemporary(gi11);
|
||||
//RenderTexture.ReleaseTemporary(gi22);
|
||||
//return;
|
||||
segi.material.SetTexture("_MainTexSKY", source.rt); //skyA.rt); // source.rt);
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
|
||||
//v1.1
|
||||
//Blit3D(cmd, source, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
cmd.Blit(gi22, destination, segi.material, segi.visualizeGI ? LuminaHDRP.Pass.VisualizeGI : LuminaHDRP.Pass.BlendWithScene);
|
||||
|
||||
segi.material.SetTexture("currentNormals", segi.NormalBUFFER);//HDRP
|
||||
//Release temporary textures
|
||||
// RenderTexture.ReleaseTemporary(gi1);
|
||||
// RenderTexture.ReleaseTemporary(gi2);
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
}
|
||||
|
||||
//Release temporary textures
|
||||
// RenderTexture.ReleaseTemporary(currentDepth);
|
||||
// RenderTexture.ReleaseTemporary(currentNormal);
|
||||
|
||||
//Visualize the sun depth texture
|
||||
if (segi.visualizeSunDepthTexture)
|
||||
{
|
||||
//Blit(cmd, segi.sunDepthTexture, destination);
|
||||
//BlitG(cmd, segi.sunDepthTexture, destination);
|
||||
cmd.Blit(segi.sunDepthTexture, destination);
|
||||
}
|
||||
|
||||
|
||||
//Release the temporary reflections result texture
|
||||
if (segi.doReflections)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(reflectionsA);
|
||||
}
|
||||
|
||||
//Set matrices/vectors for use during temporal reprojection
|
||||
segi.material.SetMatrix("ProjectionPrev", segi.attachedCamera.projectionMatrix);
|
||||
segi.material.SetMatrix("ProjectionPrevInverse", segi.attachedCamera.projectionMatrix.inverse);
|
||||
segi.material.SetMatrix("WorldToCameraPrev", segi.attachedCamera.worldToCameraMatrix);
|
||||
segi.material.SetMatrix("CameraToWorldPrev", segi.attachedCamera.cameraToWorldMatrix);
|
||||
segi.material.SetVector("CameraPositionPrev", segi.transform.position);
|
||||
|
||||
//Advance the frame counter
|
||||
segi.frameCounter = (segi.frameCounter + 1) % (64);
|
||||
|
||||
RenderTexture.ReleaseTemporary(gi11);
|
||||
RenderTexture.ReleaseTemporary(gi22);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
//Debug.Log("Clean AQUA");
|
||||
//=> CoreUtils.Destroy(_material);
|
||||
CoreUtils.Destroy(_material);//v0.2
|
||||
if (gi1 != null)
|
||||
{
|
||||
gi1.Release();
|
||||
}
|
||||
if (gi2 != null)
|
||||
{
|
||||
gi2.Release();
|
||||
}
|
||||
if (gi3 != null)
|
||||
{
|
||||
gi3.Release();
|
||||
}
|
||||
if (gi4 != null)
|
||||
{
|
||||
gi4.Release();
|
||||
}
|
||||
if (skyA != null)
|
||||
{
|
||||
skyA.Release();
|
||||
}
|
||||
if (reflections != null)
|
||||
{
|
||||
reflections.Release();
|
||||
}
|
||||
if (currentDepth != null)
|
||||
{
|
||||
currentDepth.Release();
|
||||
}
|
||||
if (currentNormal != null)
|
||||
{
|
||||
currentNormal.Release();
|
||||
}
|
||||
//currentDepth.Release();
|
||||
//currentNormal.Release();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c04d8e6d55daa574797b1aca5fd8a03c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- _noiseTexture: {fileID: 2800000, guid: 78b5e41a3a01c4aca9be171d2c3e33f5, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8bd89b5c9e5a4ac9b8df8e6c7a70f2a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,95 @@
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
|
||||
|
||||
#define KINO_AQUA_INPUT_TEXTURE(x) TEXTURE2D_X(x)
|
||||
#define KINO_AQUA_NOISE_TEXTURE(x) TEXTURE2D(x)
|
||||
|
||||
#define KINO_AQUA_SAMPLE_INPUT_TEXTURE(p) \
|
||||
SAMPLE_TEXTURE2D_X(inputTexture, s_linear_clamp_sampler, \
|
||||
ClampAndScaleUVForBilinear(p))
|
||||
|
||||
#define KINO_AQUA_SAMPLE_NOISE_TEXTURE(p) \
|
||||
SAMPLE_TEXTURE2D(noiseTexture, s_linear_repeat_sampler, p)
|
||||
|
||||
//#include "Packages/jp.keijiro.kino.aqua/Shaders/KinoAquaFilter.hlsl"
|
||||
#include "KinoAquaFilter.hlsl"
|
||||
|
||||
TEXTURE2D_X(_MainTex);
|
||||
TEXTURE2D(_NoiseTexture);
|
||||
TEXTURE2D(_OverlayTexture);
|
||||
|
||||
float4 _EffectParams1;
|
||||
float2 _EffectParams2;
|
||||
float4 _EdgeColor;
|
||||
float4 _FillColor;
|
||||
uint _Iteration;
|
||||
float _OverlayOpacity;
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
uint vertexID : SV_VertexID;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings Vertex(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID);
|
||||
output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID);
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 Fragment(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = input.texcoord;
|
||||
|
||||
KinoAquaFilter aqua;
|
||||
|
||||
aqua.inputTexture = _MainTex;
|
||||
aqua.noiseTexture = _NoiseTexture;
|
||||
|
||||
aqua.edgeColor = _EdgeColor;
|
||||
aqua.fillColor = _FillColor;
|
||||
|
||||
aqua.aspectRatio = _ScreenSize.x / _ScreenSize.y;
|
||||
aqua.aspectRatioRcp = 1 / aqua.aspectRatio;
|
||||
|
||||
aqua.iteration = _Iteration;
|
||||
aqua.iterationRcp = 1.0 / _Iteration;
|
||||
|
||||
float opacity = _EffectParams1.x;
|
||||
aqua.interval = _EffectParams1.y;
|
||||
aqua.blurWidth = _EffectParams1.z;
|
||||
aqua.blurFrequency = _EffectParams1.w;
|
||||
aqua.edgeContrast = _EffectParams2.x;
|
||||
aqua.hueShift = _EffectParams2.y;
|
||||
|
||||
// Main effect
|
||||
float3 res = aqua.ProcessAt(uv);
|
||||
|
||||
// Overlay blending in sRGB
|
||||
float3 ovr = SAMPLE_TEXTURE2D(_OverlayTexture, s_linear_repeat_sampler, uv).rgb;
|
||||
|
||||
res = LinearToSRGB(res);
|
||||
ovr = LinearToSRGB(ovr);
|
||||
|
||||
res = KinoAquaOverlay(res, ovr, _OverlayOpacity);
|
||||
|
||||
res = SRGBToLinear(res);
|
||||
|
||||
// Source/effect blending
|
||||
float4 src = LOAD_TEXTURE2D_X(_MainTex, uv * _ScreenSize.xy);
|
||||
return float4(lerp(src.rgb, res, opacity), src.a);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7515367276243424eaf972c32ad1be89
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
Shader "Hidden/Kino/Aqua/HighDefinition"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
#pragma shader_feature _ KINO_AQUA_OVERLAY KINO_AQUA_MULTIPLY KINO_AQUA_SCREEN
|
||||
#pragma vertex Vertex
|
||||
#pragma fragment Fragment
|
||||
#include "KinoAqua.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5e890c9e5a97467a9dd24d0e4e59bbc
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,160 @@
|
||||
#pragma once
|
||||
|
||||
struct KinoAquaFilter
|
||||
{
|
||||
// Data members
|
||||
|
||||
KINO_AQUA_INPUT_TEXTURE(inputTexture);
|
||||
KINO_AQUA_NOISE_TEXTURE(noiseTexture);
|
||||
|
||||
float4 edgeColor;
|
||||
float4 fillColor;
|
||||
|
||||
float aspectRatio;
|
||||
float aspectRatioRcp;
|
||||
|
||||
uint iteration;
|
||||
float iterationRcp;
|
||||
|
||||
float interval;
|
||||
float blurWidth;
|
||||
float blurFrequency;
|
||||
float edgeContrast;
|
||||
float hueShift;
|
||||
|
||||
// Basic math function
|
||||
|
||||
float2 Rotate90(float2 v)
|
||||
{
|
||||
return v.yx * float2(-1, 1);
|
||||
}
|
||||
|
||||
// Coordinate system conversion
|
||||
|
||||
// UV to vertically normalized screen coordinates
|
||||
float2 UV2SC(float2 uv)
|
||||
{
|
||||
float2 p = uv - 0.5;
|
||||
p.x *= aspectRatio;
|
||||
return p;
|
||||
}
|
||||
|
||||
// Vertically normalized screen coordinates to UV
|
||||
float2 SC2UV(float2 p)
|
||||
{
|
||||
p.x *= aspectRatioRcp;
|
||||
return p + 0.5;
|
||||
}
|
||||
|
||||
// Texture sampling functions
|
||||
|
||||
float3 SampleColor(float2 p)
|
||||
{
|
||||
return KINO_AQUA_SAMPLE_INPUT_TEXTURE(SC2UV(p)).rgb;
|
||||
}
|
||||
|
||||
float SampleLuminance(float2 p)
|
||||
{
|
||||
return Luminance(SampleColor(p));
|
||||
}
|
||||
|
||||
float3 SampleNoise(float2 p)
|
||||
{
|
||||
return KINO_AQUA_SAMPLE_NOISE_TEXTURE(p).rgb;
|
||||
}
|
||||
|
||||
// Gradient function
|
||||
|
||||
float2 GetGradient(float2 p, float freq)
|
||||
{
|
||||
const float2 dx = float2(interval / 200, 0);
|
||||
float ldx = SampleLuminance(p + dx.xy) - SampleLuminance(p - dx.xy);
|
||||
float ldy = SampleLuminance(p + dx.yx) - SampleLuminance(p - dx.yx);
|
||||
float2 n = SampleNoise(p * 0.4 * freq).gb - 0.5;
|
||||
return float2(ldx, ldy) + n * 0.05;
|
||||
}
|
||||
|
||||
// Edge / fill processing functions
|
||||
|
||||
float ProcessEdge(inout float2 p, float stride)
|
||||
{
|
||||
float2 grad = GetGradient(p, 1);
|
||||
float edge = saturate(length(grad) * 10);
|
||||
float pattern = SampleNoise(p * 0.8).r;
|
||||
p += normalize(Rotate90(grad)) * stride;
|
||||
return pattern * edge;
|
||||
}
|
||||
|
||||
float3 ProcessFill(inout float2 p, float stride)
|
||||
{
|
||||
float2 grad = GetGradient(p, blurFrequency);
|
||||
p += normalize(grad) * stride;
|
||||
float shift = SampleNoise(p * 0.1).r * 2;
|
||||
return SampleColor(p) * HsvToRgb(float3(shift, hueShift, 1));
|
||||
}
|
||||
|
||||
// Main filter function
|
||||
|
||||
float3 ProcessAt(float2 uv)
|
||||
{
|
||||
// Gradient oriented blur effect
|
||||
|
||||
float2 p = UV2SC(uv);
|
||||
|
||||
float2 p_e_n = p;
|
||||
float2 p_e_p = p;
|
||||
float2 p_c_n = p;
|
||||
float2 p_c_p = p;
|
||||
|
||||
const float Stride = 0.04 * iterationRcp;
|
||||
|
||||
float acc_e = 0;
|
||||
float3 acc_c = 0;
|
||||
float sum_e = 0;
|
||||
float sum_c = 0;
|
||||
|
||||
for (uint i = 0; i < iteration; i++)
|
||||
{
|
||||
float w_e = 1.5 - i * iterationRcp;
|
||||
acc_e += ProcessEdge(p_e_n, -Stride) * w_e;
|
||||
acc_e += ProcessEdge(p_e_p, +Stride) * w_e;
|
||||
sum_e += w_e * 2;
|
||||
|
||||
float w_c = 0.2 + i * iterationRcp;
|
||||
acc_c += ProcessFill(p_c_n, -Stride * blurWidth) * w_c;
|
||||
acc_c += ProcessFill(p_c_p, +Stride * blurWidth) * w_c * 0.3;
|
||||
sum_c += w_c * 1.3;
|
||||
}
|
||||
|
||||
// Normalization and contrast
|
||||
|
||||
acc_e /= sum_e;
|
||||
acc_c /= sum_c;
|
||||
|
||||
acc_e = saturate((acc_e - 0.5) * edgeContrast + 0.5);
|
||||
|
||||
// Color blending
|
||||
|
||||
float3 rgb_e = lerp(1, edgeColor.rgb, edgeColor.a * acc_e);
|
||||
float3 rgb_f = lerp(1, acc_c, fillColor.a) * fillColor.rgb;
|
||||
|
||||
return rgb_e * rgb_f;
|
||||
}
|
||||
};
|
||||
|
||||
float3 KinoAquaOverlay(float3 c1, float3 c2, float alpha)
|
||||
{
|
||||
float3 c;
|
||||
#if defined(KINO_AQUA_MULTIPLY)
|
||||
c = c1 * c2;
|
||||
#elif defined(KINO_AQUA_OVERLAY)
|
||||
float3 a = c1 * c2 * 2;
|
||||
float3 b = 1 - (1 - c1) * (1 - c2) * 2;
|
||||
c = lerp(a, b, c1 > 0.5);
|
||||
#elif defined(KINO_AQUA_SCREEN)
|
||||
c = 1 - (1 - c1) * (1 - c2);
|
||||
#else
|
||||
c = c1;
|
||||
#endif
|
||||
return lerp(c1, c, alpha);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe707fe0086e6459bbffb1e530531fad
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,110 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78b5e41a3a01c4aca9be171d2c3e33f5
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,120 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
namespace Artngame.LUMINA {
|
||||
public class RunTimeLuminaHDRP : MonoBehaviour
|
||||
{
|
||||
public LuminaHDRP Lumina;
|
||||
public Transform sun;
|
||||
|
||||
public Light pointLight;
|
||||
public GameObject Particles;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (GUI.Button(new Rect(10, 600, 82, 27), "Toggle GUI"))
|
||||
{
|
||||
if (enableGUI)
|
||||
{
|
||||
enableGUI = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
enableGUI = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (enableGUI)
|
||||
{
|
||||
if (GUI.Button(new Rect(10, 10, 100, 30), "Toggle GI"))
|
||||
{
|
||||
if (Lumina.disableGI)
|
||||
{
|
||||
Lumina.disableGI = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Lumina.disableGI = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(40, 90, 120, 30), "Toggle Particles"))
|
||||
{
|
||||
if (Particles.activeInHierarchy)
|
||||
{
|
||||
Particles.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Particles.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(60, 390, 150, 30), "Toggle Debug Voxels"))
|
||||
{
|
||||
if (Lumina.visualizeVoxels)
|
||||
{
|
||||
Lumina.visualizeVoxels = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Lumina.visualizeVoxels = true;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 sunRot = sun.eulerAngles;
|
||||
float sunRotX = sunRot.y;
|
||||
sunRotX = GUI.HorizontalSlider(new Rect(120, 10, 400, 30), sunRotX, -180, 180);
|
||||
//sun.eulerAngles = new Vector3(sunRot.x, sunRotX, sunRot.z);
|
||||
GUI.Label(new Rect(150, 30, 400, 30), "Rotate Sun Horizontally");
|
||||
|
||||
float sunRotY = sunRot.x;
|
||||
sunRotY = GUI.VerticalSlider(new Rect(10, 50, 30, 400), sunRotY, -19, 89);
|
||||
sun.eulerAngles = new Vector3(sunRotY, sunRotX, sunRot.z);
|
||||
|
||||
//point light
|
||||
GUI.Label(new Rect(50, 50, 400, 30), "Point Light Power");
|
||||
pointLight.intensity = GUI.HorizontalSlider(new Rect(50, 70, 400, 30), pointLight.intensity, 0, 85);
|
||||
|
||||
//Vector4 emissionColor = glowMaterialPaerticles.GetVector("_EmmissionColor");
|
||||
//self.material.SetVector("_EmmissionColor", ((Vector4)yourColor) * Mathf.Exp(2f, exposure));
|
||||
GUI.Label(new Rect(50, 120, 400, 30), "Particles Glow Power");
|
||||
glowIntensity = GUI.HorizontalSlider(new Rect(50, 150, 400, 30), glowIntensity, 0, 100);
|
||||
|
||||
glowMaterialPaerticles.SetVector("_EmissiveColor", glowColor * glowIntensity);//("_EmissionColor", glowColor * glowIntensity);
|
||||
|
||||
GUI.Label(new Rect(50, 170, 400, 30), "Global Illumination Power");
|
||||
GIIntensity = GUI.HorizontalSlider(new Rect(50, 200, 400, 30), GIIntensity, 0, 455);
|
||||
Lumina.secondaryBounceGain = GIIntensity;
|
||||
Lumina.nearLightGain = GIIntensity;
|
||||
Lumina.giGain = GIIntensity + 1;
|
||||
|
||||
GUI.Label(new Rect(50, 230, 400, 30), "Sun Power");
|
||||
sunLight.intensity = GUI.HorizontalSlider(new Rect(50, 260, 400, 30), sunLight.intensity, 0, 325);
|
||||
|
||||
GUI.Label(new Rect(50, 290, 400, 30), "Voxels Space Size");
|
||||
Lumina.voxelSpaceSize = GUI.HorizontalSlider(new Rect(50, 320, 400, 30), Lumina.voxelSpaceSize, 30, 500);
|
||||
}
|
||||
}
|
||||
|
||||
public Color glowColor = new Color(191f / 255f, 9f / 255f, 0);
|
||||
public float glowIntensity = 20;
|
||||
public float GIIntensity = 2;
|
||||
public Material glowMaterialPaerticles;
|
||||
public Light sunLight;
|
||||
public bool enableGUI = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15e2e1df0dd7a0b45bb3e6b8039421b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user