Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [fragment-shader]

The tag has no usage guidance.

2
votes
1answer
40 views

Alpha component in color buffer affects RGB components?

I'm looking for a way to make my surface semitransparent, and for now i ended up using this configuration: ...
2
votes
2answers
52 views

Writing data to a shader resource at runtime in DX12

I'm hoping to port my existing toy raytracer to a window so that I can see samples accumulate over time. And then port over to Pixar's pmj02: https://graphics.pixar.com/library/...
1
vote
1answer
127 views

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 ...
1
vote
0answers
56 views

Veldrid: Only execute fragment shader

Having an HLSL shader like this: ...
1
vote
1answer
149 views

Curve rotation in GLSL fragment shader

I'm trying to figure out the correct math to rotate and translate a curve displayed in a fragment shader. What I try to accomplish is to define a curve, for example a sine curve, in a local ...
4
votes
1answer
200 views

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 ...
2
votes
2answers
89 views

Shader cannot move texture x, y location

Crossposted https://forum.openframeworks.cc/t/shader-cannot-move-texture-x-y-location/29395 Hello I am trying to move the x y location of the texture using this code but it doest not work. ...
-2
votes
1answer
42 views

gaussFactorForOffset cannot call a non-function how to fixed this code?

Crossposted here http://forum.lwjgl.org/index.php?topic=6724 Hello guys I am trying to blur image using fragment shader but it is not smooth.. I search the internet and I found similar problem... ...
1
vote
1answer
300 views

Is it possible to override or disable blending per pixel

I'm rendering transparent objects in separate framebuffer then compositing it with opaque one to get final image. The transparent pass has additive blending: ...
6
votes
1answer
295 views

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 ...
3
votes
0answers
50 views

How can I draw a line whose position is given in UV space and its width in screen space?

In a fragment shader, I need to draw a line at a given value of u. The shader is applied to a planar polygon mesh that's being drawn in the scene with a perspective camera. (It isn't a full-screen ...
4
votes
1answer
241 views

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....
7
votes
2answers
2k views

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 ...
6
votes
1answer
1k views

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 ...
7
votes
0answers
487 views

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. ...
4
votes
1answer
176 views

OpenGL ES Frag Shader - Branching

Working on optimizing a fragment shader which is slowing down my OpenGL ES 2.0 shader based game. This is used with a shadow buffer to determine if the fragment/pixel is inside a shadow volume. The ...
5
votes
2answers
114 views

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, ...
11
votes
1answer
540 views

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 ...
5
votes
1answer
392 views

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 ...
1
vote
1answer
103 views

How to ensure a fragment shader only runs once

I am trying to programmatically figure out how many "texture2d " calls the gpu can make before the fps drops below 60fps. My current way of doing this is to have a fragment shader with a for loop ...
1
vote
1answer
351 views

Why does substracting -1 in shader fail for a float data type?

I am loading a texture in a WebGL fragment shader (GLSL version 1.00). This is my working code: ...
6
votes
2answers
214 views

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 ...
4
votes
1answer
126 views

Count number of green fragments that are within a given distance from each screen fragment

First of all, let me explain what I am really trying to achieve. In a post-effect shader acting on a camera-renderer, I want to change the color of each fragment depending on how many green (RGBA = 0,...
4
votes
1answer
353 views

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 ...
9
votes
1answer
4k views

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. ...