Mega Bezel Reflection Shader! - Feedback and Updates

Sorry I was already disconnecting it before you had even asked, lol. I was just finishing up or so I thought when you messaged.

I got it separated properly now, sorry it was giving me fits for a second I didn’t pull everything correctly the first time and had to troubleshoot real quick. (I was getting tripped up by the swapxy thing.)

I separated the slang version of the shader. Everything seems to be working as far as I could tell. (I don’t really use mame-hlsl much as I’ve disconnected everything I was interested in, lol.)

Here ya go though!

#version 450

// license:BSD-3-Clause
// copyright-holders:ImJezze
//-----------------------------------------------------------------------------
// Distortion Effect
//-----------------------------------------------------------------------------

layout(push_constant) uniform Push
{
	vec4 SourceSize;
	vec4 OriginalSize;
	vec4 OutputSize;
	uint FrameCount;
   vec4 FinalViewportSize;
} params;

layout(std140, set = 0, binding = 0) uniform UBO
{
	mat4 MVP;
    float swapxy;
    float distortiontoggle;
	float distortion_amount;
	float cubic_distortion_amount;
	float distort_corner_amount;
	float round_corner_amount;
	float smooth_border_amount;
	float vignette_amount;
	float reflection_amount;
	float reflection_col_r;
	float reflection_col_g;
	float reflection_col_b;
} global;

#pragma parameter distortiontoggle "Distortion Toggle" 0.0 0.0 1.0 1.0
bool Distortion = bool(global.distortiontoggle);
#pragma parameter distortion_amount "Distortion Amount" 0.0 0.0 1.0 0.01
#pragma parameter cubic_distortion_amount "Cubic Dist. Amt" 0.0 0.0 1.0 0.01
#pragma parameter distort_corner_amount "Corner Dist. Amt" 0.0 0.0 1.0 0.01
#pragma parameter round_corner_amount "Corner Rounding" 0.0 0.0 1.0 0.01
#pragma parameter smooth_border_amount "Border Smoothing" 0.0 0.0 1.0 0.01
#pragma parameter vignette_amount "Vignetting Amount" 0.0 0.0 1.0 0.01
#pragma parameter reflection_amount "Reflection Amount" 0.0 0.0 1.0 0.01
#pragma parameter reflection_col_r "Reflection Color R" 1.0 0.0 1.0 0.01
#pragma parameter reflection_col_g "Reflection Color G" 0.9 0.0 1.0 0.01
#pragma parameter reflection_col_b "Reflection Color B" 0.8 0.0 1.0 0.01
#pragma parameter swapxy "Swap X and Y" 0.0 0.0 1.0 1.0
bool SwapXY = bool(global.swapxy);

#define saturate(c) clamp(c, 0.0, 1.0)
#define mul(a,b) (b*a)
const int ScreenCount = 1;

//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------

const float Epsilon = 1.0e-7;
const float PI = 3.1415927;
const float E = 2.7182817;
const float Gelfond = 23.140692; // e^pi (Gelfond constant)
const float GelfondSchneider = 2.6651442; // 2^sqrt(2) (Gelfond-Schneider constant)

//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------

// www.stackoverflow.com/questions/5149544/can-i-generate-a-random-number-inside-a-pixel-shader/
float random(vec2 seed)
{
	// irrationals for pseudo randomness
	vec2 i = vec2(Gelfond, GelfondSchneider);

	return fract(cos(dot(seed, i)) * 123456.0);
}

// www.dinodini.wordpress.com/2010/04/05/normalized-tunable-sigmoid-functions/
float normalizedSigmoid(float n, float k)
{
	// valid for n and k in range of -1.0 and 1.0
	return (n - n * k) / (k - abs(n) * 2.0 * k + 1);
}

// www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
float roundBox(vec2 p, vec2 b, float r)
{
	return length(max(abs(p) - b + r, 0.0)) - r;
}

#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;

void main()
{
   gl_Position = global.MVP * Position;
   vTexCoord = TexCoord;
}

