引入滤镜

This commit is contained in:
ALIENJACK\alien 2024-11-22 18:59:48 +08:00
parent ae66360466
commit 08bdb552c9
19 changed files with 574 additions and 247 deletions

View File

@ -196,7 +196,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1335662459} m_Father: {fileID: 1335662459}
m_RootOrder: 1 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!224 &246947326 stripped --- !u!224 &246947326 stripped
RectTransform: RectTransform:
@ -13379,6 +13379,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 1639312037} - {fileID: 1639312037}
- {fileID: 1475480929}
- {fileID: 74796459} - {fileID: 74796459}
- {fileID: 1427887270} - {fileID: 1427887270}
- {fileID: 1599240741} - {fileID: 1599240741}
@ -13426,6 +13427,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4471d8231d16ba3469228e09d4cb3a81, type: 3} m_Script: {fileID: 11500000, guid: 4471d8231d16ba3469228e09d4cb3a81, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
LegacyInput: 0
--- !u!4 &1427887270 --- !u!4 &1427887270
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -13438,8 +13440,163 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1335662459} m_Father: {fileID: 1335662459}
m_RootOrder: 2 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1475480928
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1475480929}
- component: {fileID: 1475480931}
- component: {fileID: 1475480930}
- component: {fileID: 1475480932}
m_Layer: 5
m_Name: GameCamera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1475480929
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -13.45, y: 0, z: 6.23}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1335662459}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1475480930
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
m_Name:
m_EditorClassIdentifier:
sharedProfile: {fileID: 11400000, guid: 17060e2d2f9e5c340a526f08317e5a98, type: 2}
isGlobal: 1
blendDistance: 0
weight: 1
priority: 0
--- !u!20 &1475480931
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
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: 1
orthographic size: 5
m_Depth: -2
m_CullingMask:
serializedVersion: 2
m_Bits: 32
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!114 &1475480932
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTrigger: {fileID: 0}
volumeLayer:
serializedVersion: 2
m_Bits: 32
stopNaNPropagation: 1
finalBlitToCameraTarget: 0
antialiasingMode: 0
temporalAntialiasing:
jitterSpread: 0.75
sharpness: 0.25
stationaryBlending: 0.95
motionBlending: 0.85
subpixelMorphologicalAntialiasing:
quality: 2
fastApproximateAntialiasing:
fastMode: 0
keepAlpha: 0
fog:
enabled: 1
excludeSkybox: 1
debugLayer:
lightMeter:
width: 512
height: 256
showCurves: 1
histogram:
width: 512
height: 256
channel: 3
waveform:
exposure: 0.12
height: 256
vectorscope:
size: 256
exposure: 0.12
overlaySettings:
linearDepth: 0
motionColorIntensity: 4
motionGridSize: 64
colorBlindnessType: 0
colorBlindnessStrength: 1
m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2}
m_ShowToolkit: 0
m_ShowCustomSorter: 0
breakBeforeColorGrading: 0
m_BeforeTransparentBundles: []
m_BeforeStackBundles:
- assemblyQualifiedName: FixingPixelArtGrille, AxibugEmuOnline.Client, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_AfterStackBundles: []
--- !u!1 &1498586261 --- !u!1 &1498586261
GameObject: GameObject:
m_ObjectHideFlags: 3 m_ObjectHideFlags: 3
@ -13580,7 +13737,7 @@ RectTransform:
- {fileID: 1318590597} - {fileID: 1318590597}
- {fileID: 939125854} - {fileID: 939125854}
m_Father: {fileID: 1335662459} m_Father: {fileID: 1335662459}
m_RootOrder: 3 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
@ -13600,7 +13757,7 @@ GameObject:
- component: {fileID: 1639312035} - component: {fileID: 1639312035}
m_Layer: 0 m_Layer: 0
m_Name: UICamera m_Name: UICamera
m_TagString: MainCamera m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -13622,7 +13779,7 @@ Camera:
m_GameObject: {fileID: 1639312034} m_GameObject: {fileID: 1639312034}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_ClearFlags: 1 m_ClearFlags: 3
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1 m_projectionMatrixMode: 1
m_GateFitMode: 2 m_GateFitMode: 2

