Skip to main content

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
1 answer
74 views

IIn video games, are slight damage details, like say on a tank, made by modifying the geometry or by using textures?

Here are images of real tanks and I drew arrows into the places with slight damage: In video games, are those made by modifying the geometry or with textures?
kyopa's user avatar
  • 133
0 votes
0 answers
33 views

Texture space Raytracing of cylinder primitive in godot shader for Helix interception

I have been trying to do raytracing of an helix in a spatial shader in godot 4.2, but apparently I missed something because the result is bloby and melty at the cylinder level. The basics is that I ...
user29244's user avatar
  • 327
2 votes
1 answer
83 views

Hide Horizon Line with Small Terrain?

I'm drawing a sky plane with an atmosphere fragment shader in front of my terrain. It looks pretty much fine at sea level, but if you move above the sea level, the illusion is quickly broken, as you ...
Scollier's user avatar
  • 124
0 votes
0 answers
33 views

tangents and bitangents or larger textures?

This is more of a performance question than anything, but some time ago I learned that to put normal maps in OpenGL 3D rendering, I could do it in two ways... The first is generally what most people ...
Arthur Sally's user avatar
0 votes
1 answer
87 views

GLSL ported shader not working in HLSL

I have been working on an Infinity Grid shader for my engine. It was already implemented to Vulkan’s GLSL, so it worked great with OpenGL’s (4.6) GLSL. Here's a reference. This basic shader with ...
Kenny Tutorials's user avatar
0 votes
1 answer
71 views

GLSL limit uniform sampler2D to 4 for some reason

I'm writing a deferred rendering pipeline and my fragment shader looks like this: ...
Ronen Ness's user avatar
0 votes
0 answers
63 views

Why is _GrabTexture(texture of current frame buffer) always empty in my code and how do I fix it?

*I am using Unity 2021.3.29 and the built-in render pipeline. Here is a fragment shader I wrote that uses a grab pass to replicate an "average color" blend mode ...
rasputin's user avatar
1 vote
1 answer
140 views

Unity shader to give thickness to flat plane

I have this hexagonal grate floor: Which is a flat plane with the following shader: The hex lattice created using the method by Andrew Hung. Albedo and metallic/smoothness shader are just simple ...
Dr Rob Lang's user avatar
0 votes
0 answers
397 views

Creating a fake point light with empty object in the Unity shadergraph

I'm trying to create a fake point light from an Empty object with the shadergraph. This is a Blender prototype of the effect i'm trying to create. In Unity I do get the light mask to work somewhat as ...
hurmeli's user avatar
1 vote
1 answer
180 views

How can I dynamically change the skin and blush colours of an animated sprite's face in Unity?

I want to achieve this effect in unity when processing my sprites before After I was thinking that I could use two color pickers to tell a shader only to create a gradient if two colors share a ...
hello's user avatar
  • 11
5 votes
2 answers
345 views

How would I mask the player node out of a canvas shader?

I'm making a 3D game, and I want to create a post processing effect using a canvasitem and a colorrect, that effects everything on screen apart from the player. I already have the shader itself made, ...
JackHainsworth's user avatar
0 votes
0 answers
50 views

How to blend local cubemaps?

I have a (GPU) Buffer that contains the World Position and Extents of Local Cubemaps aswell as a TextureArray that contains the textures of the Cubemaps. The Bounds of the Local Cubemaps are Axis ...
Raildex's user avatar
  • 761
0 votes
1 answer
282 views

How to apply sampler2Darray textures to different locations of a single mesh?

