??
??????????????????????????
??
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
1??????????????????????????????????????????????????
?? Bob???????? flash ??
2??????????????????????????
HGSS ?? Dragon Den
3???????????????????????
Drill Dozer ??
?????? UI ?????????????????????????????????????????????????????
???3??????????????
????????????????????????????????????????????????????????????????????? GB ? GBC????????2????15???????????????????????????????????????????????????????????????????????????????
?????
? GBA ???????240 *160?????????????????????????????????????????????????????????????????????????????????????1080p ??????????????????????????????????????????????
??????3????????????????????
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????? ppsspp ????????????? shader ?????????????2D ??????????? xBRZ ???????????xBRZ ?2D ??????????????????????????????? crt, ??????????????????????????????????? CRT ?????????
????????????? crt ??????????????????????????
????????
???????????? crt ????????
???????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Her Story ??????????? crt ???
??????????? post processing shader????????
?? shader ?????
???????????????????????????????????????????????????????? LCD ????? CRT ???????????????????????????????????? psp ????????????? Tactics Ogres??????????????
???????????????????1.????????????????????????????2.???????????????????????????????????????
?????????????? CG ???????????512 x 384
?????
???
?????????2????????????? pixel???? texel ??????2 x 2?????????????????????????????????????????????????????????????????????????????????????????????????????????2???????????4?????????????
????????????
????????????
??????????????? camera input????1 texel ?? 4 pixel?????1 texel ?? 16 pixel?
?????????????????????????????????, ????????4*4????????????????? vec2?
- o.pixel_no = float2(o.uv.x * _MainTex_TexelSize.z, o.uv.y * _MainTex_TexelSize.w) * 0.25;
复制代码
_MainTex_TexelSize???? uniform??????????????? zw ?????????? ppsspp ?????????u_texelDelta??????? resolution???????
?? pixel_no ??????????????????????
- fixed4 Pass_Scanline(float2 uv) {
- float column = 4;
- float2 pixel_no =
- frac(float2(uv.x * 1024.0, uv.y * 768) * _ScreenScale / column);
- if(pixel_no.x < 1 / column || pixel_no.y < 1 / column)
- return PREVIOUS_PASS(uv) * 0.5;
- else
- return PREVIOUS_PASS(uv);
- }
复制代码
?? PREVIOUS_PASS ?????????? multi-pass???? PREVIOUS_PASS ?????????????????? pass???? column ?4???????????????? pixel_no ? x ?????1/8, 3/8, 5/8, 7/8?????????????????????????????
?????????????????????????????????????????????????????????? asset store ?????????
??????
??????????????????????????????????????????????????????????????????????? pixel ? texel ??????????????3?????2??????4???????????
???????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????
?????????????????????????????????
??????????????????????
???
????????????????????kernel????????????????????????????????Gaussian Filter???????????????????Themaister ??????????????? git ?????????????????????????????GLSL ?????????????
?????????????????????????????
???????????????????4x4?????????8??????????????????????????????????????????????????????????????????????????????????????????????????????
1??????9???
??????????????????????????
?????????????????????????????????????????????
??? Exp( -2.05 * ??????)
??? Exp( -2.05 * ????)
???????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????
???????????????????????????????????
????????
????
??????
Themaister ??????????????????????????????????????????????????????????????????????????????????????????????? Glow ????????????
- float color_bloom(float3 color)
- {
- // const float3 gray_coeff = float3(0.30, 0.59, 0.11);
- const float shine = 0.25;
- float bright = Luminance(color);//dot(color, gray_coeff);
- return lerp(1.0 + shine * 0.5, 1.0 - shine, bright);
- }
复制代码
???????????? gray_coeff ?????????? unity ????????????gray_coeff?? fixed3(0.22, 0.707, 0.071)
?????? lerp ??????????????????????????????????
No.???
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? pixel_no ??????????????????????????????????????1/(column * 2)?????????????
- float?delta = dist(frac(pixel_no + float2(-0.125,?0.125)), offset + float2(0.5,?0.5));
复制代码
????????????????????????????????????????????
????????????
?????
??????????????????????????????????????????????????????????????????????????????????? ps ?????????????????????????????????????????????
????????????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????
?????????????
??????????????????????????????????????????????????????????????
??????????????????????????????
??????????????????????????????????????
?? bloom
Bloom ?????????????????????????bloom ???? HDR ??????????? Tone Mapping?Bright Pass Filter ?? Blur???????????2D ???????? HDR ?????????????????? ToneMapping ????? Bright ? Blur?
1?????? bloom ???? bloom
????? bloom ?? blur ????????????????????????????????????????????????? pass ?????????????????????????
- fixed4 Pass_SimpleBloom(float2 uv)
- {
- float4 sum = float4(0, 0, 0, 0);
- float4 bum = float4(0, 0, 0, 0);
-
- float2 glareSize = float2(1.0 / 512, 1.0 / 384) * 0.65;
- int height = 3;
- int width = 1;
- for(int i = -width; i < width; i++)
- {
- for(int j = -height; j < height; ++j)
- {
- sum += tex2D(_MainTex, uv + float2(i, j) * glareSize);
- bum += tex2D(_MainTex, uv + float2(j, i) * glareSize);
- }
- }
- fixed4 color = PREVIOUS_PASS(uv);
- color = (sum*sum*0.001 + bum*bum*0.0080) * _Amount / ((2* height +1) *(2* width +1)) + color*_Power;
- return color;
- }
复制代码
renderTexture ? multipass
Bloom ???????? ppsspp ??????????????????? ppsspp ?????? multi-pass shader????????? pass ??????? bloom ?????????????????????
?????? unity ????????????????? pass ?? bloom ??????? render texture ??????? shader ???????????????????? single-pass ?1/5?????????????
- RenderTexture rtTemp = RenderTexture.GetTemporary(src.width, src.height);
- Graphics.Blit(src, rtTemp, _Material_1);
- Graphics.Blit(rtTemp, dst, _Material_2);
- RenderTexture.ReleaseTemporary(rtTemp);
复制代码
??????????????????? drawIndexed ?
????????? pass ??????????????unity ???? RenderTexture.GetTemporary ???????DiscardContents????? CPU ????????????????????
??? bloom ???????
|