The code above is supposed to pixelate the visuals. Resolution is a vector 2 that changes how many pixels it makes.
I see online that you return resultant * colour, but because resultant is always white it will always just return the original colour. Resultant itself is always 1,1,1,1. Can my shader not check the colour on love.draw (using graphics.setcolor)? If not, how can I colour my program so the shader can change it?
It's late and i might be wrong, but this is how i see it:
The resolution variable storing how many pixels you want to simulate in width and height is not how that works;
if resolution is {1,1}, then you'll get width x height pixels,
if resolution is {2,2}, then you'll get (width/2) x (height/2) pixels,
and so on.
I'm guessing you're passing in such a large pair of numbers to resolution, that you're basically only sampling one pixel, which happens to be fully white.
You could potentially fix this by passing in {actualwidthinpixels/wantedwidthinpixels, actualheightinpixels/wantedheightinpixels} instead.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
zorg wrote: ↑Mon Oct 03, 2022 8:31 pm
Hi and welcome to the forums!
It's late and i might be wrong, but this is how i see it:
The resolution variable storing how many pixels you want to simulate in width and height is not how that works;
if resolution is {1,1}, then you'll get width x height pixels,
if resolution is {2,2}, then you'll get (width/2) x (height/2) pixels,
and so on.
I'm guessing you're passing in such a large pair of numbers to resolution, that you're basically only sampling one pixel, which happens to be fully white.
You could potentially fix this by passing in {actualwidthinpixels/wantedwidthinpixels, actualheightinpixels/wantedheightinpixels} instead.
Hello!
By instead returning the colour of the position (not the colour of the pixel), you can see where each pixel is supposed to go (and it looks pretty cool aswell ).
The higher the vec2 resolution is, the larger the pixels (not the other way that I thought would be amount of pixels onscreen, thank you!!). Knowing this, I can see exactly what pixel that I should be copying for each square (the upper left corner of each square), but still the Texel() function will always return white. Am I using the wrong function to get the colour of a pixel on screen?
Thank you for the help so far!
If you want to make whole game look pixelated, you can just draw everything to smaller canvas than window and then upscale the canvas with nearest filter (with love.graphics.setDefaultFilter or set filter just to canvas) and draw it to full window
Note that Texel() expects normalized coordinates which texture_coords is, but screen_coords is in pixels. If resolution is in pixels then both floor(texture_coords/resolution) and floor(screen_coords/resolution) will round to 0 most of the time, so you're sampling the same pixel.