raymarching
This commit is contained in:
parent
4870d28e45
commit
0647870cdf
16 changed files with 1407 additions and 1 deletions
8
Assets/raymarched.meta
Normal file
8
Assets/raymarched.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aaa51ed3861cd0109bd0ed0b703efa2c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
80
Assets/raymarched/Raymarch_origin.mat
Normal file
80
Assets/raymarched/Raymarch_origin.mat
Normal file
|
@ -0,0 +1,80 @@
|
|||
%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: Raymarch_origin
|
||||
m_Shader: {fileID: 4800000, guid: 201705fcbc20f869eb5efb98f515535d, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _MaxDist: 100
|
||||
- _MaxSteps: 256
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SurfDist: 0.001
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
8
Assets/raymarched/Raymarch_origin.mat.meta
Normal file
8
Assets/raymarched/Raymarch_origin.mat.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 84c53e5d5a6cb7acfaefff643285aa1b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
80
Assets/raymarched/Raymarch_secondary.mat
Normal file
80
Assets/raymarched/Raymarch_secondary.mat
Normal file
|
@ -0,0 +1,80 @@
|
|||
%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: Raymarch_secondary
|
||||
m_Shader: {fileID: 4800000, guid: a0417c3af2dc9eeb08d9bc5c14ede4e0, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _MaxDist: 100
|
||||
- _MaxSteps: 256
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SurfDist: 0.001
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
8
Assets/raymarched/Raymarch_secondary.mat.meta
Normal file
8
Assets/raymarched/Raymarch_secondary.mat.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 42ff39292c8dca070a3e11f533bd9c53
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
749
Assets/raymarched/Raymarching.unity
Normal file
749
Assets/raymarched/Raymarching.unity
Normal file
|
@ -0,0 +1,749 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.17883426, g: 0.22392553, b: 0.30580956, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 1
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &845829380
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 845829382}
|
||||
- component: {fileID: 845829381}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &845829381
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 845829380}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &845829382
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 845829380}
|
||||
m_LocalRotation: {x: 0.85522455, y: -0.12030997, z: 0.22915669, w: 0.44900298}
|
||||
m_LocalPosition: {x: 0.16, y: 3, z: 0.09}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 124.6, y: -30, z: 0}
|
||||
--- !u!1 &1450495540
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1450495545}
|
||||
- component: {fileID: 1450495547}
|
||||
- component: {fileID: 1450495548}
|
||||
- component: {fileID: 1450495546}
|
||||
- component: {fileID: 1450495544}
|
||||
- component: {fileID: 1450495543}
|
||||
- component: {fileID: 1450495542}
|
||||
- component: {fileID: 1450495541}
|
||||
m_Layer: 31
|
||||
m_Name: Raymarch_secondary
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1450495541
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
type: 3
|
||||
objectId: 1dc813d7-f29d-4afc-b082-a37f699f48fb
|
||||
--- !u!114 &1450495542
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a37fd8d654d5c2840a0ab3a5ad65a5ae, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
spawnHeight: 0
|
||||
useAdditionalValues: 0
|
||||
syncValues: []
|
||||
propPrivacy: 1
|
||||
subSyncs: []
|
||||
spawnableType: 0
|
||||
preGeneratedInstanceId:
|
||||
--- !u!114 &1450495543
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 12974925555b471580cacf5d2d5fa9e3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
gripType: 1
|
||||
gripOrigin: {fileID: 0}
|
||||
disallowTheft: 0
|
||||
maximumGrabDistance: 0
|
||||
snappingReferences: []
|
||||
autoHold: 0
|
||||
ikReference: {fileID: 0}
|
||||
--- !u!108 &1450495544
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 2
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 0
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 2147483648
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 0
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1450495545
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.769, y: -0.886, z: -0.762}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!135 &1450495546
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.2
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &1450495547
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1450495548
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1450495540}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 42ff39292c8dca070a3e11f533bd9c53, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!1 &1485771011
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1485771015}
|
||||
- component: {fileID: 1485771014}
|
||||
- component: {fileID: 1485771013}
|
||||
- component: {fileID: 1485771012}
|
||||
m_Layer: 0
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!65 &1485771012
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1485771011}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &1485771013
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1485771011}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &1485771014
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1485771011}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &1485771015
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1485771011}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -0.695, y: -0.723, z: -0.01}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1500710831
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1500710834}
|
||||
- component: {fileID: 1500710833}
|
||||
- component: {fileID: 1500710832}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1500710832
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1500710831}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1500710833
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1500710831}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &1500710834
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1500710831}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1651833084
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1651833091}
|
||||
- component: {fileID: 1651833090}
|
||||
- component: {fileID: 1651833089}
|
||||
- component: {fileID: 1651833088}
|
||||
- component: {fileID: 1651833087}
|
||||
- component: {fileID: 1651833086}
|
||||
- component: {fileID: 1651833085}
|
||||
m_Layer: 31
|
||||
m_Name: Raymarch_base
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1651833085
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651833084}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 12974925555b471580cacf5d2d5fa9e3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
gripType: 1
|
||||
gripOrigin: {fileID: 0}
|
||||
disallowTheft: 0
|
||||
maximumGrabDistance: 0
|
||||
snappingReferences: []
|
||||
autoHold: 0
|
||||
ikReference: {fileID: 0}
|
||||
--- !u!114 &1651833086
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651833084}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
type: 3
|
||||
objectId: e0ad42bf-6854-4fd0-ab9b-b81c76130077
|
||||
--- !u!114 &1651833087
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651833084}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a37fd8d654d5c2840a0ab3a5ad65a5ae, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
spawnHeight: 0
|
||||
useAdditionalValues: 0
|
||||
syncValues: []
|
||||
propPrivacy: 1
|
||||
subSyncs: []
|
||||
spawnableType: 0
|
||||
preGeneratedInstanceId:
|
||||
--- !u!135 &1651833088
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651833084}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.2
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &1651833089
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651833084}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 84c53e5d5a6cb7acfaefff643285aa1b, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!33 &1651833090
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651833084}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &1651833091
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1651833084}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.757, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
7
Assets/raymarched/Raymarching.unity.meta
Normal file
7
Assets/raymarched/Raymarching.unity.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 948d5c6a5610433b3b6ca16805b8ca13
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
192
Assets/raymarched/raymarch_origin copy.shader
Normal file
192
Assets/raymarched/raymarch_origin copy.shader
Normal file
|
@ -0,0 +1,192 @@
|
|||
Shader "CrispyPin/Raymarch1"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Raymarcher Properties)]
|
||||
_MaxSteps ("Max steps", Int) = 256
|
||||
_MaxDist ("Max distance", Float) = 100
|
||||
_SurfDist ("Surface distance threshold", Range(0.00001, 0.05)) = 0.001
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Cull Off
|
||||
LOD 100
|
||||
|
||||
/* Pass{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 ro : TEXCOORD1;
|
||||
float3 hitPos : TEXCOORD2;
|
||||
};
|
||||
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
//object space
|
||||
o.ro = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1));
|
||||
o.hitPos = v.vertex;
|
||||
//world space
|
||||
//o.ro = _WorldSpaceCameraPos;
|
||||
//o.hitPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
discard;
|
||||
return fixed4(0,0,0,0);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
} */
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "AddPass"
|
||||
Tags { "LightMode" = "ForwardAdd"}
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 ro : TEXCOORD1;
|
||||
float3 hitPos : TEXCOORD2;
|
||||
};
|
||||
|
||||
int _MaxSteps;
|
||||
float _MaxDist;
|
||||
float _SurfDist;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
//object space
|
||||
o.ro = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1));
|
||||
o.hitPos = v.vertex;
|
||||
//world space
|
||||
//o.ro = _WorldSpaceCameraPos;
|
||||
//o.hitPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float smoothMin(float a, float b, float k)
|
||||
{
|
||||
return min(a, b) - pow(max(k - abs(a-b), 0), 3)/(6*k*k);
|
||||
}
|
||||
|
||||
float sdSphere(float3 p, float3 o, float r) {
|
||||
return length(p - o) - r;
|
||||
}
|
||||
|
||||
float sdBox(float3 p, float3 dim)
|
||||
{
|
||||
return length(float3(
|
||||
max(abs(p.x) - dim.x/2.0, 0),
|
||||
max(abs(p.y) - dim.y/2.0, 0),
|
||||
max(abs(p.z) - dim.z/2.0, 0)));
|
||||
}
|
||||
|
||||
float3 repDomain(float3 p, float3 r)
|
||||
{
|
||||
return fmod(abs(p + r/2.0), r) - r/2.0;
|
||||
}
|
||||
|
||||
|
||||
float GetDist(float3 p)
|
||||
{
|
||||
/* float d = 0;
|
||||
|
||||
float s = sin(100*_Time + p.x*10) * 0.02 + 0.028;
|
||||
float s2 = cos(105*_Time + p.x*10) * 0.02 + 0.028;
|
||||
//s += sin(p.x/10)*0.03;
|
||||
|
||||
float3 rep = repDomain(p, float3(0.026, 0.15, 0.2));// fmod(abs(p + 0.05), 0.1)-0.05;
|
||||
d = sdBox(rep, float3(0.02, s2, s)) - 0.004;
|
||||
d = smoothMin(d, sdBox(rep, float3(0.01, s*1.0, s2*1.5)) - 0.004, 0.01);
|
||||
*/
|
||||
float d = sdSphere(p, 0, 0.1f);
|
||||
// float3 second = ObjSpaceLightDir(0);
|
||||
// float3 second = _WorldSpaceLightPos0;
|
||||
float3 second = mul(unity_WorldToObject, _WorldSpaceLightPos0);
|
||||
d = smoothMin(d, sdBox(p-second, 0.3f), 0.2);
|
||||
//d = smoothMin(d, sdSphere(p, float3(0,0,0), 5), .3);
|
||||
return d;
|
||||
}
|
||||
|
||||
//marches a ray through the scene
|
||||
float Raymarch(float3 ro, float3 rd)
|
||||
{
|
||||
float rayLen = 0;// total distance marched / distance from origin
|
||||
float dist; // distance from the raymarched scene
|
||||
for ( int i = 0; i < _MaxSteps; i++)
|
||||
{
|
||||
//position = origin + distance * direction
|
||||
float3 p = ro + rayLen * rd;
|
||||
dist = GetDist(p);
|
||||
rayLen += dist;// move forward
|
||||
if (dist < _SurfDist || rayLen > _MaxDist) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rayLen;
|
||||
}
|
||||
|
||||
float3 GetNormal(float3 p)
|
||||
{
|
||||
float2 e = float2(0.001, 0);
|
||||
float3 n = GetDist(p) - float3(
|
||||
GetDist(p-e.xyy),
|
||||
GetDist(p-e.yxy),
|
||||
GetDist(p-e.yyx));
|
||||
return normalize(n);
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float3 ro = i.ro;
|
||||
float3 rd = normalize(i.hitPos - ro);
|
||||
|
||||
float d = Raymarch(ro, rd);
|
||||
fixed4 col = 1;
|
||||
|
||||
if (d >= _MaxDist)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
float3 p = ro + rd * d;
|
||||
float3 n = GetNormal(p);
|
||||
|
||||
col.rgb = dot(n, normalize(float3(1,0.5,1)));
|
||||
col *= float4(d, 1, 1, 1);
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
9
Assets/raymarched/raymarch_origin copy.shader.meta
Normal file
9
Assets/raymarched/raymarch_origin copy.shader.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f9118b166a8a02f3a8984624e2611e6c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
34
Assets/raymarched/raymarch_origin.shader
Normal file
34
Assets/raymarched/raymarch_origin.shader
Normal file
|
@ -0,0 +1,34 @@
|
|||
Shader "CrispyPin/Raymarch1"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Raymarcher Properties)]
|
||||
_MaxSteps ("Max steps", Int) = 256
|
||||
_MaxDist ("Max distance", Float) = 100
|
||||
_SurfDist ("Surface distance threshold", Range(0.00001, 0.05)) = 0.001
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Cull Off
|
||||
LOD 100
|
||||
Pass
|
||||
{
|
||||
Tags { "LightMode" = "ForwardAdd"}
|
||||
CGPROGRAM
|
||||
#pragma vertex vertex
|
||||
#pragma fragment fragment
|
||||
|
||||
#include "raymarcher.cginc"
|
||||
|
||||
v2f vertex (appdata v){
|
||||
return vert(v);
|
||||
}
|
||||
|
||||
fragOut fragment (v2f i) {
|
||||
return frag(i);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
9
Assets/raymarched/raymarch_origin.shader.meta
Normal file
9
Assets/raymarched/raymarch_origin.shader.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 201705fcbc20f869eb5efb98f515535d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
34
Assets/raymarched/raymarch_secondary.shader
Normal file
34
Assets/raymarched/raymarch_secondary.shader
Normal file
|
@ -0,0 +1,34 @@
|
|||
Shader "CrispyPin/Raymarch2"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Raymarcher Properties)]
|
||||
_MaxSteps ("Max steps", Int) = 256
|
||||
_MaxDist ("Max distance", Float) = 100
|
||||
_SurfDist ("Surface distance threshold", Range(0.00001, 0.05)) = 0.001
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
Cull Off
|
||||
LOD 100
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vertex
|
||||
#pragma fragment fragment
|
||||
|
||||
#define IS_SECONDARY_SHAPE
|
||||
#include "raymarcher.cginc"
|
||||
|
||||
v2f vertex (appdata v){
|
||||
return vert(v);
|
||||
}
|
||||
|
||||
fragOut fragment (v2f i) {
|
||||
return frag(i);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
9
Assets/raymarched/raymarch_secondary.shader.meta
Normal file
9
Assets/raymarched/raymarch_secondary.shader.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a0417c3af2dc9eeb08d9bc5c14ede4e0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
170
Assets/raymarched/raymarcher.cginc
Normal file
170
Assets/raymarched/raymarcher.cginc
Normal file
|
@ -0,0 +1,170 @@
|
|||
#ifndef RAY_MARCH_LIB_INCLUDED
|
||||
#define RAY_MARCH_LIB_INCLUDED
|
||||
/*
|
||||
define IS_SECONDARY_SHAPE to only render the second shape
|
||||
*/
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 ro : TEXCOORD1;
|
||||
float3 hitPos : TEXCOORD2;
|
||||
};
|
||||
|
||||
struct fragOut
|
||||
{
|
||||
fixed4 col : SV_Target;
|
||||
float depth : SV_Depth;
|
||||
};
|
||||
|
||||
int _MaxSteps;
|
||||
float _MaxDist;
|
||||
float _SurfDist;
|
||||
|
||||
v2f vert (appdata v) {
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
//object space
|
||||
o.ro = mul(unity_WorldToObject, float4(_WorldSpaceCameraPos, 1));
|
||||
o.hitPos = v.vertex;
|
||||
//world space
|
||||
//o.ro = _WorldSpaceCameraPos;
|
||||
//o.hitPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
float smin(float a, float b, float k) {
|
||||
return min(a, b) - pow(max(k - abs(a-b), 0), 3)/(6*k*k);
|
||||
}
|
||||
|
||||
float sdSphere(float3 p, float3 o, float r) {
|
||||
return length(p - o) - r;
|
||||
}
|
||||
|
||||
float sdBox(float3 p, float3 dim) {
|
||||
return length(float3(
|
||||
max(abs(p.x) - dim.x/2.0, 0),
|
||||
max(abs(p.y) - dim.y/2.0, 0),
|
||||
max(abs(p.z) - dim.z/2.0, 0)));
|
||||
}
|
||||
|
||||
float sdLine(float3 p, float3 a, float3 b, float r) {
|
||||
float3 pa = p - a;
|
||||
float3 ba = b - a;
|
||||
float h = clamp(dot(pa, ba) / dot(ba, ba), 0, 1);
|
||||
return length(pa - ba * h) - r;
|
||||
}
|
||||
|
||||
float sdCappedTorus( float3 p, float2 sc, float ra, float rb) {
|
||||
p.x = abs(p.x);
|
||||
float k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy);
|
||||
return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;
|
||||
}
|
||||
|
||||
float3 RotateY(float3 p, float a) {
|
||||
return mul(float3x3(cos(a), 0, sin(a), 0, 1, 0, -sin(a), 0, cos(a)), p);
|
||||
}
|
||||
|
||||
float Kijetesantakalu(float3 p, float r) {
|
||||
float d = sdSphere(p, float3(0, 0, 0.2f), r);// left eye
|
||||
d = min(d, sdSphere(p, float3(0.15f, 0, 0.2f), r)); // right eye
|
||||
d = min(d, sdLine(p, float3(0, 0, -0.4f), float3(-0.35f, 0, -0.4f), r)); // bottom line
|
||||
d = smin(d, sdLine(p, float3(0, 0, -0.4f), float3(-0.1f, 0, -0.15f), r), 0.003f); // leg hook
|
||||
d = min(d, sdLine(p, float3(0.15f, 0, -0.4f), float3(0.15f, 0, -0.1f), r)); // middle leg
|
||||
d = min(d, sdLine(p, float3(0.3f, 0, -0.4f), float3(0.3f, 0, 0), r)); // front leg
|
||||
d = smin(d, sdLine(p, float3(0.45f, 0, 0.1f), float3(0.3f, 0, 0), r), 0.003f); // lower snout
|
||||
d = smin(d, sdLine(p, float3(0.45f, 0, 0.1f), float3(0.2f, 0, 0.35f), r), 0.003f); // upper snout
|
||||
d = smin(d, sdLine(p, float3(0.2f, 0, 0.45f), float3(0.2f, 0, 0.35f), r), 0.003f); // ear
|
||||
float an = 0.9;
|
||||
d = smin(d, sdCappedTorus((RotateY(p, 0.8f) - float3(0.15f, 0, -0.05f)).xzy, float2(sin(an),cos(an)), 0.4, r), 0.003f); // ear
|
||||
d = smin(d, sdLine(p, float3(-0.25f, 0, 0), float3(-0.25f, 0, -0.4f), r), 0.003f); // back
|
||||
d = smin(d, sdLine(p, float3(-0.25f, 0, -0.1f), float3(-0.35f, 0, -0.1f), r), 0.003f); // tail top
|
||||
d = smin(d, sdLine(p, float3(-0.35f, 0, -0.1f), float3(-0.35f, 0, -0.4f), r), 0.003f); // stripe
|
||||
an = 3.1415f*0.5;
|
||||
d = smin(d, sdCappedTorus((RotateY(p, an) - float3(-0.25f, 0, 0.35f)).xzy, float2(sin(an),cos(an)), 0.15f, r), 0.003f); // tail
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
float FirstShape(float3 p) {
|
||||
return Kijetesantakalu(p, 0.05f);
|
||||
}
|
||||
|
||||
float SecondShape(float3 p) {
|
||||
// return sdBox(p, 0.3f) - 0.01f;
|
||||
// return Kijetesantakalu(p, 0.04f) - 0.01f;
|
||||
return sdSphere(p, 0, 0.3f);
|
||||
}
|
||||
|
||||
|
||||
float GetDist(float3 p) {
|
||||
#ifdef IS_SECONDARY_SHAPE
|
||||
return SecondShape(p);
|
||||
#else
|
||||
float first = FirstShape(p);
|
||||
float3 second_pos = mul(unity_WorldToObject, _WorldSpaceLightPos0);
|
||||
float second = SecondShape(p - second_pos);
|
||||
return smin(first, second, 0.15f);
|
||||
#endif
|
||||
}
|
||||
|
||||
//marches a ray through the scene
|
||||
float Raymarch(float3 ro, float3 rd) {
|
||||
float rayLen = 0;// total distance marched / distance from origin
|
||||
float dist; // distance from the raymarched scene
|
||||
for ( int i = 0; i < _MaxSteps; i++)
|
||||
{
|
||||
//position = origin + distance * direction
|
||||
float3 p = ro + rayLen * rd;
|
||||
dist = GetDist(p);
|
||||
rayLen += dist;// move forward
|
||||
if (dist < _SurfDist || rayLen > _MaxDist) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rayLen;
|
||||
}
|
||||
|
||||
float3 GetNormal(float3 p) {
|
||||
float2 e = float2(0.001, 0);
|
||||
float3 n = GetDist(p) - float3(
|
||||
GetDist(p-e.xyy),
|
||||
GetDist(p-e.yxy),
|
||||
GetDist(p-e.yyx));
|
||||
return normalize(n);
|
||||
}
|
||||
|
||||
fragOut frag (v2f i) {
|
||||
float3 ro = i.ro;
|
||||
float3 rd = normalize(i.hitPos - ro);
|
||||
|
||||
float d = Raymarch(ro, rd);
|
||||
fixed4 col = 1;
|
||||
|
||||
if (d >= _MaxDist)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
float3 p = ro + rd * d;
|
||||
float3 n = GetNormal(p);
|
||||
|
||||
// col.rgb = max(dot(n, normalize(float3(1,0.5,1))), 0.05f);
|
||||
col.r = dot(-rd, n);
|
||||
|
||||
// col *= float4(d, 1, 1, 1);
|
||||
fragOut o;
|
||||
o.col = col;
|
||||
float4 vClipPos = mul(UNITY_MATRIX_VP, mul(unity_ObjectToWorld, float4(p, 1)));
|
||||
o.depth = (vClipPos.z / vClipPos.w + 1.0) * 0.5;
|
||||
return o;
|
||||
}
|
||||
|
||||
#endif
|
9
Assets/raymarched/raymarcher.cginc.meta
Normal file
9
Assets/raymarched/raymarcher.cginc.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5ee593b026d03ab61b5bbf93bce72808
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -36,7 +36,7 @@ TagManager:
|
|||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- raymarching
|
||||
m_SortingLayers:
|
||||
- name: Default
|
||||
uniqueID: 0
|
||||
|
|
Loading…
Reference in a new issue