#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;

#define DiffuseSampler Source

float DistortionAmount = global.distortion_amount;      // k     - quartic distortion coefficient
float CubicDistortionAmount = global.cubic_distortion_amount; // kcube - cubic distortion modifier
float DistortCornerAmount = global.distort_corner_amount;
float RoundCornerAmount = global.round_corner_amount;
float SmoothBorderAmount = global.smooth_border_amount;
float VignettingAmount = global.vignette_amount;
float ReflectionAmount = global.reflection_amount;
vec3 LightReflectionColor = vec3(global.reflection_col_r, global.reflection_col_g, global.reflection_col_b); // color temperature 5.000 Kelvin

vec2 QuadDims = params.OutputSize.xy;
vec2 TargetDims = params.FinalViewportSize.xy;
float TargetScale = 1.0;

float GetNoiseFactor(vec3 n, float random)
{
	// smaller n become more noisy
	return 1.0f + random * max(0.0f, 0.25f * pow(E, -8 * n.x));
}

float GetVignetteFactor(vec2 coord, float amount)
{
	vec2 VignetteCoord = coord;

	float VignetteLength = length(VignetteCoord);
	float VignetteBlur = (amount * 0.75f) + 0.25;

	// 0.5 full screen fitting circle
	float VignetteRadius = 1.0f - (amount * 0.25f);
	float Vignette = smoothstep(VignetteRadius, VignetteRadius - VignetteBlur, VignetteLength);

	return saturate(Vignette);
}

float GetSpotAddend(vec2 coord, float amount)
{
	vec2 SpotCoord = coord;

	// upper right quadrant
	vec2 spotOffset = vec2(-0.25f, 0.25f);

	// normalized screen canvas ratio
	vec2 CanvasRatio = SwapXY 
		? vec2(1.0f, QuadDims.x / QuadDims.y)
		: vec2(1.0f, QuadDims.y / QuadDims.x);

	SpotCoord += spotOffset;
	SpotCoord *= CanvasRatio;

	float SpotBlur = amount;

	// 0.5 full screen fitting circle
	float SpotRadius = amount * 0.75f;
	float Spot = smoothstep(SpotRadius, SpotRadius - SpotBlur, length(SpotCoord));

	float SigmoidSpot = amount * normalizedSigmoid(Spot, 0.75);

	// increase strength by 100%
	SigmoidSpot = SigmoidSpot * 2.0f;

	return saturate(SigmoidSpot);
}

float GetBoundsFactor(vec2 coord, vec2 bounds, float radiusAmount, float smoothAmount)
{
	// reduce smooth amount down to radius amount
	smoothAmount = min(smoothAmount, radiusAmount);

	float range = min(bounds.x, bounds.y);
	float amountMinimum = 1.0f / range;
	float radius = range * max(radiusAmount, amountMinimum);
	float smooth_ = 1.0f / (range * max(smoothAmount, amountMinimum * 2.0f));

	// compute box
	float box = roundBox(bounds * (coord * 2.0f), bounds, radius);

	// apply smooth
	box *= smooth_;
	box += 1.0f - pow(smooth_ * 0.5f, 0.5f);

	float border = smoothstep(1.0f, 0.0f, box);

	return saturate(border);
}

// www.francois-tarlier.com/blog/cubic-lens-distortion-shader/
vec2 GetDistortedCoords(vec2 centerCoord, float amount, float amountCube)
{
	// lens distortion coefficient
	float k = amount;

	// cubic distortion value
	float kcube = amountCube;

	// compute cubic distortion factor
	float r2 = centerCoord.x * centerCoord.x + centerCoord.y * centerCoord.y;
	float f = kcube == 0.0f
		? 1.0f + r2 * k
		: 1.0f + r2 * (k + kcube * sqrt(r2));

   	// fit screen bounds
	f /= 1.0f + amount * 0.25f + amountCube * 0.125f;

	// apply cubic distortion factor
   	centerCoord *= f;

	return centerCoord;
}

