I have a pixel shader which is quite dark and when i set white circles which go from white to black the transition goes in steps instead smoothly pixel by pixel, it goes like this image, and i want a smooth transition. It is specially annoying when trying to make a light and the circle goes in steps making the shader really ugly at dark tones.
How are you setting the white circles? You’re not very clear about what you’re doing…
If i set a specific pixel as center in world position which is white, and goes from white to black depending on how far is from that center pixel. I expected the transition would be smooth doing it in the fragment method but it goes from white to black in steps like the image i showed
Just thinking out loud: I do not think that normal monitor can display a smooth gradient from black to white. Try to draw on the top of the image not strong high-frequency noise: the step will not disappear, but become imperceptible.
Dont know what you mean with “high-frequency noise not strong”
Sorry for my english. Here I just added “NoiseEffectGrain” from image effect on top of surface color.
You mean blending a noise texture in the shader so that the steps are not so obvious?
Yes it what i mean. But maybe more efficient way to do that is using post effect or draw GL quad with additive material on it.
With post effect, you mean getting a rendertexture, put it as maintexture of a material and make it darker? That would prevent the steps? Cause i have scenes that look great at daylight but look horrible at night time, because the gradient steps, i want the same quality but at night.
The GL Quad, dont know how to do it.
Try “ScreenOverlay” from standard image effects, you need add some tweaks to the shader and script to be able change texture scale.
It’s called dithering.
But I don’t think that’s your issue. Post up your shader code so we can see what you’re doing.
Yes, dont think dithering solves the issue, i will try with post effects and noise, i think that is the best option.