Questions tagged [fragment-shader]
53 questions
12
votes
1 answer
Using a LUT to speed up a trig heavy shader for mobile devices
I am trying to get this shader to run on a really old iDevice, as well as eventually Androids.
Even when I reduce the code down to 2 sine functions per fragment the shader runs at about 20fps.
I have considered taking a leaf out of the book of old…
J.Doe
- 1,445
- 11
- 22
12
votes
1 answer
Why is accessing textures much slower when calculating the texture coordinate in the fragment shader?
When using textures in GLSL, it is best to calculate the final texture coordinates in the vertex shader and hand them over to the fragment shader using varyings. Example with a simple flip in the y coordinate:
// Vertex shader
attribute vec2…
Nero
- 1,310
- 3
- 15
- 31
9
votes
1 answer
Performance of Compute Shaders vs. Fragment Shaders for Deferred Rendering
I have written a deferred renderer that can use either a fragment shader or a compute shader to execute the shading pass. Unfortunately, the compute shader implementation runs slower. I'm trying to understand why.
I believe I understand the…
imallett
- 1,870
- 10
- 23
7
votes
1 answer
How to match Blenders polynomial lens distortion model with GLSL?
I'm trying to re-implement Blenders (libmv) polynomial lens distortion model using shadertoy, in order to apply the lens distortion in another application ideally by generating a STMap for that. I think I'm close, but when passing the same values…
brockmann
- 71
- 4
7
votes
1 answer
Ray tracing - partial derivatives for texture lookup
I'm doing some ray tracing on GPU using a fragment shader...
How can I calculate texture coordinates partial derivatives with respect to screen coordinates so I could perform filtered texture lookup with textureGrad GLSL function?
Do I need to use…
zduny
- 377
- 2
- 6
6
votes
2 answers
Advice on how to create GLSL 2D soft smoke/cloud shader
I want to recreate this smoke/cloud effect which is used in the Arrival (2016) movie end credits.
I uploaded a sped up version of the credits to see the smoke dynamics.
http://streamable.com/n3309 49s x6 sped up video of the credits
I know how…
Simon Kirsten
- 163
- 1
- 4
6
votes
0 answers
OpenGL texelFetch causes black stripes
THE SHORT VERSION
In my fragment shader I'm reading (using texelFetch) multiple times the same texel from a texture (created by another fragment shader) and write it to the output render buffer. After a few read operations on the texel a fault…
Christian_B
- 313
- 1
- 7
6
votes
2 answers
In a shader, how to store fragment coordinates in a spatial partitioning from one pass to the next?
I have a post-effect camera-shader in which I want to implement a simple spatial partitioning of the screen between two passes of the fragment shader.
The first pass should divide the screen into cells of size = 30x30 pixels, and then for each green…
blipblop
- 83
- 4
5
votes
1 answer
Manually fetching 8 neighboring texels from 3D texture greatly decreases performance
I'm implementing manual interpolation between texels in a 3D texture to be able to discard some of them when needed. Compared to hardware interpolation, this process takes a lot of time. If I simply leverage hardware interpolation using texture…
Pavlo Muratov
- 243
- 1
- 10
5
votes
1 answer
Fragment shader's output variables
EDIT: This is a duplicate of a question from stack overflow:
https://stackoverflow.com/questions/9222217/how-does-the-fragment-shader-know-what-variable-to-use-for-the-color-of-a-pixel
If you want to send a value from vertex shader to fragment…
Adrian
- 627
- 8
- 16
5
votes
2 answers
Will the gaussian kernels in this fragment shader be computed for every fragment?
I am running this fragment shader on every pixel on screen. I am trying to make it as efficient as possible. BTW I am running open gl es 2.0.
The code segment below is only a sample from the code, there are about 56 different calls to Gaussian()…
J.Doe
- 1,445
- 11
- 22
4
votes
1 answer
Z buffer working in OpenGL
After Z-Buffer Testing does the fragment shader run on the discarded fragments?
Does the Z-Test happen after the fragment shader runs?
Please, tell me the step by step events that occur in the Z-Test.
Also what is early Z-Test and how to achieve it?
VersesDev
- 99
- 4
4
votes
1 answer
How to correctly implement Lambertian BRDF with point light
I'm implementing a simple Lamberitan BRDF in GLSL, using a point light source. My fragment shader simply returns light_colour * 1.0/PI * cosine, which should model a fully diffuse white material.
However, it looks rather dark... If I have a point…
Supernormal
- 480
- 2
- 9
4
votes
1 answer
Shader won't work
I have managed to implement a garoud shader with specular lighting efects in Processing 3.0 . Now I am trying with a fragment Phong shader but cannot make it work. I can´t find where is the error. It should just implent the phong illumination model,…
eneko
- 185
- 3
3
votes
1 answer
Interpolation in Graphics Pipeline
I am trying to program my own version of WEBGL graphics pipeline in python, however, I am confused as to where the color interpolation takes place in the pipeline. According to my research, it happens after the rasterizer has calculated the points…
Anisa
- 41
- 2