View File

@ -1,182 +0,0 @@
%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: 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, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
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_LightingSettings: {fileID: 0}
--- !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
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &4232056520998800727
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536011, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4232056521131536013, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
propertyPath: m_Name
value: NesEmulator
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}

View File

@ -1,38 +0,0 @@
%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: New Render Texture
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 256
m_Height: 240
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 0
m_ColorFormat: 8
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

View File

@ -5,7 +5,8 @@
"GUID:390a2c4058e5c304a87e8be70c84d80b", "GUID:390a2c4058e5c304a87e8be70c84d80b",
"GUID:085dc26d74e6f994a924d401ea41a5a8", "GUID:085dc26d74e6f994a924d401ea41a5a8",
"GUID:0a45db2096af23647aaafe5b70ccb4d7", "GUID:0a45db2096af23647aaafe5b70ccb4d7",
"GUID:75469ad4d38634e559750d17036d5f7c" "GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:d60799ab2a985554ea1a39cd38695018"
], ],
"includePlatforms": [], "includePlatforms": [],
"excludePlatforms": [], "excludePlatforms": [],

View File

@ -1,5 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3dba71db67877594a9b5b77059205ec8 guid: 65f05f831c65bb042a8db3bf301f54ec
folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -0,0 +1,26 @@
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(FixingPixelArtGrilleRenderer), PostProcessEvent.BeforeStack, "Filter/FixingPixelArtGrille")]
public sealed class FixingPixelArtGrille : PostProcessEffectSettings
{
// 在这里可以添加效果的参数
}
public sealed class FixingPixelArtGrilleRenderer : PostProcessEffectRenderer<FixingPixelArtGrille>
{
private Shader shader;
private Material material;
public override void Init()
{
shader = Shader.Find("PostEffect/FixingPixcelArtGrille");
material = new Material(shader);
}
public override void Render(PostProcessRenderContext context)
{
context.command.Blit(context.source, context.destination, material);
}
}

View File

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

View File