vec2 GetTextureCoords(vec2 coord, float distortionAmount, float cubicDistortionAmount)
{
	// center coordinates
	coord -= 0.5f;

	// distort coordinates
	coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount);

	// un-center coordinates
	coord += 0.5f;

	return coord;
}

vec2 GetQuadCoords(vec2 coord, vec2 scale, float distortionAmount, float cubicDistortionAmount)
{
	// center coordinates
	coord -= 0.5f;

	// apply scale
	coord *= scale;

	// distort coordinates
	coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount);

	return coord;
}

void main()
{
   if(!Distortion)
   {
      FragColor = texture(Source, vTexCoord);
      return;
   }
   else
   {
      // image distortion
      float distortionAmount = DistortionAmount;
      float cubicDistortionAmount = CubicDistortionAmount > 0.0f
         ? CubicDistortionAmount * 1.1f  // cubic distortion need to be a little higher to compensate the quartic distortion
         : CubicDistortionAmount * 1.2f; // negativ values even more

      // corner distortion at least by the amount of the image distorition
      float distortCornerAmount = max(DistortCornerAmount, DistortionAmount + CubicDistortionAmount);

      float roundCornerAmount = RoundCornerAmount * 0.5f;
      float smoothBorderAmount = SmoothBorderAmount * 0.5f;

      vec2 TexelDims = 1.0f / TargetDims;

      // base-target dimensions (without oversampling)
      vec2 BaseTargetDims = TargetDims / TargetScale;
      BaseTargetDims = SwapXY
         ? BaseTargetDims.yx
         : BaseTargetDims.xy;

      // base-target/quad difference scale
      vec2 BaseTargetQuadScale = (ScreenCount == 1)
         ? BaseTargetDims / QuadDims // keeps the coords inside of the quad bounds of a single screen
         : vec2(1.0);

      // Screen Texture Curvature
      vec2 BaseCoord = GetTextureCoords(vTexCoord, distortionAmount, cubicDistortionAmount);

      // Screen Quad Curvature
      vec2 QuadCoord = GetQuadCoords(vTexCoord, BaseTargetQuadScale, distortCornerAmount, 0.0f);
   /*
      // clip border
      if (BaseCoord.x < 0.0f - TexelDims.x || BaseCoord.y < 0.0f - TexelDims.y ||
         BaseCoord.x > 1.0f + TexelDims.x || BaseCoord.y > 1.0f + TexelDims.y)
      {
         // we don't use the clip function, because we don't clear the render target before
         return vec4(0.0f, 0.0f, 0.0f, 1.0f);
      }
   */

      // Color
      vec4 BaseColor = texture(DiffuseSampler, BaseCoord);
      BaseColor.a = 1.0f;

      // Vignetting Simulation
      vec2 VignetteCoord = QuadCoord;

      float VignetteFactor = GetVignetteFactor(VignetteCoord, VignettingAmount);
      BaseColor.rgb *= VignetteFactor;

      // Light Reflection Simulation
      vec2 SpotCoord = QuadCoord;

      vec3 SpotAddend = GetSpotAddend(SpotCoord, ReflectionAmount) * LightReflectionColor;
      BaseColor.rgb += SpotAddend * GetNoiseFactor(SpotAddend, random(SpotCoord));

      // Round Corners Simulation
      vec2 RoundCornerCoord = QuadCoord;
      vec2 RoundCornerBounds = (ScreenCount == 1)
         ? QuadDims // align corners to quad bounds of a single screen
         : BaseTargetDims; // align corners to target bounds of multiple screens
      RoundCornerBounds = SwapXY
         ? RoundCornerBounds.yx
         : RoundCornerBounds.xy;

      float roundCornerFactor = GetBoundsFactor(RoundCornerCoord, RoundCornerBounds, roundCornerAmount, smoothBorderAmount);
      BaseColor.rgb *= roundCornerFactor;

      FragColor = BaseColor;
   }
}

