It was like that in the first place, didn’t change the order.
Do you really believe that everyone who trains for thousands of hours is capable of becoming a Ronaldo, a Messi, or a Michael Jordan? Intensive reading and study do not, by any means, guarantee an extraordinary result.
yes, i’m confusing the sequence is right…i’ll try this afternoom Your fixes. And give You a feedback. Again thank’You.
Do you really believe I’ll open a debate with you about it? What’s your (you, not AI) experience on the matter to give any advice? Right, none.
Absence of errors requires someone to be able to spot and fix them, and they can manifest later on, that’s part of long term support.
Science is based on observation, but requires “enough” experiments to verify the hypotesis that come from the observation itself.
I envy your skill to completely skip the second step and still being able to produce correct result, but usually, normal persons are not that good, and they need to learn the basis first.
Chances are high you are just wasting time by querying LLMs, as they would just give you something that already exists, again, “by design”.
Related to the revious point, I can speak for myself here, so I’ll do.
LLMs has been trained on other coder’s work; and as a coder, I would not feel comfortable knowing my code, released under a specific license, could be used to train LLMs.
Yes, it is a gray area, so pick this as my personal opinion.
Also, I value human and human derivative work made by humans. The less it is, the less the wow effect it gives to me.
“LLMs” did it? Okay, it works, let’s hope it will forever and nobody with deeper knowledge will need to step in to fix it if a bug will emerge.
“You” created it? Hats off! I’d use it with greater joy and it will be even be backed by proper support.
The more we comform, the less we innovate.
My point of view is that everyone can train himself in unexplored ways to become an innovator, maybe not the greater scorer, but it may pose the basis for new ways to score.
See Einstein, he was not happy about the way school used to teach notions, so it mostly studied by himself.
Btw, we’re polluting someone else thread, I just expressed my personal opinions and got yours.
That’s like i am a fan on a stadium shouting to players don’t train, why do you run, you’ll never be a Ronaldo, MJ is out of your level.
They’ll probably beat my ass and get arrested on the spot lmao. I mean who am i to try to break their mentality, it’s a serious offence to the sport too.
It’s…a little off topic, but these are all valid discussions given the different approaches used. In one way or another, they’re all valid points.
@DariusG, I tried your new setup and I have to say I really like it. However, I noticed that in vertical games the mask calculation is compressed. Just like in Dreamcast games, the mask seems to be very misaligned.
It seems like the shader takes the output resolution and divides it by 3. With vertical games, this causes the mask that follows this logic to compress too much.
You might be running into an optical illusion. Scrolling direction can sometimes make scanlines and mask effects seem to “disappear” or otherwise distort, but in static shots it still looks proper.
Re: AI, I use it to help with programming quite a bit. I haven’t had good luck with it in shader programming, since it can’t see the output and often gives weird results (like the deconvergence thing), so I spend more time doing what DariusG has been doing than actually creating.
The AI explanations of what’s happening in shaders is always funny to me because it sounds like this guy: https://www.youtube.com/watch?v=Ac7G7xOG2Ag
Since it uses gl_Fragcoord.xy it will pick a pixel on screen, so there is no compression. But it could compress scanlines.
Edit: ok i think you are right, in vertical games it still uses gl_FragCoord.x while it should use y. Need to tie it with vTexCoord so it rotates too.
/*
CRT - Clean Subpixel RGB/BGR Mask with Arcade Scanlines
*/
#pragma parameter BOGUS_DOTMASK "--------- CRT SCANLINES & SUBPIXEL MASK ---------" 0.0 0.0 0.0 0.0
// SCANLINE CONTROLS
#pragma parameter SCAN_LOW "Scanline Intensity (Dark Scenes)" 0.8 0.0 1.0 0.05
#pragma parameter SCAN_HIGH "Scanline Intensity (Bright Scenes)" 0.3 0.0 1.0 0.05
// MASK CONTROLS
#pragma parameter DOTMASK_STRENGTH "Mask Strength" 0.3 0.0 1.0 0.05
#pragma parameter MASK_LIGHT "Mask Light" 1.50 0.0 3.0 0.05
#pragma parameter MASK_DARK "Mask Dark" 0.50 0.0 3.0 0.05
#pragma parameter SUBPIXEL_LAYOUT "Subpixel Layout (0=RGB, 1=BGR)" 0.0 0.0 1.0 1.0
#if defined(VERTEX)
#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec2 ogl2pos;
COMPAT_VARYING vec2 mpos;
uniform mat4 MVPMatrix;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
void main()
{
gl_Position = MVPMatrix * VertexCoord;
COL0 = COLOR;
TEX0.xy = TexCoord.xy;
ogl2pos = TEX0.xy*TextureSize.xy;
mpos = TEX0.xy*OutputSize.xy*TextureSize.xy/InputSize.xy;
}
#elif defined(FRAGMENT)
#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
uniform sampler2D Texture;
COMPAT_VARYING vec4 TEX0;
COMPAT_VARYING vec2 ogl2pos;
COMPAT_VARYING vec2 mpos;
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define tau 6.283185307179586
#ifdef PARAMETER_UNIFORM
uniform COMPAT_PRECISION float SCAN_LOW;
uniform COMPAT_PRECISION float SCAN_HIGH;
uniform COMPAT_PRECISION float DOTMASK_STRENGTH;
uniform COMPAT_PRECISION float MASK_LIGHT;
uniform COMPAT_PRECISION float MASK_DARK;
uniform COMPAT_PRECISION float SUBPIXEL_LAYOUT;
#else
#define SCAN_LOW 0.8
#define SCAN_HIGH 0.3
#define MASK_LIGHT 1.5
#define MASK_DARK 0.5
#define DOTMASK_STRENGTH 0.3
#define SUBPIXEL_LAYOUT 0.0
#endif
vec3 SimpleSubpixelMask(vec2 fragCoord) {
vec3 mask = vec3(MASK_DARK);
// Cycle every 3 screen pixels horizontally
float pos_x = fract(fragCoord.x * 0.333333333);
if (SUBPIXEL_LAYOUT > 0.5) {
// BGR Layout
if (pos_x < 0.3333) mask.b = MASK_LIGHT;
else if (pos_x < 0.6666) mask.g = MASK_LIGHT;
else mask.r = MASK_LIGHT;
} else {
// RGB Layout
if (pos_x < 0.3333) mask.r = MASK_LIGHT;
else if (pos_x < 0.6666) mask.g = MASK_LIGHT;
else mask.b = MASK_LIGHT;
}
return mask;
}
void main()
{
float near = floor(ogl2pos.y)+0.5;
float f = ogl2pos.y - near;
float y = (near + 4.0*f*f*f)/TextureSize.y;
vec2 pos = vec2(vTexCoord.x, y);
vec3 pixelColor = texture(Source, pos).rgb;
float lum = dot(vec3(0.3),pixelColor);
// --- ARCADE SCANLINE CALCULATION ---
float l = max(max(pixelColor.r, pixelColor.g), pixelColor.b);
float infl = mix(SCAN_LOW, SCAN_HIGH, l);
float scan = infl * sin((vTexCoord.y * TextureSize.y-0.25) * tau);
vec3 scanlineColor = pixelColor + (pixelColor * scan);
// --- CLEAN SUBPIXEL RGB/BGR MASK ---
vec3 maskStructure = SimpleSubpixelMask(mpos.xy);
vec3 finalMask = mix(vec3(1.0), maskStructure, mix(DOTMASK_STRENGTH*2.0, DOTMASK_STRENGTH, lum));
// Combine scanlines and mask
vec3 finalColor = scanlineColor * finalMask;
FragColor = vec4(finalColor, 1.0);
}
#endif
@DariusG, like this shader very much. core provided scaling, and no biliear filtering…right? only a few problem with Dreamcast, but i hope i can solve… Thank’s nice shader!
Of the negative effects LLMs have, I feel like this one is among the most destructive. I keep hearing people parroting a variation of it all the time. This idea that if learning a skill doesn’t make you the best in the world, the’re no point. It completely dismisses the facts that 1) learning how to learn is in itself the most valuable skill you can have, 2) skills can transfer laterally across disciplines, so you’re generally more equipped to learn other skills in the future, and 3) when you’re doing creative or physical exercises, you can set your own bar and find the process to get there rewarding and worthwhile.
I know the LLM genie’s not going back into the bottle, but I do hope people still see the value of learning new skills. This thread had a rough start, but it’s nice to see people coming together to teach each other new things and people being receptive to learning.
True, the discussion didn’t start the way I’d hoped. Perhaps a moment of pride or misunderstanding on my part. In any case, if we’re in the Libretro shader forum, it’s because we’re all passionate about it, deep down. Today @DariusG ave us an excellent scanlines engine. I thank him and ask him if I can use it in place of my “old” dotmask. Complementarity is perhaps the only way to work together.
Sure you can, that’s why i did it
Tomorrow (here is night now) i will re-publish the topic. maybe rewriting the whole description, in the most correct way. The screenshots that come out now are very good.
Actually, it looks like it requires bilinear filtering set in the .glslp file.
The way the heavyweight shaders do filtering is to read lots of nearby pixels (using lots of texture reads) and then combine them using lots of complicated maths. The alternative is to do a single texture read and rely on the hardware bilinear filtering to combine the four nearest pixels - which is fast but looks blurry. The crt-pi shader introduced a technique that uses a single texture read but looks better than the normal hardware bilinear filtering. The trick is to alter the texture coordinates a bit before doing the read. This idea has since been since been implemented in many other shaders.
Look at this code from @DariusG’s shader before it does the texture read:
void main()
{
float near = floor(ogl2pos.y)+0.5;
float f = ogl2pos.y - near;
float y = (near + 4.0*f*f*f)/TextureSize.y;
vec2 pos = vec2(vTexCoord.x, y);
vec3 pixelColor = texture(Source, pos).rgb;
Try and work out what it does to the y coordinate before the last line. How will this alter what the output looks like?
As for using LLMs to write code, ignoring their heavy resource (electricity, water, etc.) usage, they are a tools just like any other. As with other tools, you have to understand the tool and its limitations before you can use it effectively. One piece of advice I would give about them is that they do not understand things - they are just statistically driven copy and paste engines. They will hallucinate and describe things that are plainly untrue. You need to be constantly wary of this.
We tell the gpu, snap in center of an emulated SNES (or else) pixel (that floor in ogl2pos that was transferred to vertex, to be calculated 4 times instead of around 1.400.000 times in fragment in 4 : 3 games on 1080p monitor, fragment will do all calculations for each screen pixel). Then find our position 0.5 top and bottom of if (f). Then instead of grab 4 positions to bilinear filter at the edges of pixel, shrink the distance with f * f * f, that 0.5 max distance multiplied three times will do 0.125. so we multiply by 4 to cover the max 0.5 and filter the whole emulated pixel. This is called “smoother step”, self describing what’s going on. We could do another f * f, end up with 0.03 then multiply by 16 or something and be extremely sharp but not like a CRT then.
We keep vTexCoord.x for Horizontal axis as most CRTs were blurrier in X.
These are great technical discussions, really… it’s a shame I don’t understand anything about them right now. @DariusG, unfortunately I don’t have permission to edit the original thread because I wanted to redo it, obviously giving you credit. Now at this point, I don’t know whether to continue writing below or start a new thread. I’ll have time to do that in a few hours… Any Your advice…
You can join #programming-shaders on libretro discord channel too and ask for anything you are interested 
Also interesting reads, it also comes in different languages:
Thank’You , very interesting guide…