Questions tagged [fragment-shader]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 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 ...
zachThePerson's user avatar
1 vote
0 answers
31 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 ...
Simon's user avatar
  • 163
0 votes
1 answer
46 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,...
simd's user avatar
  • 105
0 votes
1 answer
97 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 ...
simd's user avatar
  • 105
1 vote
1 answer
56 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? ...
junglie85's user avatar
  • 125
0 votes
0 answers
28 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 ...
idchlife's user avatar
  • 373
0 votes
2 answers
126 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 ...
user20154's user avatar
1 vote
0 answers
23 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 ...
Michael Kolesidis's user avatar
1 vote
1 answer
236 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 ...
Shiv-iwnl's user avatar
1 vote
0 answers
151 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 ...
Jonas's user avatar
  • 31
2 votes
1 answer
375 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 ...
Thomas's user avatar
  • 1,136
1 vote
2 answers
609 views

Anti-Aliasing simple circle fragment shader

Have a fragment shader: ...
Hello Humans's user avatar
0 votes
2 answers
139 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 ...
polyclick's user avatar
  • 103
1 vote
2 answers
1k 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 ...
Paweł Pomierski's user avatar
0 votes
0 answers
102 views

Examples of cases where you write depth value in Fragment Shader?

I've very less knowledge when it comes to rasterization and typical rendering in games and other applications. So I was reading up on the rendering pipeline and found that the hardware could do early ...
gallickgunner's user avatar
0 votes
1 answer
98 views

Level of detail passed from vertex shader to fragment shader

I am looking at a sample code from a respected source and the mipmap level-of-detail parameter (float) is passed to the vertex shader as a uniform which then passes to the fragment shader without ...
Vectorizer's user avatar
1 vote
1 answer
57 views

Is fragment shader run on fragments that are outside of rasterized geometry?

In deferred rendering, I first write world position to G-Buffer, and then in shading part, I want to use that information to reproject in the previous frame and then write the final color. However, ...
Toothery's user avatar
0 votes
1 answer
874 views

gl_ClipDistance vs gl_CullDistance

Why are there very similar yet distinct arrays: gl_ClipDistance[] vs gl_CullDistance[]? What would be some use cases where the ...
Vectorizer's user avatar
0 votes
1 answer
511 views

Can I write histogram equalization, blurring, sharpening grayscale image etc.. as shader programs with openGL?

...
Meganathan's user avatar
1 vote
1 answer
3k views

Understanding fragment shader coordinate system

I'm trying to create an infinitely panable grid using fragment shaders (C++/OpenGL/GLSL), and I'm having a bit of difficulty understanding the coordinate system. This is my fragment shader code, ...
Andrew Woo's user avatar
0 votes
1 answer
2k views

What is the most efficient line algorithm using a shader program

I'm new to shaders and I have been experimenting with them in shadertoy. I'm trying to get a deeper understanding of the graphics pipeline and I want to implement some features using shaders. I want ...
Joshua Pasa's user avatar
0 votes
0 answers
23 views

Rendering different array types in the same vertex/fragment shader?

I have a pretty basic widget rendering, largely based upon the learnopengl.com "hello triangle." I'm actually using a tristrip to create two triangles, forming a semi-opaque square over the ...
Sniggerfardimungus's user avatar
1 vote
1 answer
89 views

How to pass only the needed portion of the data calculated in a fragment shader to another fragment shader?

I have an image and I want to draw an arbitrary number of objects on that image. The center coordinates of those objects are calculated inside a fragment shader after series of image processing ...
M. Samil Atesoglu's user avatar
1 vote
0 answers
322 views

How could I remove this colour interpolation artefact across a quad?

I've been reading up on a vulkan tutorial online, here: https://vulkan-tutorial.com. This question should apply to any 3D rendering API however. In this lesson https://vulkan-tutorial.com/...
FShrike's user avatar
  • 205
0 votes
0 answers
89 views

GPU accelerated 2D graphics library with signed distance functions

I want to create my own 2D graphics library using signed distance functions where everything is drawn on the GPU. Browsing the web I quickly found Inigo Quilez website that describes how to draw basic ...
Nils's user avatar
  • 101
10 votes
1 answer
7k views

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 ...
geometrian's user avatar
  • 1,950
1 vote
1 answer
145 views

Help me understand the voronoi shader

I am trying to understand the voronoi shader implemented in the Book of Shaders in the Tiling and iteration section: https://thebookofshaders.com/12/ Specifically how do these lines calculate the ...
raheel's user avatar
  • 113
3 votes
1 answer
872 views

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 ...
Anisa's user avatar
  • 41
3 votes
1 answer
1k views

SDF rendering for large world

There are lots of cool things you can do with SDFs to render implicit surfaces. Most of the examples I've seen have been “all in the shader”, where the entire distance function is encoded in the ...
jwd's user avatar
  • 133
2 votes
0 answers
304 views

Calculate the distance between two 3d points in screen coordinates

Given the Point A with the coordinates gl_FragCoord.xy, I have to find the distance to the Center of the cube face to which it belongs in screen coordinates. ...
keepyourweb's user avatar
4 votes
1 answer
2k views

gl_FragCoord and glViewport

I've been scanning the specifications for both OpenGL and GLSL, and I can't find a definitive answer as to how exactly are gl_FragCoord's ...
IneQuation's user avatar
1 vote
0 answers
63 views

Anti aliasing thin features in textures

Assume I have a texture with a repeating line pattern. The lines are exactly 2 texels wide (really thin). Ans very spaced out (50 texels in between each line). I am now struggling with the ...
Makogan's user avatar
  • 1,696
3 votes
0 answers
84 views

Trying to optimize texture mapping

We are developing a PPI plot for a radar system, similar to the following: NOTE: 1 radial is defined as a single slice of data within the circle, and 1 range gate is defined as a single point along a ...
Matthew Herndon's user avatar
2 votes
0 answers
81 views

Show the edges between the clipping plane and clipped objects [closed]

I want to utilize shaders to not only discard fragments if they are on one side of a predefined plane but also render a contour along the intersection. My fragment shader currently does something ...
graphics_guy's user avatar
2 votes
1 answer
279 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: ...
The Dreams Wind's user avatar
1 vote
2 answers
749 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/...
Trevor Black's user avatar
7 votes
1 answer
650 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 ...
brockmann's user avatar
1 vote
0 answers
154 views

Veldrid: Only execute fragment shader

Having an HLSL shader like this: ...
Tau's user avatar
  • 121
1 vote
1 answer
788 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 ...
remi000's user avatar
  • 240
5 votes
1 answer
2k 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 ...
Pavlo Muratov's user avatar
2 votes
2 answers
111 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. ...
Jhovarie Guiang's user avatar
-2 votes
1 answer
140 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... ...
Jhovarie Guiang's user avatar
1 vote
1 answer
2k 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: ...
recp's user avatar
  • 185
7 votes
1 answer
2k 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 ...
zduny's user avatar
  • 377
2 votes
0 answers
116 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 ...
Dan Hulme's user avatar
  • 6,700
4 votes
1 answer
477 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....
VersesDev's user avatar
  • 119
6 votes
2 answers
6k 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 ...
Simon Kirsten's user avatar
6 votes
1 answer
5k 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 ...
Adrian's user avatar
  • 657
6 votes
0 answers
1k 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. ...
Christian_B's user avatar
3 votes
1 answer
259 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 ...
Blaine Hodge's user avatar