Just make a copy of some random slang shader and copy pasta this over it. The code could be tidied up some, but it runs without issues on my end. You can use this as reference to disconnect the others. If your curious about any of the passes I’ve already disconnected just PM me and I’ll help you out.

Hope this helps!

1 Like

Wow nice. Thx a lot @Syh.

I will not be at home today, so I can’t test it before tomorrow. I think that this kind of stuff is interesting for many others, so it’s good we discussed this in public. I’ll give you feedback via PM tomorrow :metal:

If anyone has questions about my setup: don’t hesitate to ask, I’m happy to help!

1 Like

It was NP, I like to help out with things when I can and it’s in my skill level. My memory is just horrible, juggling all the things currently lol.

Now that I think about it there’s a 50/50 chance that the previous verison I posted won’t work with @HyperspaceMadness’s shader chain (the shader I posted does work though, I was using it before I posted it) but that version might not work for your use case as RA or Slang in general has a setting amount limit. So I’ll have to semi-hardcode the setting values for that mame shader to work in Hyper’s chain.

I’m waiting on my computer to finish up some stuff before I go to sleep so I went ahead hardcoded the setting so it could be used with Hyper’s chain.

You’re going to want to use this version with Hyper’s chain, most other cases you can just use the first copy, lol.

#version 450

// license:BSD-3-Clause
// copyright-holders:ImJezze
//-----------------------------------------------------------------------------
// Distortion Effect
//-----------------------------------------------------------------------------

layout(push_constant) uniform Push
{
	vec4 SourceSize;
	vec4 OriginalSize;
	vec4 OutputSize;
	uint FrameCount;
   vec4 FinalViewportSize;
} params;

layout(std140, set = 0, binding = 0) uniform UBO
{
	mat4 MVP;
} global;

#define saturate(c) clamp(c, 0.0, 1.0)
#define mul(a,b) (b*a)
const int ScreenCount = 1;

//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------

const float Epsilon = 1.0e-7;
const float PI = 3.1415927;
const float E = 2.7182817;
const float Gelfond = 23.140692; // e^pi (Gelfond constant)
const float GelfondSchneider = 2.6651442; // 2^sqrt(2) (Gelfond-Schneider constant)

//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------

// www.stackoverflow.com/questions/5149544/can-i-generate-a-random-number-inside-a-pixel-shader/
float random(vec2 seed)
{
	// irrationals for pseudo randomness
	vec2 i = vec2(Gelfond, GelfondSchneider);

	return fract(cos(dot(seed, i)) * 123456.0);
}

// www.dinodini.wordpress.com/2010/04/05/normalized-tunable-sigmoid-functions/
float normalizedSigmoid(float n, float k)
{
	// valid for n and k in range of -1.0 and 1.0
	return (n - n * k) / (k - abs(n) * 2.0 * k + 1);
}

// www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
float roundBox(vec2 p, vec2 b, float r)
{
	return length(max(abs(p) - b + r, 0.0)) - r;
}

#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;

void main()
{
   gl_Position = global.MVP * Position;
   vTexCoord = TexCoord;
}

#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;

#define DiffuseSampler Source

float DistortionAmount = 0.0;      // k     - quartic distortion coefficient
float CubicDistortionAmount = 0.0; // kcube - cubic distortion modifier
float DistortCornerAmount = 0.0;
float RoundCornerAmount = 0.0;
float SmoothBorderAmount = 0.0;
float VignettingAmount = 0.5;
float ReflectionAmount = 0.2;
vec3 LightReflectionColor = vec3(1.0, 0.9, 0.8); // color temperature 5.000 Kelvin

vec2 QuadDims = params.OutputSize.xy;
vec2 TargetDims = params.FinalViewportSize.xy;
float TargetScale = 1.0;

float GetNoiseFactor(vec3 n, float random)
{
	// smaller n become more noisy
	return 1.0f + random * max(0.0f, 0.25f * pow(E, -8 * n.x));
}

