The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [fragment-shader]

A program that runs on the GPU to determine output colors for pixels. Also known as a fragment shader.

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

Add single color background to texture using shader

I want to add a single color background to my texture. In my case, in Unity UI, I can simply create two Image components, one on top of another, and use the one on the bottom as a single color ...
0
votes
1answer
21 views

How to draw stencil ref value

hi i am currently implementing UI screen that shows Depth Complexity of scene, so that we can figure out how many time each pixels work for same pixels. for this i need to render stencil ref value. ...
0
votes
2answers
98 views

How to decorate the floor with a grid?

I got this photo from mixamo.com — I want to draw grid lines similar to this on my floor. I'm sure this is easy by using textures, but I'm trying to avoid using textures as much as possible. Is there ...
0
votes
0answers
34 views

I need help debugging this Spotlight implementation

I'm hoping someone can help me debug this wacky implementation of a Spotlight done in Java LWJGL that I found online. Basically, I found the bug, but I cannot figure out how to fix it so that the math ...
1
vote
1answer
48 views

Rendering colors from a texcoord output

I'm trying to implement a faster alternative to super-sampling for my isometric 2d monogame game (for when the view is zoomed out). The idea was that I would render the texture coordinates to the ...
3
votes
1answer
77 views

OpenGL Fragment shader: not all fragments showing colors

I'm writing a simple 3D renderer and while the model loads fine, the colors are off. Quite a few fragments in the model show no color at all. Here is the render: The locations of the blacked out ...
1
vote
1answer
92 views

OpenGL Lines between triangles?

I'm currently using marching cubes to generate a mesh, and have encountered this incredibly weird problem. Looking from below the terrain, these weird fully lit lines appear between every triangle. ...
0
votes
1answer
55 views

OpenGL Fragment Shader simulate LCD slow response time

I have a very simple OpenGL view rendering 2 triangles with a single texture applied. The minimum setup for rendering a 2d game. What i do is redraw the texture for every frame and easily get 60fps. ...
0
votes
0answers
32 views

how would I render particle system in a 3D scene in Opengl 3.3

I have a scene that imports .obj (Wavefront) files and I have written the shaders for rendering them in a scene with multiple light sources. Here are my Shaders: Vertex Shader: ...
0
votes
0answers
67 views

Show the edges between the clipping plane and clipped objects

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

Raymarching signed distance function resulting in holes on surface - step size required?

I've been learning about raymarching and signed distance functions, and I implemented a raymarching fragment shader in Unity. It works fine for geometric shapes such as cubes and spheres, but when I ...
0
votes
1answer
54 views

OpenGL Texture Zig-Zag Artifacts Over Time

I'm working on a deferred shading renderer in OpenGL, where I write all geometry output to Colour, Normal and Depth textures and then apply lighting effects later. Everything seems fine except once ...
1
vote
1answer
39 views

How can I make alternate fragments drop (or make them black) based on a checkerboard texture?

How can I make alternate fragments drop(or make them black) based on a checkerboard texture in a Unity fragment shader? I am using forward path rendering in my shader passes for lighting and shadows ...
1
vote
1answer
125 views

Fix Pixel Shader “Stage did not run. No output”

I'm trying to set up a minimal D3D11 renderer but fail to get the pixel shader stage to run. The available answers here or the ones I found through Google couldn't help me, unfortunately. Using ...
1
vote
1answer
90 views

HLSL equivilant to “Object” data from “Texture Coordinate” node in Blender

I mocked up a shader how I wanted it with the node editor in Blender. Now I'm trying to write it in HLSL. In Blender there is a node group called "Texture Coordinate". If I use the "uv" node from the ...
0
votes
1answer
28 views

PostFX2 Custom Effect's Y position has wrong offset ONLY in GAME camera. Scene camera is OK

