New answers tagged fragment-shader
After much more research I found out what the source of these "gaps" was. They're not really gaps, they're effects of pixel/texture bleeding (I was not aware of this problem). What is texture bleeding? Texture bleeding is the effect of color values of adjacent pixels in the UV-map/texture "bleed over" in your polygon. If using linear filtering it ...
A general outline: Create a depth map of your scene without the shield. You can get this effectively for free, since transparent objects are often rendered in a later pass anyway. Otherwise, you can create the depth map by rendering the scene sans shield onto an RTT with a depth shader. Render your scene normally, pass the depth map to your shield shader. ...
There is, in the fragment shader, a variable called gl_FragCoord. This contains the coordinates of the currently executing fragment shader. Note that (by default) a pixel at pixel coordinates (x,y) will have gl_FragCoordinates of (x+0.5,y+0.5)
Not too sure what you mean, but you can get the current pixel coordinate in the fragment shader by using gl_FragCoord! This is considerably easier than interpolation, as mentioned in the other answer. Here are more details: https://www.opengl.org/sdk/docs/man/html/gl_FragCoord.xhtml
you can attach u and v coordinates for each vertex and then fragment shader interpolates those u and v coordinates for each pixel. UV coordinates are used to calculate where to sample from textures but they can be also used directly for math.
I don't know which Engine, if any, you are using. Or which language you are working with. Still, most of what you can find online is not hard to port from one environment to the other to achieve what you are looking for. And there certainly is material online that can be of help to you. See this discussion related to Unity: ...
It's just using the depth map. It renders the world then renders the shield and takes a difference between the shield's rendered z value and the depth buffer z value to tint the pixel more white.
As more I think about this I found it is always necessary to use texture filtering to avoid texture artifacts. It is because rasterized image which will be textured in fragment shader can have different size of pixels than pixel (texels) in texture.
This is a pixelation shader, it seems. What it does is, it divides the screen into tiny rectangles, the side of each rectangle is determined by the values dx and dy. The smaller the value of Pixels, the more pixelated the screan is, as that increases the size of dx and dy and thus the size of the rectangles. The shader, after deciding the dimensions of the ...
Top 50 recent answers are included