float GetVignetteFactor(vec2 coord, float amount)
{
	vec2 VignetteCoord = coord;

	float VignetteLength = length(VignetteCoord);
	float VignetteBlur = (amount * 0.75f) + 0.25;

	// 0.5 full screen fitting circle
	float VignetteRadius = 1.0f - (amount * 0.25f);
	float Vignette = smoothstep(VignetteRadius, VignetteRadius - VignetteBlur, VignetteLength);

	return saturate(Vignette);
}

float GetSpotAddend(vec2 coord, float amount)
{
	vec2 SpotCoord = coord;

	// upper right quadrant
	vec2 spotOffset = vec2(-0.25f, 0.25f);

	// normalized screen canvas ratio
	vec2 CanvasRatio = vec2(1.0f, QuadDims.y / QuadDims.x);

	SpotCoord += spotOffset;
	SpotCoord *= CanvasRatio;

	float SpotBlur = amount;

	// 0.5 full screen fitting circle
	float SpotRadius = amount * 0.75f;
	float Spot = smoothstep(SpotRadius, SpotRadius - SpotBlur, length(SpotCoord));

	float SigmoidSpot = amount * normalizedSigmoid(Spot, 0.75);

	// increase strength by 100%
	SigmoidSpot = SigmoidSpot * 2.0f;

	return saturate(SigmoidSpot);
}

float GetBoundsFactor(vec2 coord, vec2 bounds, float radiusAmount, float smoothAmount)
{
	// reduce smooth amount down to radius amount
	smoothAmount = min(smoothAmount, radiusAmount);

	float range = min(bounds.x, bounds.y);
	float amountMinimum = 1.0f / range;
	float radius = range * max(radiusAmount, amountMinimum);
	float smooth_ = 1.0f / (range * max(smoothAmount, amountMinimum * 2.0f));

	// compute box
	float box = roundBox(bounds * (coord * 2.0f), bounds, radius);

	// apply smooth
	box *= smooth_;
	box += 1.0f - pow(smooth_ * 0.5f, 0.5f);

	float border = smoothstep(1.0f, 0.0f, box);

	return saturate(border);
}

// www.francois-tarlier.com/blog/cubic-lens-distortion-shader/
vec2 GetDistortedCoords(vec2 centerCoord, float amount, float amountCube)
{
	// lens distortion coefficient
	float k = amount;

	// cubic distortion value
	float kcube = amountCube;

	// compute cubic distortion factor
	float r2 = centerCoord.x * centerCoord.x + centerCoord.y * centerCoord.y;
	float f = kcube == 0.0f
		? 1.0f + r2 * k
		: 1.0f + r2 * (k + kcube * sqrt(r2));

   	// fit screen bounds
	f /= 1.0f + amount * 0.25f + amountCube * 0.125f;

	// apply cubic distortion factor
   	centerCoord *= f;

	return centerCoord;
}

vec2 GetTextureCoords(vec2 coord, float distortionAmount, float cubicDistortionAmount)
{
	// center coordinates
	coord -= 0.5f;

	// distort coordinates
	coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount);

	// un-center coordinates
	coord += 0.5f;

	return coord;
}

vec2 GetQuadCoords(vec2 coord, vec2 scale, float distortionAmount, float cubicDistortionAmount)
{
	// center coordinates
	coord -= 0.5f;

	// apply scale
	coord *= scale;

	// distort coordinates
	coord = GetDistortedCoords(coord, distortionAmount, cubicDistortionAmount);

	return coord;
}