I implemented raymarching in a full-screen Post FX2 custom effect. Let's say I'm rendering a SDF sphere at world coordinates 0, 0, 0. Everything is fine in the scene camera -- if I rotate the camera ...
0
votes
0answers
107 views

How to stack shaders in Godot?

I have a CanvasLayer singleton that I am using for transition effects between scenes in my game. This CavasLayer contains a ...
1
vote
0answers
135 views

Blinking color shader

Currently i'm using Unity3D, and i want to make one variable blink along time in a fragment shader. Now i have code like this: ...
0
votes
2answers
75 views

Shader vs Working with Pixels

I am working on 2d games only. In that context, when would I ever need to use a shader rather than simply manipulate the pixel-data of an image? For example, I have an image of a car and I want to ...
0
votes
0answers
48 views

Why does this work in the fragment shader but not in the vertex shader?

I'm doing some model view and projection transforms in the vertex shader and I want to determine whether the current vertex will end up on the viewport or not. After searching a bit I found that ...
1
vote
1answer
557 views

My Single Pass Gaussian Blur Looks Awful

I've based my shader on this single pass shadertoy here: https://www.shadertoy.com/view/XdfGDH I applied the same shader and it looks like this: Scaled up so you can see the faint tears in the ...
0
votes
1answer
692 views

Combining several passes in shader in Unity

I am very new to shaders but can't seem to find an answer to my problem. To put it simple I have created a flag shader, which can apply texture, animates and should also react to light. The problem ...
0
votes
1answer
42 views

Combination Lighting Shader?

I am currently working on writing a shader for combination lighting. The idea behind it is to apply directional light, point light, and spot light in a single pass. I believe I can do this by: ...
0
votes
1answer
157 views

HLSL Manual Alpha Blending

I'm trying to do alpha blending manually because I only want to apply alpha blending on certain pixels. Underlying is the texture I'm writing to. This is what I got so far, but it doesn't give the ...
1
vote
0answers
78 views

Artefacts in SSAO Shader

I am having trouble with my Screen Space Ambient Occlusion shader. The objects in the game have the correct occlusion applied to them, however the occlusion flips depending on the angle of the camera:...
0
votes
1answer
90 views

GLSL - Efficient Point inside Box Check

I'm attempting to improve the performance of a shader that changes the colour of a region of the world that is inside a "zone". I am using a deferred lighting system, so the colour and world-space ...
1
vote
1answer
47 views

How to implement multicolored flashing sprite effect like in Contra and the Messenger?

I want to implement an effect similar to what you see in this clip of Contra. When the boss takes damage, he flashes wildly with different colors. A similar effect can be seen in this clip from the ...
1
vote
1answer
124 views

Low fps on Arm Mali GPU

I was trying to google and understand my problem in two weeks but i am defeated, so i am asking for help. The main problem is that my custom unlit frag shader after certain amount of time on devices ...
0
votes
1answer
98 views

How can I write an additive mesh shader that splits the RGB channels while accounting for depth?

I'm trying to create a sort of "hologram" effect. So far, what I have is an additive, three-pass shader that uses ColorMask for each pass to separate the RGB channels. The problem is that doing so ...
1
vote
1answer
165 views

Does texture splatting always sample 4 x N textures per fragment (regardless of the weights)?

Texture splatting - usually - is done by vertex painting, where each channel R-G-B-A is assigned as a different texture weight. Due to the way shaders are executed, doesn't it mean that the fragment ...
1
vote
1answer
74 views

Wrap texels between desired values

I'm using a basic pixel shader here ...
1
vote
1answer
168 views

Does it make sense to do more calculations in the fragment shader if there are more vertices than pixels?

I'm very new to graphics programming, and as I understand it vertex shaders are called per vertex and fragment shaders are per pixel (ignoring anti-aliasing). When it comes to optimization all sources ...
4
votes
1answer
256 views

Weird shader behavior on different devices

