Compare commits
2 commits
8d26a45d92
...
3b12a88a76
Author | SHA1 | Date | |
---|---|---|---|
3b12a88a76 | |||
76e464acd8 |
4 changed files with 40 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
|||
#version 120
|
||||
|
||||
#define pixelSize 2 // the size of pixels [1 2 4 8 16]
|
||||
|
||||
#define dithering // whether or not to apply dithering
|
||||
#define colorMode 0 // hsv/rgb [0 1]
|
||||
|
||||
|
@ -9,14 +11,14 @@
|
|||
|
||||
#define rgbSteps 4 // the number of rgb values to use [2 4 8 16 32 64]
|
||||
|
||||
#define pixelSize 2 // the size of pixels [1 2 4 8 16]
|
||||
|
||||
uniform sampler2D gcolor;
|
||||
uniform sampler2D colortex1;
|
||||
uniform float viewWidth, viewHeight;
|
||||
|
||||
varying vec2 texcoord;
|
||||
|
||||
#include "/module/dof.frag"
|
||||
|
||||
// All components are in the range [0…1], including hue.
|
||||
vec3 rgb2hsv(vec3 c)
|
||||
{
|
||||
|
@ -116,7 +118,9 @@ float dither(float color, float dithersteps) {
|
|||
void main() {
|
||||
// adjust texture coordinate based on pixel size if needed
|
||||
vec2 newcoord = texcoord;
|
||||
#if pixelSize > 1
|
||||
#ifdef dof
|
||||
newcoord = depthOfField();
|
||||
#elif pixelSize > 1
|
||||
vec2 view = vec2(viewWidth, viewHeight) / float(pixelSize);
|
||||
float offset = (ceil(pixelSize * 0.5) - 0.5) / float(pixelSize);
|
||||
newcoord = (floor(newcoord * view) + offset) / view;
|
||||
|
|
|
@ -35,3 +35,13 @@ value.vWarp.32=Silly (32x)
|
|||
option.tWarp=Texture Warping
|
||||
option.tWarp.comment=Emulates affine texture mapping responsible for warping textures on the PSX
|
||||
|
||||
screen.FX=FX
|
||||
option.dof=Depth of Field
|
||||
option.dof.comment=Downscale out-of-focus objects
|
||||
option.worldCurvature=World Curvature
|
||||
value.worldCurvature.0=Off
|
||||
value.worldCurvature.1=Chunk
|
||||
value.worldCurvature.2=Cylinder
|
||||
value.worldCurvature.3=Polyhedron
|
||||
value.worldCurvature.4=Sphere
|
||||
|
||||
|
|
19
shaders/module/dof.frag
Normal file
19
shaders/module/dof.frag
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
//#define dof
|
||||
|
||||
uniform float centerDepthSmooth;
|
||||
uniform sampler2D depthtex1;
|
||||
|
||||
const float centerDepthSmoothHalfLife = 16f;
|
||||
|
||||
vec2 depthOfField() {
|
||||
float depth = texture2D(depthtex1, texcoord).x;
|
||||
float distance = depth - centerDepthSmooth;
|
||||
int stops = min(int(distance * 96), 5);
|
||||
|
||||
float virtualSize = pow(float(pixelSize), 1 + stops);//1 + stops);
|
||||
vec2 view = vec2(viewWidth, viewHeight) / virtualSize;
|
||||
float offset = (ceil(virtualSize * 0.5) - 0.5) / virtualSize;
|
||||
return (floor(texcoord * view) + offset) / view;
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ profile.VR32=pixelSize=8 colorMode=0 !dithering hueSteps=2 satSteps=2 valSteps=2
|
|||
|
||||
# -- SCREENS --
|
||||
# default
|
||||
screen=<profile> <empty> pixelSize <empty> [COLOR] [PSX]
|
||||
screen=<profile> <empty> pixelSize <empty> [COLOR] [PSX] [FX]
|
||||
|
||||
# colors
|
||||
screen.COLOR.columns=3
|
||||
|
@ -18,6 +18,9 @@ screen.COLOR=colorMode dithering <empty> rgbSteps <empty> <empty> hueSteps satSt
|
|||
# psx
|
||||
screen.PSX=vWarp tWarp
|
||||
|
||||
# fx
|
||||
screen.FX=dof worldCurvature
|
||||
|
||||
# -- CONDITIONALS --
|
||||
gbuffers_hand.enabled=tWarp
|
||||
|
||||
|
|
Loading…
Reference in a new issue