void main()
{

      // image distortion
      float distortionAmount = DistortionAmount;
      float cubicDistortionAmount = CubicDistortionAmount > 0.0f
         ? CubicDistortionAmount * 1.1f  // cubic distortion need to be a little higher to compensate the quartic distortion
         : CubicDistortionAmount * 1.2f; // negativ values even more

      // corner distortion at least by the amount of the image distorition
      float distortCornerAmount = max(DistortCornerAmount, DistortionAmount + CubicDistortionAmount);

      float roundCornerAmount = RoundCornerAmount * 0.5f;
      float smoothBorderAmount = SmoothBorderAmount * 0.5f;

      vec2 TexelDims = 1.0f / TargetDims;

      // base-target dimensions (without oversampling)
      vec2 BaseTargetDims = TargetDims / TargetScale;
      BaseTargetDims = BaseTargetDims.xy;

      // base-target/quad difference scale
      vec2 BaseTargetQuadScale = (ScreenCount == 1)
         ? BaseTargetDims / QuadDims // keeps the coords inside of the quad bounds of a single screen
         : vec2(1.0);

      // Screen Texture Curvature
      vec2 BaseCoord = GetTextureCoords(vTexCoord, distortionAmount, cubicDistortionAmount);

      // Screen Quad Curvature
      vec2 QuadCoord = GetQuadCoords(vTexCoord, BaseTargetQuadScale, distortCornerAmount, 0.0f);
   /*
      // clip border
      if (BaseCoord.x < 0.0f - TexelDims.x || BaseCoord.y < 0.0f - TexelDims.y ||
         BaseCoord.x > 1.0f + TexelDims.x || BaseCoord.y > 1.0f + TexelDims.y)
      {
         // we don't use the clip function, because we don't clear the render target before
         return vec4(0.0f, 0.0f, 0.0f, 1.0f);
      }
   */

      // Color
      vec4 BaseColor = texture(DiffuseSampler, BaseCoord);
      BaseColor.a = 1.0f;

      // Vignetting Simulation
      vec2 VignetteCoord = QuadCoord;

      float VignetteFactor = GetVignetteFactor(VignetteCoord, VignettingAmount);
      BaseColor.rgb *= VignetteFactor;

      // Light Reflection Simulation
      vec2 SpotCoord = QuadCoord;

      vec3 SpotAddend = GetSpotAddend(SpotCoord, ReflectionAmount) * LightReflectionColor;
      BaseColor.rgb += SpotAddend * GetNoiseFactor(SpotAddend, random(SpotCoord));

      // Round Corners Simulation
      vec2 RoundCornerCoord = QuadCoord;
      vec2 RoundCornerBounds = (ScreenCount == 1)
         ? QuadDims // align corners to quad bounds of a single screen
         : BaseTargetDims; // align corners to target bounds of multiple screens
      RoundCornerBounds = RoundCornerBounds.xy;

      float roundCornerFactor = GetBoundsFactor(RoundCornerCoord, RoundCornerBounds, roundCornerAmount, smoothBorderAmount);
      BaseColor.rgb *= roundCornerFactor;

      FragColor = BaseColor;
   
}

Here’s where the settings are so you can adjust them, you have to open the shader to edit the settings (which is a pain, but at least this way you should be able to run it with Hyper’s chain like you’re wanting.)

Just find this section in the shader and change these numbers to w/e you want them set at, the vignette and reflection are already set to be visible as I needed them to be so I could see if it worked and I just realized this after I posted it, lol.

float DistortionAmount = 0.0;      // k     - quartic distortion coefficient
float CubicDistortionAmount = 0.0; // kcube - cubic distortion modifier
float DistortCornerAmount = 0.0;
float RoundCornerAmount = 0.0;
float SmoothBorderAmount = 0.0;
float VignettingAmount = 0.5;
float ReflectionAmount = 0.2;
vec3 LightReflectionColor = vec3(1.0, 0.9, 0.8); // color temperature 5.000 Kelvin

The LightReflectionColor thingy that has three numbers, the numbers are in RGB order (so first number is the red value, then the green, then blue.)

Have fun, lol!

1 Like

Hi,

How to say, Some people will prefer CBOD, Mdapt or others

The dithering problem mainly affects the Sega Genesis a bit Snes and some games on PSX SilentHill

I understand that this is not a priority, my question was just to increase realism.