I'm trying to combine an ordinary shader with a Single Distance Field shader (for fonts and scalable icons) into one shader program. The idea is simple - if uv.x is less than 1.0, it is drawn as ...
2
votes
1answer
152 views

OpenGL Outlining Cubes in a Greedy Meshed Mesh

So I've managed to get myself a greedy meshing algorithm implemented for a little voxel game I'm developing to teach myself LWJGL/OpenGL, and it's going great. The thing is, I don't plan on using ...
1
vote
1answer
1k views

Surface Depth Intersection Shader

I recently asked a question about the creating an accurate Depth Intersection Shader. When creating this in a fragment / vertex shader it could be achieved by the following code ...
3
votes
1answer
3k views

Depth Intersection Shader

I am trying to create a shader in Unity that shows where intersections occur between objects. Most of the shader I have so far is based off of this youtube tutorial. However, I have made some slight ...
0
votes
1answer
146 views

How can I Fade Paint over time?

I want to fading my paint over time like this: but currently It's gray! what Is the problem? Code: ...
1
vote
0answers
152 views

What's wrong with my normal mapping, and how can I fix it?

I'm trying to implement Normal Mapping in Directx and I'm very close to creating it but I'm getting these weird black colors on some objects. This is how it looks like without the Normal Mapping: And ...
2
votes
1answer
2k views

How can I create an outline shader for a plane?

All these toon shaders I have been seeing render an duplicated mesh behind it and extrude the normals of the vectors to make it look like it has a border, but it feels a bit hacky to me. Basically I ...
0
votes
1answer
112 views

How can you pass a large amount of textures or equivalent to the fragment shader in OpenGL?

I am adding shadow mapping to a game engine I am working on. For this effect, each light source needs it's own associated shadow map cube texture. I am going to be exaggerated and say there can be ...
0
votes
1answer
136 views

How to create a depth-recording shader for shadow mapping?

I am attempting to implement shadow maps. I am first going to implement spotlights over directional lights (I am aware this is harder). Since I was already rendering the geometry, my attempt was to ...
4
votes
0answers
109 views

Writing a leather shader

I'm trying to write a leather material shader. I have a normal map, bump map (grayscaled), specular map, diffuse map, cube maps. I have done the following ...
4
votes
1answer
120 views

Phantom objects in ray tracing

I am attempting to add volumetric shadowing to an application I am working on to test some things. For this effect I wrote the following fragment ...
0
votes
1answer
2k views

How can I fix my shadow caster problem?

I'm trying to make invisible object with shadow by using it's shadow castting pass it additionaly shades back side of object itself. I mean object shades his back side and draws shadow on the ...
0
votes
1answer
936 views

Change shadervalues for different Meshes in Three.js

Hey I am writing a Shader for Three.js. My goal is to have multiple objects with the same shader and each object should have a color set on the object that is then given to the shader. The goal is to ...
3
votes
2answers
406 views

How to run Shader after Build without problems?

I always have problems with shaders, while my partners avoid using custom shaders because it always causes problems. When I write shaders I have to test it in many devices and optimize every time. In ...
0
votes
1answer
594 views

how can I make delay in shader?

my effect is loop but I need have delay between each flash effect.i don't want use c# code because i believe there is easy way to implement delay in shader. ...
6
votes
1answer
420 views

Animating compression wave shader which uses image for displacement map

I've been testing a variety of shockwave or ripple effect shaders, and spent time on this cleaned up and improved version on shadertoy. I'm not entirely satisfied with that because it produces an ...
1
vote
2answers
539 views

Spherical fragment shader shockwave regardless of screen dimensions

I've been working on a shockwave shader based on some examples I've looked at. My primary issue is that the screen/resolution dictates the shape of the shockwave. I need it to be spherical, but with ...
-2
votes
1answer
964 views

Shader FloodFill Alogrithm

I'm new to openGL and shaders. Is there a way to implement shader algorithms for floodfills? Basically, I have a picture with outlines and i want to fill the insides of where the user touches it