@ -0,0 +1,301 @@
Shader "PostEffect/FixingPixcelArtGrille"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_TexelSize;
//
// PUBLIC DOMAIN CRT STYLED SCAN-LINE SHADER
//
// by Timothy Lottes
//
// This is more along the style of a really good CGA arcade monitor.
// With RGB inputs instead of NTSC.
// The shadow mask example has the mask rotated 90 degrees for less chromatic aberration.
//
// Left it unoptimized to show the theory behind the algorithm.
//
// It is an example what I personally would want as a display option for pixel art games.
// Please take and use, change, or whatever.
//
#define iResolution float2(1920,1080)
// Emulated input resolution.
// Optimize for resize.
#define res (float2(272.0,240.0)*1.5)
// Hardness of scanline.
// -8.0 = soft
// -16.0 = medium
#define hardScan -10.0
// Hardness of pixels in scanline.
// -2.0 = soft
// -4.0 = hard
#define hardPix -2.0
// Hardness of short vertical bloom.
// -1.0 = wide to the point of clipping (bad)
// -1.5 = wide
// -4.0 = not very wide at all
#define hardBloomScan -4.0
// Hardness of short horizontal bloom.
// -0.5 = wide to the point of clipping (bad)
// -1.0 = wide
// -2.0 = not very wide at all
#define hardBloomPix -1.5
// Amount of small bloom effect.
// 1.0/1.0 = only bloom
// 1.0/16.0 = what I think is a good amount of small bloom
// 0.0 = no bloom
#define bloomAmount 1.0/1.0
// Display warp.
// 0.0 = none
// 1.0/8.0 = extreme
#define warp float2(1.0/64.0,1.0/24.0)
// Amount of shadow mask.
#define maskDark 0.5
#define maskLight 1.5
//------------------------------------------------------------------------
float fract(float x){
return x-floor(x);
}
// sRGB to Linear.
// Assuing using sRGB typed textures this should not be needed.
float ToLinear1(float c){return(c<=0.04045)?c/12.92:pow((c+0.055)/1.055,2.4);}
float3 ToLinear(float3 c){return float3(ToLinear1(c.r),ToLinear1(c.g),ToLinear1(c.b));}
// Linear to sRGB.
// Assuing using sRGB typed textures this should not be needed.
float ToSrgb1(float c){return(c<0.0031308?c*12.92:1.055*pow(c,0.41666)-0.055);}
float3 ToSrgb(float3 c){return float3(ToSrgb1(c.r),ToSrgb1(c.g),ToSrgb1(c.b));}
// Testing only, something to help generate a dark signal for bloom test.
// Set to zero, or remove Test() if using this shader.
#if 1
float3 Test(float3 c){return c*(1.0/64.0)+c*c*c;}
#else
float3 Test(float3 c){return c;}
#endif
// Nearest emulated sample given floating point position and texel offset.
// Also zero's off screen.
float3 Fetch( float2 pos,float2 off){
pos=floor(pos*res+off)/res;
if(max(abs(pos.x-0.5),abs(pos.y-0.5))>0.5)return float3(0.0,0.0,0.0);
return Test(ToLinear(tex2D(_MainTex,pos.xy).rgb));}
// Distance in emulated pixels to nearest texel.
float2 Dist(float2 pos){pos=pos*res;return -((pos-floor(pos))-float2(0.5,0.5));}
// 1D Gaussian.
float Gaus(float pos,float scale){return exp2(scale*pos*pos);}
// 3-tap Gaussian filter along horz line.
float3 Horz3(float2 pos,float off){
float3 b=Fetch(pos,float2(-1.0,off));
float3 c=Fetch(pos,float2( 0.0,off));
float3 d=Fetch(pos,float2( 1.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=hardPix;
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
// Return filtered sample.
return (b*wb+c*wc+d*wd)/(wb+wc+wd);}
// 5-tap Gaussian filter along horz line.
float3 Horz5(float2 pos,float off){
float3 a=Fetch(pos,float2(-2.0,off));
float3 b=Fetch(pos,float2(-1.0,off));
float3 c=Fetch(pos,float2( 0.0,off));
float3 d=Fetch(pos,float2( 1.0,off));
float3 e=Fetch(pos,float2( 2.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=hardPix;
float wa=Gaus(dst-2.0,scale);
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
float we=Gaus(dst+2.0,scale);
// Return filtered sample.
return (a*wa+b*wb+c*wc+d*wd+e*we)/(wa+wb+wc+wd+we);}
// 7-tap Gaussian filter along horz line.
float3 Horz7(float2 pos,float off){
float3 a=Fetch(pos,float2(-3.0,off));
float3 b=Fetch(pos,float2(-2.0,off));
float3 c=Fetch(pos,float2(-1.0,off));
float3 d=Fetch(pos,float2( 0.0,off));
float3 e=Fetch(pos,float2( 1.0,off));
float3 f=Fetch(pos,float2( 2.0,off));
float3 g=Fetch(pos,float2( 3.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=hardBloomPix;
float wa=Gaus(dst-3.0,scale);
float wb=Gaus(dst-2.0,scale);
float wc=Gaus(dst-1.0,scale);
float wd=Gaus(dst+0.0,scale);
float we=Gaus(dst+1.0,scale);
float wf=Gaus(dst+2.0,scale);
float wg=Gaus(dst+3.0,scale);
// Return filtered sample.
return (a*wa+b*wb+c*wc+d*wd+e*we+f*wf+g*wg)/(wa+wb+wc+wd+we+wf+wg);}
// Return scanline weight.
float Scan(float2 pos,float off){
float dst=Dist(pos).y;
return Gaus(dst+off,hardScan);}
// Return scanline weight for bloom.
float BloomScan(float2 pos,float off){
float dst=Dist(pos).y;
return Gaus(dst+off,hardBloomScan);}
// Allow nearest three lines to effect pixel.
float3 Tri(float2 pos){
float3 a=Horz3(pos,-1.0);
float3 b=Horz5(pos, 0.0);
float3 c=Horz3(pos, 1.0);
float wa=Scan(pos,-1.0);
float wb=Scan(pos, 0.0);
float wc=Scan(pos, 1.0);
return a*wa+b*wb+c*wc;}
// Small bloom.
float3 Bloom(float2 pos){
float3 a=Horz5(pos,-2.0);
float3 b=Horz7(pos,-1.0);
float3 c=Horz7(pos, 0.0);
float3 d=Horz7(pos, 1.0);
float3 e=Horz5(pos, 2.0);
float wa=BloomScan(pos,-2.0);
float wb=BloomScan(pos,-1.0);
float wc=BloomScan(pos, 0.0);
float wd=BloomScan(pos, 1.0);
float we=BloomScan(pos, 2.0);
return a*wa+b*wb+c*wc+d*wd+e*we;}
// Distortion of scanlines, and end of screen alpha.
float2 Warp(float2 pos){
pos=pos*2.0-1.0;
pos*=float2(1.0+(pos.y*pos.y)*warp.x,1.0+(pos.x*pos.x)*warp.y);
return pos*0.5+0.5;}
#if 0
// Very compressed TV style shadow mask.
float3 Mask(float2 pos){
float line=maskLight;
float odd=0.0;
if(fract(pos.x/6.0)<0.5)odd=1.0;
if(fract((pos.y+odd)/2.0)<0.5)line=maskDark;
pos.x=fract(pos.x/3.0);
float3 mask=float3(maskDark,maskDark,maskDark);
if(pos.x<0.333)mask.r=maskLight;
else if(pos.x<0.666)mask.g=maskLight;
else mask.b=maskLight;
mask*=line;
return mask;}
#endif
#if 1
// Aperture-grille.
float3 Mask(float2 pos){
pos.x=fract(pos.x/3.0);
float3 mask=float3(maskDark,maskDark,maskDark);
if(pos.x<0.333)mask.r=maskLight;
else if(pos.x<0.666)mask.g=maskLight;
else mask.b=maskLight;
return mask;}
#endif
#if 0
// Stretched VGA style shadow mask (same as prior shaders).
float3 Mask(float2 pos){
pos.x+=pos.y*3.0;
float3 mask=float3(maskDark,maskDark,maskDark);
pos.x=fract(pos.x/6.0);
if(pos.x<0.333)mask.r=maskLight;
else if(pos.x<0.666)mask.g=maskLight;
else mask.b=maskLight;
return mask;}
#endif
#if 0
// VGA style shadow mask.
float3 Mask(float2 pos){
pos.xy=floor(pos.xy*float2(1.0,0.5));
pos.x+=pos.y*3.0;
float3 mask=float3(maskDark,maskDark,maskDark);
pos.x=fract(pos.x/6.0);
if(pos.x<0.333)mask.r=maskLight;
else if(pos.x<0.666)mask.g=maskLight;
else mask.b=maskLight;
return mask;}
#endif
// Draw dividing bars.
float Bar(float pos,float bar){pos-=bar;return pos*pos<4.0?0.0:1.0;}
// Entry.
float4 mainImage(float2 fragCoord){
float4 fragColor = float4(1,1,1,1);
float2 pos=Warp(fragCoord.xy/iResolution.xy);
fragColor.rgb=Tri(pos)*Mask(fragCoord.xy);
fragColor.rgb+=Bloom(pos)*bloomAmount;
fragColor.a=1.0;
fragColor.rgb=ToSrgb(fragColor.rgb);
return fragColor;
}
struct v2f
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
fixed4 frag (v2f i) : SV_Target
{
float2 pos = iResolution.xy*i.uv;
fixed4 col = mainImage(pos);
return col;
}
ENDCG
}
}
}

View File

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

View File

@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-3536514882628332180
MonoBehaviour:
m_ObjectHideFlags: 3
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: e88ab71ab1a47d048ba0e45b742f6140, type: 3}
m_Name: FixingPixelArtGrille
m_EditorClassIdentifier:
active: 1
enabled:
overrideState: 1
value: 1
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: 8e6292b2c06870d4495f009f912b9600, type: 3}
m_Name: GameCamera Profile
m_EditorClassIdentifier:
settings:
- {fileID: -3536514882628332180}

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5d4a385f133f9074583d64ab2172a03b guid: 17060e2d2f9e5c340a526f08317e5a98
NativeFormatImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 8400000 mainObjectFileID: 11400000
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -7,7 +7,7 @@ Material:
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: VirtuNesDraw m_Name: NesEmulator_Screen
m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3} m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3}
m_ShaderKeywords: m_ShaderKeywords:
m_LightmapFlags: 4 m_LightmapFlags: 4

