Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Weeeird.  I wish I had a picture of your sprite without influence from the shader so I could get a better idea of how things are changing.  

You clearly know this because since you knew setting the output(gl_FragColor) to what you sampled would effectively disable any shader effects, but for everyone else: texture2d() is a function that returns a pixel(the color) at a given coordinate (uv) from a supplied texture, or tex0 as it's called in RenPy.   

vec4 color = texture2d(tex0,uv) in this case would be the pixel color information from the source texture/image.

Shaders would then typically operate on, or using, this information to eventually assign it to the output, gl_FragColor.  So in testing: 

vec4 color = texture2D(tex0, uv);
gl_FragColor = color;

and still came up with artifacts is odd.   I had spoken to Fen (go check them out btw they're awesome) and I recall something about v_tex_coord needing to be set to a_tex_coord in the Vertex shader-- I might be misremembering the details but if you're still getting those weird artifacts on your outputs when setting the input to the output (almost) directly, then we can really only assume that either the source texture or the coordinates are the problem.

I don't have it right in front of me at the moment, but if you're still toying with it and are familiar with it, it might be worth adding 

v_tex_coord = a_tex_coord;

into the vertex shader and trying again.  I'm about 80% sure I'm using v_tex_coord as UV, which feels like the most likely culprit.  

If you're able to try and confirm it, I can add a correction into the pack pretty quick to prevent anyone else from running into the problem.  Otherwise I'll see if I can reproduce and fix it when I have time.  I'm currently drowning in VN dev, several new packs, Spooktober Jam scouting and prep, and a half dozen IRL things so I don't know when exactly I'll get to it.

(21 edits)

It's okay, don't rush it, I found a solution for me (mentioned in the edit above, setting color to gl_FragColor). Thanks for your response.
Here is the sprite link, though, as it turned out it doesn't matter really.

I've made a sample project to show it off link. I did it here with a standart sprite from "The Question", which is 500x700, so resolution isn't the problem, I guess.

And sadly no, setting v_tex_coord to a_tex_coord doesn't help. Really, it seems like a problem with renpy? I will open an issue on github some days later if we will not figure out the cause.

I also thought that it maybe show like that only when redacting the game project, but no, it is the same when the game is build, so it is either a problem with the shader (somehow?), renpy or my gpu (probably not, but would be nice to know if it's the same on your pc, there's always a chance, it is AMD by the way).

Update: just asked my friend has an Nvidia 1060 and it looks okay on his pc, I have an RX 6600 and it looks blurry...

Update2: opened an issue on Github link

(2 edits)

Hi again! I was able to fix this issue with help from github (the issue).

Turns out, on some gpus the bias in texture2D defaults to a bad value. You would need to add u_lod_bias

uniform float u_lod_bias;

to the variables and to the texture2D function:

texture2D(tex0, v_tex_coord,u_lod_bias);

Nice.  I'll see about working that into an update on the pack.  I appreciate it!