I don’t know if it would be possible but in the shader pass add the three main ones

  • CBOB
  • Mdapt
  • GTU and to insert an on / off switch, so that everyone can choose what they want and there are fewer shader available. for example A single shader for Guest-Venom (with the GTU / CBOD / Mdapt switches on off by default). One shader for Guest-sm and Easymode

So less shader in the list but even more options …

I even wonder and I don’t know how the result would be. My idea would be to resume your reflection in the game screen itself and have an adjustable blur. I do not know how would be the superposition can be, maybe that it would be useless (I am not a programmer just a player)

Truth be told, I’ve always found the zombie shader shader packs to be super nice visual level (provided you have the correct distance) some probably don’t like at all

Some are inspired by AnalogShader Pack which has never been converted to Glsl or Slang

If one day someone could combine this kind of zombshader blurring / dithering with Guest and your incredible reflection, it would be huge

I leave you a link, below there is a Genesis screen with a nice dithering for me

https://forums.launchbox-app.com/topic/30010-the-big-ol-retroarch-shader-thread/page/9/

2 Likes

If u wish, i can try it. I suggested the bezel project thing, and I really doubt that i can improove the script but i could improove the process steps, the inly thing i didn’t saw the reflections on your bezel. Great work!! :smiley:

Hi, this is almost certainly because it has its own parameters. The shader system has a max number of parameters, and the Mega Bezel Shader with GTU is at the limit already (GTU adds 3 parameters), so if any shader you add has its own parameters it goes over the limit and won’t compile. This is a considerable difficulty with the Mega Bezel because it needs so many parameters, so much so that I’ve had to hack off a bunch of parameters from some of the crt shaders & other shaders in the chain.

I like this option, having less presets is better, the difficulty is fitting in the on/off parameters, but it may still be worth it.

2 Likes

Hi I’m not sure I understand what you mean, do you mean the reflection fading onto the screen itself, basically a blur of the actual edge of the screen between the screen and the bezel area?

I’ll have to check these out I haven’t tried them before.

1 Like

Hi,

I am really sorry for my disastrous English I use a corrector.

If I understand correctly,

The reflection shader

  • 1 copy of the game image
  • 2 adds blur

These are the two parameters related to my idea. If I look at the Zombshader shaders or those of the Analog ShaderPack3 (still available on this forum), they are mainly composed in the first passes of blur9 or blur10. (The famous blur that created problems with AMD / ATI cards if I remember correctly).

If you have managed to add blur to Guest, Easymode or the other shaders in your pack, it is possible to add some for the main screen (that of the game).

This addition could have a rendering similar to that offered by zombshader or certain shaders of the AnalogShaderPack, with perhaps a blurring adjustment.

It’s an idea, I’m not sure how it would be visually if it were possible.

I may be wrong but during my youth, I played a lot on arcade cabinet (Street Fighter II, Mortal Kombat 1, Virtua Racing mainly and some NeoGeo games), I do not remember scanlines and I was very close to the 'screen.

My memory would be rather visually something between Guest and Zombshader, in any case your reflection with the TV frame and for me fantastic for the memory.

I have a Sony Trinitron European 100HZ (100hz can not be deactivated) with just a scart not VGA so I do not see scanlines, the image is disgusting for me … I much prefer my little VHS / CRT Samsung combo 36cm, it has no scan lines (or I can’t see them, even a few centimeters).

It is this memory that I have of arcade screens and in any case of TV on which I played Genesis or Snes Games.

I never had a Trinitron or PVM / BVM during my childhood, I have a CRT 19 "iiyama, I connected a Retroarch 15khz crtswitch the image does not make me dream.

I’m sorry for this long novel I hope you understand the essentials

Thank you

1 Like

I decided to make a glass border preset, It’s not done quite yet, but Here are some screenshots as a sneak peak!

Coming Soon :wink:

11 Likes

Im already using your other pack for all my games with the carbon background. This new iteration with the glass border is exactly what i had in mind to modernize in a retro way (if that makes sense) older games. This will look stunning in 4k. Nice work and looking forward to this release.

