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
0answers
16 views

UE4 - Render grid decal per pixel on GPU or all at once on CPU?

Using UE4 version 4.25.3, I am trying to project a 2D cartesian grid onto a landscape. The grid is currently just a series of black-bordered squares, but I am planning on adding an abundance of color ...
1
vote
0answers
40 views

Creating Blender-like cavity shader

I'm trying to achieve in Godot something similar to cavity effect from Blender (this can be enabled in viewport options; cube on the left is displayed by viewport with this option enabled): How would ...
1
vote
1answer
44 views

Sending light data from Vertex Shader to Pixel Shader?

We have a pixel shader constant buffer that contains the light data for the item that is currently rendered. To implement tangent space normal mapping, i would need to transform each light into ...
1
vote
1answer
39 views

Fragment shader - map dot texture repeatedly over the sphere

I have a sphere and in Fragment shader, I have available lat / lon position (in radians) for every fragment. I have a texture of a single dot. I need to map this single dot (or any other texture) ...
3
votes
1answer
302 views

Infinite world floor grid shader

I am trying to render an infinite world floor grid, similar to this question. My project is using SceneKit with Metal Shading Language but the concepts are no doubt similar between GLSL/HLSL. Here ...
0
votes
0answers
41 views

Fragment shader for lighting in isometric perspective

What I'm trying to do is to achieve basic lighting in 2D from an isometric perspective. Here I have 2 textures that are used as tiles for the ground: Color: Normal map: I have a fragment ...
0
votes
1answer
28 views

How can I mod a game to render only certain pixels during pixel shader stage?

I am a gamer and hobbyist programmer in game dev and deep learning algorithms. I want to train a deep learning algorithm like DLSS from NVIDIA, which can render a complete frame by taking certain ...
2
votes
0answers
31 views

How to apply a color transform to textures when using pre-multiplied alpha?

I'm trying to apply a color map to my textures. The map is a 4x4 matrix that adjusts the contribution of each RGBA channel returned from the fragment shader. My texture needs to use pre-multiplied ...
0
votes
1answer
39 views

Unity mesh shader for outlining colour changes

I've written a shader to change colour on a deformable mesh's Z position. This is to create the effect of topographic/contour maps where the colour changes based on the height of terrain of the mesh. ...
0
votes
1answer
323 views

intersection of primitive in a unit wrapping 3D space

is there people good enough for a math problem (for a shader)? I want to write an algorithm that would intersect primitives (triangles, squares, circle, sphere, cube, cylinder) inside a unit wrapping ...
0
votes
0answers
30 views

Shader intersection radiate outwards

I've been working on a water shader for a project I'm currently working on and have been trying to work on the intersections between objects in the water to create a foam effect that radiates outwards....
0
votes
1answer
85 views

How should shader be structured? (GLSL)

I've been writing, deleting and rewriting OpenGL programs in C++ but usage of shaders confuse me. I don't know how it should be structured. Scenario A: (In a world we have a sun, the sun should ...
0
votes
0answers
23 views

Gamma adjustment slider implementation

Various online sources talk in sufficient detail about gamma correction. By following them, I achieved a rendering pipeline that looks somewhat like this: ...
3
votes
2answers
944 views

Why is enabling GL_FRAMEBUFFER_SRGB making the colours brighter?

My understanding of gamma correction is as follows: We want to do colour math in linear space so we can lerp etc. between colour values and get the results we expect. But human eyes don't have a ...
0
votes
1answer
64 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
51 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
296 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 ...
1
vote
1answer
75 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
102 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
151 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
67 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
83 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 ...
1
vote
2answers
382 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
82 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
51 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
262 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
187 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
34 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 ...
1
vote
0answers
283 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
116 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
52 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
984 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
1k 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
54 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
703 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
110 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
222 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
52 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
144 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
120 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
247 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
98 views

Wrap texels between desired values

I'm using a basic pixel shader here ...
1
vote
1answer
310 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 ...
5
votes
2answers
338 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
229 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
2k 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
4k 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
217 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
183 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
3k 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 ...

1
2 3 4 5 6