From 8da7185eada5b931ebaa134a4bf7badc137fec09 Mon Sep 17 00:00:00 2001 From: Valerie Date: Thu, 18 Apr 2024 16:23:06 -0400 Subject: [PATCH] added curvature strength slider and restructured world module --- shaders/gbuffers_basic.vsh | 7 ++++--- shaders/lang/en_US.lang | 5 +++++ shaders/module/world.vert | 20 +++++++++++++------- shaders/shaders.properties | 4 ++-- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/shaders/gbuffers_basic.vsh b/shaders/gbuffers_basic.vsh index 6942a19..4e6040e 100644 --- a/shaders/gbuffers_basic.vsh +++ b/shaders/gbuffers_basic.vsh @@ -2,8 +2,6 @@ #include "/module/common.glsl" -#define worldCurvature 0 // [0 1 2] - varying vec2 texcoord; varying vec4 color; varying vec2 lmcoord; @@ -13,6 +11,7 @@ uniform float viewWidth, viewHeight; #include "/module/vertex_warp.vert" #include "/module/texture_warp.vert" +#include "/module/world.vert" void main() { texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; @@ -30,7 +29,9 @@ void main() { #endif #ifndef NON_WORLD - #include "/module/world.vert" + #if worldCurvature > 0 + world_curvature(); + #endif #endif } diff --git a/shaders/lang/en_US.lang b/shaders/lang/en_US.lang index 52eef69..81ea869 100644 --- a/shaders/lang/en_US.lang +++ b/shaders/lang/en_US.lang @@ -56,4 +56,9 @@ option.worldCurvature=World Curvature value.worldCurvature.0=Off value.worldCurvature.1=Cylinder value.worldCurvature.2=Round +option.worldRadius=Curvature Strength +value.worldRadius.1024=Low (1024) +value.worldRadius.512=Medium (512) +value.worldRadius.256=High (256) +value.worldRadius.-256=Inverse (-256) diff --git a/shaders/module/world.vert b/shaders/module/world.vert index e4abe93..214c5e9 100644 --- a/shaders/module/world.vert +++ b/shaders/module/world.vert @@ -1,8 +1,14 @@ -#if worldCurvature == 1 - float z = gl_Position.z * gl_Position.z; - gl_Position.y -= z / 256; -#elif worldCurvature == 2 - vec2 xz = gl_Position.xz; - gl_Position.y -= ceil(( dot(xz, xz) * 5 ) / 512) / 5; -#endif + +#define worldCurvature 0 // [0 1 2] +#define worldRadius 512 // [1024 512 256 -256] + +void world_curvature() { + #if worldCurvature == 1 + float z = gl_Position.z * gl_Position.z; + gl_Position.y -= 2 * z / worldRadius; + #elif worldCurvature == 2 + vec2 xz = gl_Position.xz; + gl_Position.y -= ceil(( dot(xz, xz) * 5 ) / worldRadius) / 5; + #endif +} diff --git a/shaders/shaders.properties b/shaders/shaders.properties index cf3fb46..271dcb5 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -1,4 +1,4 @@ -sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp +sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp worldRadius # -- PROFILES -- profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur @@ -26,7 +26,7 @@ screen.PSX=vWarp tWarp # playstation screen.REALITY=hBlur # nintendo 64 # custom effects -screen.FX=dof dofRes worldCurvature +screen.FX=dof dofRes worldCurvature worldRadius # -- CONDITIONALS -- gbuffers_hand.enabled=tWarp