In openGL, I have a 3D terrain composed of a grid of 255x255 vertices. The vertex of the lower left corner is at coordinates (-127;-127) and the one of the upper right corner is at coordinates (127;...
Greelings's user avatar
  • 103
0 votes
1 answer
104 views

Which pixels does the fragment shader of an unlit shader, applied on an object, affect in Unity?

Let's say that I have a cube that has an unlit shader applied to it. The shader does basic ray-marching. ...
Nikhil Nair's user avatar
1 vote
0 answers
323 views

Expected a smoothly fading opacity in this Raylib shader, but instead it is chunky

In my main file, I create a regular icosahedron and assign the below shaders to it using the Raylib framework in C++17. I intended for the vertex shader to assign a 1.0 alpha value to points at Z=-5....
James Watson's user avatar
0 votes
0 answers
63 views

How to remove pink pixels from weather radar pngs downloaded at runtime?

I have some radar imagery that comes from a source that has a bug in it's rendering system. Pink is supposed to be the separation of specific cloud consistencies BUT it often shows up on the edges of ...
Jacksonkr's user avatar
  • 239
0 votes
1 answer
56 views

How do I distort a 2D texture based on the movement of a point that starts at the center?

So there's this point that starts in the center. If the user drags it up towards the top of the texture, the top squishes and the bottom stretches. If the user drags it down, the top stretches on the ...
Emily's user avatar
  • 21
1 vote
0 answers
823 views

Pixel-effect cube in Godot 4

I'm trying to make a simple scene where the camera is in orthogonal mode with isometric settings just like if it was an isometric 2D game. That's because I have already tried doing it with 2D only but ...
Crih.exe's user avatar
  • 111
1 vote
0 answers
231 views

Is there an alternative method do do per-texel lighting in 3D without stream compaction?

Note: I'm not asking for an x% faster method. Work efficiency is an objective measure, it doesn't change because of hardware. I've got a voxel world I'm trying to render, think Minecraft, same texture ...
Krupip's user avatar
  • 1,763
0 votes
0 answers
45 views

Resample image of sphere to match appearance of rotation

I am rendering sphere to a texture. Now, I have screen space texture, and I need to offset this texture based on screen space movement (dx, dy) and render it to a new texture. For example, the left is ...
Martin Perry's user avatar
  • 1,116
0 votes
1 answer
170 views

Is it possible to draw billboards from point data held in a compute buffer?

I'm currently trying to show a galaxy and have developed a compute shader that places/moves "stars". Another vertex/fragment shader reads the buffer and currently places a point at each ...
Basic's user avatar
  • 1,228
0 votes
0 answers
114 views

custom 8Bits RGBA textures YCoCg encoding decoding with 16 bits Y packing not working correctly

Context: I invented a way to get ugly GI for low end platform (target being Mali 400 mp GPU) through texture feedback and texture PVS. Problem: In order to bypass the precision limit of 8bits textures,...
user29244's user avatar
  • 327
13 votes
1 answer
4k views

How to do color post processing in WebGL, when you can not read the color of the current pixel?

In a WebGL 2 GLSL fragment shader, one can not access the pre-existing color value of the current pixel, i.e. the color that is already there in the framebuffer before the pixel that is currently ...
Anders's user avatar
  • 243
0 votes
1 answer
377 views

How to pass voxel data to shader?

I am working on a voxel game, and I approached the point where I need to add day/night in my world. Apparently, I should just be able to pass the torch and sunlight values into my shader and multiply ...
X Builder's user avatar
  • 101
0 votes
0 answers
126 views

Draw a plane in fragment shader using determinant?

I'd like to use the determinant of a matrix to draw a plane in the fragment shader. But I don't understand how to come up with the matrix. Let's say that I have 3 points that lie on the plane: A, B, ...
Richard Garfield's user avatar
1 vote
2 answers
718 views

Combining palette-swaps and smooth scaling in a pixel-art shader

I am creating a pixel-art game in MonoGame, and have written a shader to perform various effects on a sprite when rendering it, such as performing palette swaps, highlighting outlines, etc.. Most of ...
Bent's user avatar
  • 23
1 vote
2 answers
759 views

Custom directional shadow map from sun

Due to some material features, I need to create my own directional shadow map. Everything seems to work ok, until the moment where I compare depths. First I add a camera component to the directional ...
user81986's user avatar
  • 173
1 vote
1 answer
145 views

Unity Shader w Color Bar for Fragment Color Manipulation

Situation I have a shader for images with "wonky" colors - the reason the colors are so messy is because it's a sneaky way to encode data into the RGB color channels eg the red channel is ...
Jacksonkr's user avatar
  • 239
1 vote
0 answers
591 views

1Bit Bayer Ordered Dithering Shader

I’m having a problem trying to fix my 1bit ordered dithering shader. This shader is going to be perfect to be used but there is some detail that I would like to fix. First of all, this shader is not ...
Heavybrush's user avatar
0 votes
0 answers
447 views

Very basic question: Passing data in fragment shader to next frame (Metal)

I am casually trying to learn a bit about writing simple fragment shaders, in particular using Metal API. I have been experimenting in KodeLife. As a simple example, I am trying to remake the Double ...
Heidar's user avatar
  • 101
1 vote
0 answers
437 views

Cursor trail with fragment shader

I wish to draw a simple mouse trail using fragment shaders, similar in appearance to drawing the following in processing (omitting the step of clearing the canvas). I cannot wrap my head around the ...
msalla's user avatar
  • 111
0 votes
2 answers
477 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 ...
Janis Taranda's user avatar
0 votes
0 answers
273 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. ...
shrain's user avatar
  • 1
0 votes
1 answer
96 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 ...
Mary Jane's user avatar
0 votes
1 answer
587 views

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 ...
samm's user avatar
  • 121
0 votes
1 answer
524 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 ...
Kodeeo's user avatar
  • 111
1 vote
0 answers
291 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 ...
Architect's user avatar
  • 111
0 votes
1 answer
61 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 ...
Dan B.'s user avatar
  • 1
-1 votes
1 answer
277 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 ...
Pale_Gray's user avatar
0 votes
0 answers
93 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 ...
Restlessman77's user avatar
-1 votes
1 answer
121 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 ...
Pale_Gray's user avatar
0 votes
2 answers
305 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 ...
Pale_Gray's user avatar
1 vote
0 answers
1k 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 ...
Dávid Tóth's user avatar
1 vote
0 answers
296 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? ...
dearn44's user avatar
  • 111
1 vote
2 answers
1k views

How to colour blend between two materials? [closed]

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 ...
ASertacAkkaya's user avatar
1 vote
1 answer
436 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 ...
Raildex's user avatar
  • 761
1 vote
1 answer
452 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 ...
Grimelios's user avatar
  • 579
1 vote
1 answer
2k 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: ...
Raildex's user avatar
  • 761
1 vote
1 answer
3k 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 ...
Jamie Hyland's user avatar
3 votes
1 answer
253 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 ...
iLoch's user avatar
  • 33

1
2 3 4 5
7