View File

@ -1,4 +1,4 @@
Shader "AleinUI/Clip" Shader "NesEmulator/Screen"
{ {
Properties Properties
{ {
@ -107,8 +107,6 @@
mapUV.x = lerp(start,end, mapUV.x); mapUV.x = lerp(start,end, mapUV.x);
half4 color = tex2D(_MainTex,mapUV); half4 color = tex2D(_MainTex,mapUV);
//float rawIndex = color.b; //float rawIndex = color.b;

View File

@ -3,6 +3,7 @@
"com.unity.2d.sprite": "1.0.0", "com.unity.2d.sprite": "1.0.0",
"com.unity.ide.visualstudio": "2.0.22", "com.unity.ide.visualstudio": "2.0.22",
"com.unity.inputsystem": "1.3.0", "com.unity.inputsystem": "1.3.0",
"com.unity.postprocessing": "3.2.2",
"com.unity.ugui": "1.0.0", "com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0", "com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0", "com.unity.modules.androidjni": "1.0.0",

View File

@ -31,6 +31,15 @@
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.cn"
}, },
"com.unity.postprocessing": {
"version": "3.2.2",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.modules.physics": "1.0.0"
},
"url": "https://packages.unity.cn"
},
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.31", "version": "1.1.31",
"depth": 1, "depth": 1,

View File

@ -8,7 +8,7 @@ EditorBuildSettings:
- enabled: 1 - enabled: 1
path: Assets/Scene/AxibugEmuOnline.Client.unity path: Assets/Scene/AxibugEmuOnline.Client.unity
guid: eb0c18a619175384d95147898a43054b guid: eb0c18a619175384d95147898a43054b
- enabled: 1 - enabled: 0
path: Assets/Scene/Emu_NES.unity path: Assets/Scene/Emu_NES.unity
guid: 3dba71db67877594a9b5b77059205ec8 guid: 3dba71db67877594a9b5b77059205ec8
m_configObjects: {} m_configObjects: {}

View File

@ -640,21 +640,21 @@ PlayerSettings:
webGLThreadsSupport: 0 webGLThreadsSupport: 0
webGLDecompressionFallback: 0 webGLDecompressionFallback: 0
scriptingDefineSymbols: scriptingDefineSymbols:
1: DOTWEEN 1: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
4: DOTWEEN 4: DOTWEEN
7: DOTWEEN;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_EDITOR_ONLY 7: DOTWEEN;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_EDITOR_ONLY;UNITY_POST_PROCESSING_STACK_V2
13: DOTWEEN 13: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
14: DOTWEEN 14: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
19: DOTWEEN 19: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
21: DOTWEEN 21: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
25: DOTWEEN 25: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
27: DOTWEEN 27: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
28: DOTWEEN 28: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
29: DOTWEEN 29: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
30: DOTWEEN 30: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
31: DOTWEEN 31: DOTWEEN
32: DOTWEEN 32: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
33: DOTWEEN 33: DOTWEEN;UNITY_POST_PROCESSING_STACK_V2
additionalCompilerArguments: {} additionalCompilerArguments: {}
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: scriptingBackend: