released on steam, adding genedrive

This commit is contained in:
ntr committed 2022-06-03 15:04:50 +10:00
1 parent d36158bc48
commit 373baed62b
42 files changed
+5905 -318

No files matched your search

@@ -0,0 +1,233 @@
Shader "FullScreen/GeneDrive"
{
Properties
{
_SpectrumTexture("SpectrumTexture", 2D) = "white" {}
_ThemeTexture("ThemeTexture", 2D) = "white" {}
_SpectrumSize("SpectrumSize", float) = 16
_SphereSize("SphereSize", range(0, 3)) = 1
_SphereStretch("SphereStretch", range(0, 3)) = 1
}
HLSLINCLUDE
// HDRP stuff
#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"
// here we go...
sampler2D _SpectrumTexture;
sampler2D _ThemeTexture;
float _SphereSize;
float _SphereStretch;
float material;
float time;
float rng;
float sub;
float bass;
float mids;
float highs;
// -------------------------------------
// https://www.shadertoy.com/view/NddSWs
// source
// Dave Hoskins
// https://www.shadertoy.com/view/4djSRW
float hash13(float3 p3) {
p3 = frac(p3 * .420);
p3 += dot(p3, p3.zyx + 322.802872);
return frac((p3.x + p3.y) * p3.z);
}
// Inigo Quilez
// https://iquilezles.org/articles/distfunctions
float smin(float d1, float d2, float k) {
float h = clamp(0.5 + 0.5 * (d2-d1) / k, 0.0, 1.0);
return lerp(d2, d1, h) - k*h*(1.0-h);
}
float smoothing(float d1, float d2, float k) { return clamp( 0.5 + 0.5 *(d2-d1)/k, 0.0, 1.0); }
// rotation matrix
float2x2 rot(float a) {
float2x2 rm = { cos(a), -sin(a), sin(a), cos(a) };
return rm;
}
#define mod(x, y) (x - y * floor(x / y))
float3 repeat(float3 p, float3 r) {
return mod(p , r) - r / 2.0;
}
// sdf
float map (float3 p) {
const float Grid = 8.0;
const int Iterations = 4;
// time stretched with noise
float t = time * 1.0 + rng * 0.9;
// float t = highs;
// domain repetition
float3 grid = float3(Grid, Grid, Grid);
float3 cell = floor(p/grid);
p = repeat(p, grid);
// distance from origin
float dp = length(p);
// rotation parameter
float3 angle = float3(1.1,-.5,.1) + dp*.1 + p*.1 + cell;
// shrink sphere size
float size = sin(_SphereSize * rng); //sin(rng*3.14);
// stretch sphere
// float wave = sin(-dp*1.+t+hash13(cell)*6.28)*.5;
float wave = sin(-dp*_SphereStretch+hash13(cell) * Grid) * _SphereStretch;
// float a = 1.0;
// float a = smoothstep(0.0, 1.0, mids) * 0.5;
float freq = length(cell) % 4;
float a = tex2D(_SpectrumTexture, 1 / freq);
// a = 1.0 / freq;
// float a = highs;
float scene = 1000.0;
float shape = 1000.0;
for (int index = 0; index < Iterations; ++index) {
// fold and translate
p.xz = abs(p.xz) - (0.5 + wave) * a;
// p.xz = abs(p.xz) - (0.5 + wave) * a;
// rotate
// p.xz = mul(rot(angle.y/a), p.xz);
// p.yz = mul(rot(angle.x/a), p.yz);
// p.yx = mul(rot(angle.z/a), p.yx);
p.xz = mul(p.xz, rot(angle.y/a));
p.yz = mul(p.yz, rot(angle.x/a));
p.yx = mul(p.yx, rot(angle.z/a));
// sphere
shape = length(p)+a*size * 2.0;
// material blending
// material = lerp(material, float(index), smoothing(shape, scene, 0.3*a));
material = lerp(material, float(index), smoothing(shape, scene, a));
// add with a blend
// scene = smin(scene, shape, 1.0 * a);
scene = smin(scene, shape, _SphereSize * a);
// falloff transformations
a /= 1.9;
}
return scene;
}
float4 FullScreenPass(Varyings varyings) : SV_Target {
float depth = LoadCameraDepth(varyings.positionCS.xy);
PositionInputs posInput = GetPositionInput(varyings.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
float2 ndc = posInput.positionNDC;
// convert to glsl mode and fix aspect ratio
float2 guv = posInput.positionNDC - 0.5;
guv.x *= _ScreenParams.x / _ScreenParams.y;
time = _Time.y;
float4 colour = float4(0.0, 0.0, 0.0, 1.0);
material = 0.0;
// camera coordinates
float2 uv = guv;
float3 eye = float3(sin(time * 0.1) * 5.0, cos(time * 0.1) * 5.0, 1.0);
// float3 eye = float3(5.0, 5.0, 1.0);
float3 at = float3(0.0, 0.0, 0.0);
float3 z = normalize(at-eye);
float3 x = normalize(cross(z, float3(0.0,1.0,0.0)));
float3 y = cross(x, z);
float3 ray = normalize(float3(z + uv.x * x + uv.y * y));
float3 pos = eye;
// // camera control
// float2 M = 6.28 * float2(1.0, 1.0);
// ray.xz = mul(ray.xz, rot(M.x));
// pos.xz = mul(pos.xz, rot(M.x));
// ray.xy = mul(ray.xy, rot(M.y));
// pos.xy = mul(pos.xy, rot(M.y));
// white noise
float3 seed = float3(ndc, highs * 420.0);
float rng = hash13(seed);
// raymarch
float steps = 30.0;
float index;
for (index = steps; index > 0.0; --index) {
// volume estimation
float dist = map(pos);
if (dist < 0.01) {
break;
}
// dithering
// dist *= 0.9 + .1 * rng;
// raymarch
pos += ray * dist;
}
// ambient occlusion from steps count
float shade = index / steps;
// compute normal by NuSan (https://www.shadertoy.com/view/3sBGzV)
float2 off=float2(.001,0);
float3 normal = normalize(map(pos)-float3(map(pos-off.xyy), map(pos-off.yxy), map(pos-off.yyx)));
float3 tint = tex2D(_ThemeTexture, shade);
// lighting
float ld = dot(reflect(ray, normal), float3(0.0,1.0,0.0))*0.5+0.5;
float3 light = float3(1.000,0.502,0.502) * sqrt(ld);
ld = dot(reflect(ray, normal), float3(0,0,-1))*0.5+0.5;
light += float3(0.400,0.714,0.145) * sqrt(ld)*.5;
// pixel color
colour.rgb = (tint + light) * shade;
return colour;
}
ENDHLSL
SubShader
{
Tags{ "RenderPipeline" = "HDRenderPipeline" }
Pass
{
Name "GeneDrive"
ZWrite Off
ZTest Always
// Blend SrcAlpha OneMinusSrcAlpha
Cull Off
HLSLPROGRAM
#pragma fragment FullScreenPass
ENDHLSL
}
}
Fallback Off
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: fcc3e90329b99064cb3a53eb297ca9ae
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
+287
View File
@@ -0,0 +1,287 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GeneDrive
m_Shader: {fileID: 4800000, guid: 7453d819d5b715d498f76dd3ab8d71aa, type: 3}
m_ShaderKeywords: _DISABLE_SSR_TRANSPARENT _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
- RayTracingPrepass
- MOTIONVECTORS
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}
- _SpectrumTexture:
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}
- _ThemeTexture:
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}
- _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
- _AlphaSrcBlend: 1
- _AlphaToMask: 0
- _AlphaToMaskInspectorValue: 0
- _Anisotropy: 0
- _BlendMode: 0
- _Brightness: 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
- _EmissiveColorMode: 1
- _EmissiveExposureWeight: 1
- _EmissiveIntensity: 1
- _EmissiveIntensityUnit: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _EnableGeometricSpecularAA: 0
- _EnergyConservingSpecularColor: 1
- _Glob: 1.2242857
- _Globular: 1
- _Grid: 8
- _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
- _Iterations: 1
- _LinkDetailsWithBase: 1
- _Magic: 65.6
- _MaterialID: 1
- _Metallic: 0
- _MetallicRemapMax: 1
- _MetallicRemapMin: 0
- _NormalMapSpace: 0
- _NormalScale: 1
- _OpaqueCullMode: 2
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PPDPrimitiveLength: 1
- _PPDPrimitiveWidth: 1
- _RayTracing: 0
- _ReceivesSSR: 1
- _ReceivesSSRTransparent: 0
- _RefractionModel: 0
- _Resonance: 0.67142856
- _Smoothness: 0.5
- _SmoothnessRemapMax: 1
- _SmoothnessRemapMin: 0
- _SpectrumSize: 4
- _SpecularAAScreenSpaceVariance: 0.1
- _SpecularAAThreshold: 0.2
- _SpecularOcclusionMode: 1
- _SphereSize: 0.94285715
- _SphereStretch: 0.5928571
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 8
- _StencilRefGBuffer: 10
- _StencilRefMV: 40
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SubsurfaceMask: 1
- _SupportDecals: 1
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScaleEmissive: 1
- _ThemeStrength: 4.67
- _Thickness: 1
- _TransmissionEnable: 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
- _Wildness: 0.2
- _Wow: 4
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 1
- _Zing: 0
- _Zip: 0.5
- _Zoom: 4.99
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: []
--- !u!114 &6020743418383276577
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: 12
hdPluginSubTargetMaterialVersions:
m_Keys: []
m_Values:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 87966b5ef0f98a1449384bd255e71cd9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,233 @@
Shader "FullScreen/GeneDrive"
{
Properties
{
_SpectrumTexture("SpectrumTexture", 2D) = "white" {}
_ThemeTexture("ThemeTexture", 2D) = "white" {}
_SpectrumSize("SpectrumSize", float) = 16
_SphereSize("SphereSize", range(0, 3)) = 1
_SphereStretch("SphereStretch", range(0, 3)) = 1
}
HLSLINCLUDE
// HDRP stuff
#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"
// here we go...
sampler2D _SpectrumTexture;
sampler2D _ThemeTexture;
float _SphereSize;
float _SphereStretch;
float material;
float time;
float rng;
float sub;
float bass;
float mids;
float highs;
// -------------------------------------
// https://www.shadertoy.com/view/NddSWs
// source
// Dave Hoskins
// https://www.shadertoy.com/view/4djSRW
float hash13(float3 p3) {
p3 = frac(p3 * .420);
p3 += dot(p3, p3.zyx + 322.802872);
return frac((p3.x + p3.y) * p3.z);
}
// Inigo Quilez
// https://iquilezles.org/articles/distfunctions
float smin(float d1, float d2, float k) {
float h = clamp(0.5 + 0.5 * (d2-d1) / k, 0.0, 1.0);
return lerp(d2, d1, h) - k*h*(1.0-h);
}
float smoothing(float d1, float d2, float k) { return clamp( 0.5 + 0.5 *(d2-d1)/k, 0.0, 1.0); }
// rotation matrix
float2x2 rot(float a) {
float2x2 rm = { cos(a), -sin(a), sin(a), cos(a) };
return rm;
}
#define mod(x, y) (x - y * floor(x / y))
float3 repeat(float3 p, float3 r) {
return mod(p , r) - r / 2.0;
}
// sdf
float map (float3 p) {
const float Grid = 8.0;
const int Iterations = 4;
// time stretched with noise
float t = time * 1.0 + rng * 0.9;
// float t = highs;
// domain repetition
float3 grid = float3(Grid, Grid, Grid);
float3 cell = floor(p/grid);
p = repeat(p, grid);
// distance from origin
float dp = length(p);
// rotation parameter
float3 angle = float3(1.1,-.5,.1) + dp*.1 + p*.1 + cell;
// shrink sphere size
float size = sin(_SphereSize * rng); //sin(rng*3.14);
// stretch sphere
// float wave = sin(-dp*1.+t+hash13(cell)*6.28)*.5;
float wave = sin(-dp*_SphereStretch+hash13(cell) * Grid) * _SphereStretch;
// float a = 1.0;
// float a = smoothstep(0.0, 1.0, mids) * 0.5;
float freq = length(cell) % 4;
float a = tex2D(_SpectrumTexture, 1 / freq);
// a = 1.0 / freq;
// float a = highs;
float scene = 1000.0;
float shape = 1000.0;
for (int index = 0; index < Iterations; ++index) {
// fold and translate
p.xz = abs(p.xz) - (0.5 + wave) * a;
// p.xz = abs(p.xz) - (0.5 + wave) * a;
// rotate
// p.xz = mul(rot(angle.y/a), p.xz);
// p.yz = mul(rot(angle.x/a), p.yz);
// p.yx = mul(rot(angle.z/a), p.yx);
p.xz = mul(p.xz, rot(angle.y/a));
p.yz = mul(p.yz, rot(angle.x/a));
p.yx = mul(p.yx, rot(angle.z/a));
// sphere
shape = length(p)+a*size * 2.0;
// material blending
// material = lerp(material, float(index), smoothing(shape, scene, 0.3*a));
material = lerp(material, float(index), smoothing(shape, scene, a));
// add with a blend
// scene = smin(scene, shape, 1.0 * a);
scene = smin(scene, shape, _SphereSize * a * 3.0);
// falloff transformations
a /= 1.9;
}
return scene;
}
float4 FullScreenPass(Varyings varyings) : SV_Target {
float depth = LoadCameraDepth(varyings.positionCS.xy);
PositionInputs posInput = GetPositionInput(varyings.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);
float2 ndc = posInput.positionNDC;
// convert to glsl mode and fix aspect ratio
float2 guv = posInput.positionNDC - 0.5;
guv.x *= _ScreenParams.x / _ScreenParams.y;
time = _Time.y;
float4 colour = float4(0.0, 0.0, 0.0, 1.0);
material = 0.0;
// camera coordinates
float2 uv = guv;
float3 eye = float3(sin(time * 0.1) * 5.0, cos(time * 0.1) * 5.0 + 0.5, 1.0);
// float3 eye = float3(5.0, 5.0, 1.0);
float3 at = float3(0.0, 0.0, 0.0);
float3 z = normalize(at-eye);
float3 x = normalize(cross(z, float3(0.0,1.0,0.0)));
float3 y = cross(x, z);
float3 ray = normalize(float3(z + uv.x * x + uv.y * y));
float3 pos = eye;
// // camera control
// float2 M = 6.28 * float2(1.0, 1.0);
// ray.xz = mul(ray.xz, rot(M.x));
// pos.xz = mul(pos.xz, rot(M.x));
// ray.xy = mul(ray.xy, rot(M.y));
// pos.xy = mul(pos.xy, rot(M.y));
// white noise
float3 seed = float3(ndc, highs * 420.0);
float rng = hash13(seed);
// raymarch
float steps = 30.0;
float index;
for (index = steps; index > 0.0; --index) {
// volume estimation
float dist = map(pos);
if (dist < 0.01) {
break;
}
// dithering
// dist *= 0.9 + .1 * rng;
// raymarch
pos += ray * dist;
}
// ambient occlusion from steps count
float shade = index / steps;
// compute normal by NuSan (https://www.shadertoy.com/view/3sBGzV)
float2 off=float2(.001,0);
float3 normal = normalize(map(pos)-float3(map(pos-off.xyy), map(pos-off.yxy), map(pos-off.yyx)));
float3 tint = tex2D(_ThemeTexture, shade);
// lighting
float ld = dot(reflect(ray, normal), float3(0.0,1.0,0.0))*0.5+0.5;
float3 light = float3(1.000,0.502,0.502) * sqrt(ld);
ld = dot(reflect(ray, normal), float3(0,0,-1))*0.5+0.5;
light += float3(0.400,0.714,0.145) * sqrt(ld)*.5;
// pixel color
colour.rgb = (tint + light) * shade;
return colour;
}
ENDHLSL
SubShader
{
Tags{ "RenderPipeline" = "HDRenderPipeline" }
Pass
{
Name "GeneDrive"
ZWrite Off
ZTest Always
// Blend SrcAlpha OneMinusSrcAlpha
Cull Off
HLSLPROGRAM
#pragma fragment FullScreenPass
ENDHLSL
}
}
Fallback Off
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7453d819d5b715d498f76dd3ab8d71aa
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,22 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
public class GeneDriveBinder : MonoBehaviour {
public Material material;
private void Start() {
if (material == null) {
Debug.Log("Material Binder needs a Material.");
gameObject.SetActive(false);
}
}
public void UpdateGrid(Slider s) {
material.SetFloat("_SphereStretch", s.value);
}
public void UpdateResonance(Slider s) {
material.SetFloat("_SphereSize", s.value);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bad5d6c23674a9c4b8605efe4fdf08dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: