gol: use half precision floats
This commit is contained in:
parent
a80b256a05
commit
ee42d06ec7
4 changed files with 230 additions and 11 deletions
|
@ -598,3 +598,226 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &1928596179
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1928596186}
|
||||||
|
- component: {fileID: 1928596185}
|
||||||
|
- component: {fileID: 1928596184}
|
||||||
|
- component: {fileID: 1928596183}
|
||||||
|
- component: {fileID: 1928596182}
|
||||||
|
- component: {fileID: 1928596181}
|
||||||
|
- component: {fileID: 1928596180}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Lenia_Canvas
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &1928596180
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1928596179}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
type: 3
|
||||||
|
objectId:
|
||||||
|
--- !u!114 &1928596181
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1928596179}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: a37fd8d654d5c2840a0ab3a5ad65a5ae, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
spawnHeight: 0.5
|
||||||
|
useAdditionalValues: 0
|
||||||
|
syncValues: []
|
||||||
|
propPrivacy: 1
|
||||||
|
subSyncs: []
|
||||||
|
spawnableType: 0
|
||||||
|
preGeneratedInstanceId:
|
||||||
|
--- !u!114 &1928596182
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1928596179}
|
||||||
|
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: 1
|
||||||
|
snappingReferences: []
|
||||||
|
autoHold: 0
|
||||||
|
ikReference: {fileID: 0}
|
||||||
|
--- !u!65 &1928596183
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1928596179}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1, z: 0.02}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &1928596184
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1928596179}
|
||||||
|
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: d3dc0619e4151e6b2b6b6b08038953f0, 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 &1928596185
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1928596179}
|
||||||
|
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!4 &1928596186
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1928596179}
|
||||||
|
m_LocalRotation: {x: 0, y: -1, z: 0, w: 0}
|
||||||
|
m_LocalPosition: {x: -1.25, y: 0.5, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 2004190974}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 4
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: -180, z: 0}
|
||||||
|
--- !u!1 &2004190973
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2004190974}
|
||||||
|
- component: {fileID: 2004190975}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Lenia_Camera
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2004190974
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2004190973}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 1928596186}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!20 &2004190975
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2004190973}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 2
|
||||||
|
m_BackGroundColor: {r: 0.4245283, g: 0.4245283, b: 0.4245283, a: 1}
|
||||||
|
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.02
|
||||||
|
far clip plane: 0.02
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 1
|
||||||
|
orthographic size: 0.5
|
||||||
|
m_Depth: 0
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 2147880759
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 8400000, guid: b8b62218c9d4ca16f887e8ae9d9d2942, type: 2}
|
||||||
|
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
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
struct v2f
|
struct v2f
|
||||||
{
|
{
|
||||||
float2 uv : TEXCOORD0;
|
float2 uv : TEXCOORD0;
|
||||||
|
|
||||||
float4 vertex : SV_POSITION;
|
float4 vertex : SV_POSITION;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,17 +36,16 @@
|
||||||
v2f o;
|
v2f o;
|
||||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
o.uv = v.uv;
|
o.uv = v.uv;
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
int state(float2 uv, float x,float y){
|
int state(half2 uv, half x, half y){
|
||||||
return tex2D(_LastFrame, uv + float2(x, y)).r > 0;
|
return tex2D(_LastFrame, uv + half2(x, y)).r > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed4 frag (v2f i) : SV_Target
|
fixed4 frag (v2f i) : SV_Target
|
||||||
{
|
{
|
||||||
const float d = 1.0/256.0;
|
const half d = 1.0/256.0;
|
||||||
|
|
||||||
int count = state(i.uv, -d, -d)+
|
int count = state(i.uv, -d, -d)+
|
||||||
state(i.uv, 0, -d)+
|
state(i.uv, 0, -d)+
|
||||||
|
@ -57,8 +55,8 @@
|
||||||
state(i.uv, -d, d)+
|
state(i.uv, -d, d)+
|
||||||
state(i.uv, 0, d)+
|
state(i.uv, 0, d)+
|
||||||
state(i.uv, d, d);
|
state(i.uv, d, d);
|
||||||
float4 this =tex2D(_LastFrame, i.uv);
|
half this = tex2D(_LastFrame, i.uv).r;
|
||||||
float state;
|
half state;
|
||||||
|
|
||||||
if (this.r > 0){
|
if (this.r > 0){
|
||||||
state = count > 1 && count < 4;
|
state = count > 1 && count < 4;
|
||||||
|
@ -68,9 +66,7 @@
|
||||||
state = count == 3;
|
state = count == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 col = float4(i.uv, 0.5, 1);
|
float4 col = float4(i.uv * state, 0.5 * state, 1);
|
||||||
col *= state;
|
|
||||||
col.a = 1;
|
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
ENDCG
|
ENDCG
|
||||||
|
|
|
@ -6,7 +6,7 @@ RenderTexture:
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: gol_render_texture
|
m_Name: gol_rt
|
||||||
m_ImageContentsHash:
|
m_ImageContentsHash:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
Hash: 00000000000000000000000000000000
|
Hash: 00000000000000000000000000000000
|
Loading…
Reference in a new issue