2 Likes

yay! Thank you :partying_face:

It looks amazing!

Not a lot of action on those game title screens next to the bezel, so not a lot of reflection.

I have been tweaking my script and I have it whittled down from 7 steps that, in addition sometimes called external batch files, to 5 steps that do the calls internally. I have been reading up on piping standard input and output and using the gnuwin version of sed. Before long I’ll probably have this at a point where I can share it. :grin:

HyperspaceMadness

1d

Hi, this is almost certainly because it has its own parameters. The shader system has a max number of parameters, and the Mega Bezel Shader with GTU is at the limit already (GTU adds 3 parameters), so if any shader you add has its own parameters it goes over the limit and won’t compile. This is a considerable difficulty with the Mega Bezel because it needs so many parameters, so much so that I’ve had to hack off a bunch of parameters from some of the crt shaders & other shaders in the chain.

Yes, that’s it! With @Syh’s help I managed to add mame_distortion.slang (mainly for the vignetting feature that I didn’t find anywhere else) to your preset by using static parameters. And it works, kind of. But I have some weird effect, as you can see: (must have something to do with the viewport and wrong scaling; it works perfectly as standalone, btw.)

Any chance to get this corrected? Or do you maybe plan to integrate some other kind of vignetting into your preset? This would be great for my old style 70s/80s TV overlays :grin:

PS: looking forward to test your very cool glass border preset!

1 Like

Hi, yes I think adding vignetting into the mega-bezel is the way to go, I’ve currently pulled out the vignette from the mame_hlsl, so it should actually work as you expect.

3 Likes

@HyperspaceMadness

Already did the thing it works fine, but I have an alternative suggestion for the vignette code besides mame’s if you’re interested I’ll PM you.

2 Likes

I believe I have my batch scripts to a point where I am willing to share them.

Any “hacks” I was using to make up for lack of skill on my part have been removed and replaced with code I am not so ashamed of.

I am going to spend some time commenting the scripts so anyone wishing to examine/improve them can understand at least what I was thinking when I wrote it.

Once the commenting is done I will upload it to my google drive and share the link. I won’t include any executables but will include instruction that also contain links to the software. All the software I use is either free or open source.

On my last test run I don’t believe there were any errors so I think I managed to squash any bugs. (I had some problems with HSV values where H was 0, (Solved by manually scanning for it and replacing it with 0.5 so there will be an insignificant difference in the color) and also files with exclamation points in their names. (Had to come up with code that didn’t use delayed expansion.)

Look for it soon. :grin:

3 Likes

Little update on this. Turns out that the image histogram wasn’t sorting the 5 colors at all so there was some randomness to the colors. This resulted in a lot more off-grays than I think would be desirable. I found a different way to export the histogram that was more efficient and then found a way to sort it. Comments now clearly say how to change the color from most prominent to least. I ended up choosing the second from the least color used. I am also planning on releasing the system art I have been showing, tailored to match thebezelproject art. The intention is to use my graphic as the placeholder.png referenced in the script. This way if by chance the end user has a ROM that thebezelproject doesn’t have a match for, there will still be custom art.

Comparing this to the Castlevania shot above shows an example an off-gray that replaced a more colorful bezel when the least common color was accurately selected.

This and the next two are results of the second to least common color being used.

An example of a placeholder default graphic.

Alternatively, thebezelproject downloader also downloads default art. Opinions on whether I should include my own are welcome.

4 Likes

Hey @lilbud could you post your settings? I’m trying to get my reflection looking similar to that but I’m having some issues.

HyperspaceMadness, any chance in the next update to add a default value at the end of each parameter when altering the shader?. I notice some of them have a default value so you can change stuff back if it looks wrong but not all values show the default value??

3 Likes

I love it ! I still think a blurred image of the game would be a nice effect to have when the Retroarch menu is displayed, it would make the menu text “pop” better !