Questions tagged [fragment-shader]
The fragment-shader tag has no usage guidance.
60
questions
3
votes
1
answer
85
views
Why is the z coordinate simply set to 1 for setting up direction of a ray in ray marching
I’ve recently gotten into shader art , using sites like shadertoy and various tutorials for getting started.
One thing I noticed is that a typical setup involves ray marching whereby:
We set a ...
0
votes
0
answers
59
views
Pixilate/Quantize UV coordinates in world space?
The effect I'm trying to achieve is to have it so that the texture is pixilated/quantized, but the "grid," stays aligned to world coordinates even as the object with it's own UV coordinates ...
1
vote
0
answers
52
views
How are multisample samples partitioned in OpenGL, and at which points does interpolation take place?
As I understand it, with glEnable(GL_MULTISAMPLE), glEnable(GL_SAMPLE_SHADING) and ...
0
votes
1
answer
60
views
Are stencil buffer dimensions required to match render target dimensions?
I may not need as precise pixel-perfect stenciling as my render target during stencil tested render pass. I could be okay with stencil test happening at half or quarter of resolution to save bandwidth,...
1
vote
1
answer
343
views
Is it possible to fill in Stencil Buffer programmatically via fragment shader?
I've never worked with stencil buffers, but I'm researching if it is the right tool for my task.
Basically I don't understand yet if stencil buffer can only be filled in by some hardcoded rules during ...
1
vote
1
answer
77
views
How to avoid declaring sampler outside of statement?
How can I avoid having to declare the sampler outside of the if statement in this shader code sample?
...
0
votes
0
answers
53
views
How to interpolate alpha from CURRENT_ALPHA to TARGET_ALPHA for each pixel in shader language? (Godot/GLSL)
I want to make "trails" of objects on my shader that appear and disappear gradually.
I am getting pixels (for fragment shader) where objects are from uniform texture.
Basically, I have my ...
0
votes
2
answers
226
views
Storing array of floats within shader
I am about to implement a framerate histogramm chart for a DirectX Renderer.
Ideally I would do this in pure shader code, but for a a histogramm I need to store the timestamps of the last ...
1
vote
0
answers
26
views
How can I see the whole shader's text content, with all the prepended code by Three.js, when using ShaderMaterial or RawShaderMaterial (r148)?
I know that Three.js prepends the shader text you provide with some code that includes definitions etc. I am not a big fan of "magic" and I would like to be able to see the final text ...
1
vote
1
answer
319
views
Undo barycentric interpolation
How do I undo the interpolation of vertex attributes? I'm using unity shader graph which doesn't support nointerpolation. I assume I need to store 3 float3 with one component of each float3 being 1 ...
1
vote
0
answers
227
views
What are the main concepts behind building the plasma effect with GSLS?
By the plasma effect I mean an animation that looks like this:
I have seen some codes, like these
https://www.shadertoy.com/view/Xst3zN
https://www.shadertoy.com/view/4tdGWX
and messed with the code ...
2
votes
1
answer
576
views
efficient way to get min/max distance during rendering
I want to improve my shadow mapping depth precision by getting the minimum and maximum depth value within my shadow map. When having both values I would convert the depth map to convolution shadow map ...
2
votes
2
answers
1k
views
Anti-Aliasing simple circle fragment shader
Have a fragment shader:
...
0
votes
2
answers
180
views
Tiling in GLSL creates unwanted seams
I'm writing a shader that creates a grid with coloured tiles. The color is derived from a pixel at that location on a texture. But around the tiles I get these unwanted seams.
I can't seem to figure ...
1
vote
2
answers
2k
views
OpenGL transparency - object behind is not rendered
I'm trying to implement voxel world using OpenGL (Core 3.3). I've come across a problem with transparency. It looks like sometimes GPU decides to not render stuff that would be important. Can you help ...