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
2answers
40 views

Is there a way to figure out in which quad I am in fragment shader?

In my openGL project I draw a lot of quads (composed from 2 triangles) - for sake of example let's say quad 0,1,2 and 3. I process them in single pass. I do transform them with projection view matrix ...
0
votes
0answers
20 views

OpenGL I want my image to change color based on stencil

I have an image and a rectangle on the screen, using the using this stencil functions I managed to render or not render a certain part of my image. ...
0
votes
1answer
30 views

Relocate texture regions with pixel shader

I'm new to DirectX and pixel shader development. I want to know how to relocate region of input image in post processing. What I want to achieve is to divide my image into 4 pieces and then relocate ...
0
votes
1answer
35 views

GLSL Shade a box different colors for two ends with one material in Three.js

First, I knew the following basic knowledges, GLSL Language, Learn WebGL2 ​- GLSL ​* GLSL Shaders OpenGL - Coordinate Systems, [OpenGL - Advanced GLSL] 3D Game Shaders For Beginners - GLSL ...
0
votes
1answer
46 views

Debugging shader script in GLSL ES - Game Maker 2 (CompileError)

I am trying to use this shader in the game I am making with Game Maker Studio 2. I tried to convert it for GM2 and here is my result: Shader type I used on GM2 is ...
1
vote
0answers
56 views

Why is this GL_TRIANGLE fan texturing incorrectly?

I am constructing some terrain for a 3D game (in C) as a 2D grid of tiles, the corners of which have height into the 3rd dimension. In the middle of each tile is another vertex, the height of which is ...
0
votes
1answer
27 views

filter camera output by mesh

(skip to edit for the actual problem) I have a simple plane mesh generated via script (has arbitrary shape). I want the shader to discard (set to black) all pixels that aren't passing through that ...
0
votes
0answers
28 views

View space positions from depth in DirectX

I have a depth texture and I'm trying to output the view space positions on the screen. In renderdoct I get the following image, and there are two 3D Models a plane and another model. I'm using an ...
-1
votes
1answer
67 views

Shaders overriding other shaders

Recently, I've been making a 3D game and I have been having trouble with making multiple shaders. I've researched this for a bit, and told that I had to use ...
0
votes
0answers
21 views

Slick-Utils texture not loading after binding to FBO

Recently, I am making a 3D game using LWJGL, and finally got framebuffer textures to work! The problem is, though, is that I think the default shader that is used for the cube doesn't work or the ...
0
votes
0answers
18 views

Issues with percentage closer filtering

I'm trying to code a simple game via OpenGL C++. I've implemented a point light, parallax effect with textures, objects from blender etc. but I seem to have an issue with my percentage closer ...
-1
votes
1answer
60 views

Post Processing without using FBOs?

Recently, I've been making a 3D game (hint my questions), and I recently have modified a pixelization shader from a unity shader graph tutorial. The thing is, I want to render the shader on the WHOLE ...
0
votes
0answers
46 views

Help needed to render textures using fragment shader (or procedural textures)

Recently, I have been making a 3D game. I was messing with my shader files, when I ran into a problem. The "texture" I made for the fragment shader just renders on top of the object, and ...
0
votes
2answers
147 views

How to use vertex and fragment shaders without using VBOs and VAOs?

Recently, I am trying to make a 3D game in LWJGL 2, not LWJGL 3, just because I am more familiar with LWJGL 2. Since LWJGL decided to shut down their legacy wiki website, I've been researching alot ...
0
votes
0answers
239 views

OpenGL Compute Shader vs Fragment Shader device support

I have a game with massively parallelizable logic, which I intend to write calculate on the GPU (Java/LibGDX). I am planning to implement a logic for it through a fragment shader, instead of a compute ...
1
vote
0answers
46 views

Fragment shader not working as expected

I am porting the following shader into Godot. The results seem not correct though. Apart from the wrong colours there seems to be no change with time. What is the problem with it? ...
0
votes
1answer
60 views

How to colour blend between two materials?

I've been trying to get a material (with an image texture) to animate towards a colour mix with transparency, but either I'm attempting something the wrong way, or unable to find the right keyword to ...
0
votes
1answer
99 views

How to implement dither in pixel shader?

I've seen this talk about INSIDE's rendering (thanks to DMGregory). It says that we should dither everything. What I wonder however is how to dither in a simple fragment shader? In a Pixel Shader I ...
0
votes
1answer
60 views

How to avoid banding with raymarched fog?

I have a raymarching shader for fog. It works well but It creates artifacts in the form of banding: I understand the problem: The step size is too large and the sample points above the ground are not ...
1
vote
1answer
105 views

Why does my stencil buffer allow pixels through?

I'm rendering a scene using OpenGL. The scene consists of a grassy environment and a small lake (visible as two surfaces). To achieve water surface transparency, I'm using a stencil buffer to render ...
1
vote
1answer
131 views

How to convert screen space to world space?

I have a shader that should do raymarching. But I have problems converting the fragment's position to a worldspace coordinate. This is my vertex shader: ...
0
votes
0answers
31 views

considerations for local fog with raymarching

I want to implement local fog with ray marching. I am not entirely sure how to make the fog behave like an actual volume. The level designer is meant to place an arbitrary amount of fog volumes into ...
0
votes
0answers
38 views

WebGL transparent gradient mask at edge

I need to make a feature in WebGL, where I have horizontal list of meshes (example 20) and I want to show only 3 and 2 at edge are fade in/fade out. And it slowly animates from one side no another (...
1
vote
1answer
357 views

mapping texture uvs to sphere for skybox

I've been trying to learn shader coding, specifically procedural skyboxes. I've been using this guide here which is a shader graph tutorial and try to write out the steps in code. However, I'm stuck ...
3
votes
1answer
142 views

Shading a concave cube as a convex cube with forced perspective

Context I'm building a graphics pipeline for voxel volumes. I'm using an existing game engine (Bevy) which provides a way to put an object in 3D space. In my application, the voxel volumes can be ...
0
votes
1answer
91 views

Drawing a pixel perfrect rectangle with stroke using shader

I'm drawing a rectangle based on input sizes and use it to mask the screen. Now I want to give it 1 pixel stroke but it doesn't rasterize to one pixel. I tried UnityPixelSnap but still no chance. Here'...
0
votes
0answers
29 views

How to 3 triangle could generate hundred of fragments? [duplicate]

I am just watching the Shaders intro video from here where the Youtube is saying 3 vertices make up a triangle and Could generate a couple hundred fragments based on how much of the screen that ...
0
votes
0answers
48 views

Compute Shader vs Pixel Shader

I am pretty new to game development and graphic stuff. I find that compute shader is somehow more powerful and flexible than Pixel Shader for almost everything I need so far. But Pixel/Fragment shader ...
2
votes
1answer
275 views

Is linear filtering possible on depth textures in OpenGL?

I'm working on shadow maps in OpenGL (using C#). First, I've created a framebuffer and attached a depth texture as follows: ...
0
votes
0answers
373 views

Unity: Efficient way to get the average pixel color for a portion of the camera viewport

At it's core, the problem I'm trying to solve is this: I have a camera (not main) that I would like to project to a 2 pixel RenderTexture. I would like the first ...
6
votes
1answer
827 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
84 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
65 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) ...
4
votes
1answer
2k 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 is ...
0
votes
0answers
198 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
40 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
39 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
146 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
420 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
69 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
90 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
34 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
2k 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
164 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
67 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
667 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
121 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
145 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
221 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
81 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. ...

1
2 3 4 5
7