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
4
votes
1answer
121 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
1k 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
436 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
924 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
480 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
671 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
1k 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
1
vote
0answers
168 views

Draw line around mesh with defined width at cut plane

I want to display a solid line around mesh with a defined width at a cut plane. Currently I realized that using the same method as gl_ClipDistance works using ...
5
votes
2answers
4k views

Algorithm for a rain effect (Shaders)

I'm trying to implement a rain effect using shader, I use godot 3-alpha, which uses a simplified GLSL 3.0 language. But I'm just finding very complex examples for me, I understand little about shaders,...
4
votes
2answers
490 views

DirectX11 - Color Interpolation Along Quad Diagonal

Imagine that we have a vertex structure that looks like this: struct Vertex { XMFLOAT3 position; XMFLOAT4 color; }; The vertex shader looks like this: <...
1
vote
1answer
2k views

Has anyone ever made a shader that produces something similar to pixel art?

I find that pixel art is really pleasing to look at; it has this kind of crisp, satisfying perfection to it. I've been following some beginner pixel art tutorials, when I got an idea: what if someone ...
1
vote
0answers
586 views

Passing an UAV to a Pixel Shader in DirectX11

I have a compute shader which task is to take an input image and then blur it using a Gaussian filter approach. The input and output for the compute shader looks like this: ...
2
votes
1answer
172 views

Fading previous frame doesn't fade all the way to black?

I'm working on a 2D OpenGL program. It'll be a fairly simple fireworks visual. So far what I have is that I draw a circle with a gradient "glow" to it and move it around on the screen. I want it to ...
0
votes
1answer
290 views

Sprite masking with multiple, non-equally dimensioned textures in XNA

I know this question's been asked many times before, but I can't seem to get sprite masking to work in XNA/Monogame no matter if I try the stencil method, or the shader method. Considering I'm having ...
1
vote
0answers
46 views

Can sampling an input texture in shader return values updated in same pass?

In my hlsl, (I am using Direct2D helpers which I guess just call tex2D), can D2DSampleInputAtOffset() return a pixel value that was only updated in that same pass ...
1
vote
4answers
1k views

Output pixel to different position from pixel shader?

Is it possible to output a pixel processed by my pixel shader to a different position? For example if SV_POSITION of the pixel is 14,26, can I change it to 14,27? I see there are only two possible ...
3
votes
1answer
230 views

GLSL ES 2.0 alternative for dFdxFine

I'm trying to generate normal map on the fly in fragment shader. The implementation I've found is using dFdxFine function, which can't be used in WebGL, is there any alternative for dFdxFine in GLSL ...
1
vote
1answer
89 views

GLSL Fragment Shader compiles fine on certain computers [closed]

I got this piece of code in a fragment shader: if (color.a < 0.01f) discard; It runs fine on an older graphic card but can't even compile on my newer (...
3
votes
0answers
160 views

What am I doing wrong, in regards to multi-texture?

I am writing a bump mapping demo, so I need an image texture, and a normal texture which should be loaded into the fragment shader. This is the texture part of my OpenGL code: ...
1
vote
0answers
760 views

How do I set the UV coordinate from a texture value in HLSL?

I have a UV render pass, where RG is the image and B is always set to 255: I want to set the UV pass texture value to UV Coordinate; when I test it, the result should pixelate noise, like the below ...
1
vote
1answer
197 views

Does GLSL support multitexturing?

I am using LWJGL libraries to code myself a game. I want to be able to import a project from blender to my game. I have the wavefront .obj reader and it works perfectly for my needs. Although because ...
1
vote
0answers
278 views

Cocos2d-x: Differences between applying shader to child node and entire scene?

I'm beginning with shader. I wonder what if i apply shader for single node, what'll happen? The gl_FragCoord = (0.5,0.5) is the bottom left of the screen or the ...
0
votes
1answer
104 views

Fragment Shader Code returns weird values

i've implemented a shader that produces a simple Radar Ping given a uniform time input. ShaderToy Proof of concept Now i implemented this into my real Opengl GLFW GLAD C++ Core4.5Profile NVIDIA ...
1
vote
0answers
50 views

Trouble rendering shadowmap for planets

Im currently trying to create a game where you visit planets in LibGDX for Java. To do this I use a TiledMap which is basically just an array of tiles to represent the planets themselves. To get the ...
7
votes
1answer
7k views

How to make a 2D neon-like trail effect in Unity

Recently I've been toying around with neon-ish effects for a game I'm making and wanted to share my results with you. If you guys have any other methods of achieving this result, please be sure to ...
0
votes
0answers
227 views

HLSL sampler always returns white

I'm having an issue with a simple HLSL pixel shader. As a start to writing a lighting engine, I created a point light texture that looks like this. The texture itself is a white -> transparent ...
1
vote
1answer
450 views

Metaballs created through raycasting in fragment shader - billboards are still recognizable

Good day everyone, I'm currently programming a fluid simulation through use of metaballs and I have a very specific problem/question. The steps I use for metaball simulation: 1. Simulate particles' ...
1
vote
0answers
923 views

Adding an extra Pass to the Unity Standard Shader

I'm experimenting with adding some procedural textures to the unity standard shader. I'd like to add an extra pass (with vert and frag functions), but am unsure about where in the sequence this should ...
2
votes
1answer
232 views

How to make far block graphically better?

What calcules can I do to make far objects looking better? My game Here's what I see if I go back with the camera in my test-rendering scene: As you can see the result is not one of the bests: ...
1
vote
0answers
785 views

Unity - soft blur effect for dark void edges

I'm a former Flash dev working in Unity (or in 3D for that matter) for the first time. For the game I'm working on, I've designed an interior room like so: To represent void/space outside the bounds ...
2
votes
1answer
884 views

GLSL - skewed parallax occlusion mapping

I'm currently trying to implement Parallax Occlusion Mapping, based off a post on sunandblackcat.com With my current implementation, I have the following: ...
0
votes
1answer
99 views

Fragment processing depends on polygon size?

I just set up some simple vertex/fragment shaders for handling lighting instead of using the openGL calls. I have a few terrain VBOs setup that are drawing a million or so triangles for testing (bunch ...
0
votes
1answer
267 views

How to draw connecting lines in plain color? [duplicate]

Since there is no option for flat shading in OpenGL ES2, is there a workaround to disable the color interpolation when different color is being passed to each of the vertices? Update: I'm working ...
0
votes
1answer
559 views

OpenGLES texture coordinates in shader

Currently I'm doing an android 2D game using OpenGLES 2.0 and I noticed that my UVs never change in all of textures when rendering, like this in Java code: ...
0
votes
1answer
361 views

Fragment shader coordinates: Displacing pixels and texCoord problems

I'm trying to create a shader that creates a displacement on an object, slicing horizontally the sprite. These is an example of the atlas I'm using and the effect I'm trying to achieve: I tried to ...
1
vote
1answer
156 views

alpha test shader 'discard' operation not working - GLES2

I wrote this shader to illustare alpha test action in GLES2 (Galaxy S6). I think is not ...
1
vote
1answer
767 views

how to make a fast fragment shader that converts intensity to saturation?

I have a simple fragment shader that looks like this: ...
4
votes
1answer
623 views

Procedural Hatching

I know that it is possible to make a shader that uses procedural hatching instead of pre-designed tonal art maps. But is it possible to make that procedural hatching in the fragment shader? I would ...
0
votes
3answers
682 views

Difference in Shading Using Eye Space or Model Space Coordinates

While reading on shading, I came across a section in which the artist provides 2 different kinds of fragment shading: Coloring using model space and eye space. The result is as illustrated in the ...
2
votes
1answer
411 views

Would it perform faster to split calculation between vertex and fragment shaders?

Assuming the total amount of computation would be the same (at least as far as my code goes), would there be any performance increase in splitting the calculation and using separate vertex and ...
2
votes
1answer
423 views

Game Maker - How to change color palette using shader and texture?

How can I change the color of the application surface using a texture? https://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes https://en.wikipedia.org/wiki/List_of_8-...
1
vote
4answers
2k views

How do I calculate NDC coordinates in a fragment shader?

I have some weird problem going on in my openGL shader. First,, I pass the viewspace position from the vertex shader to the fragment shader like this: ...
1
vote
0answers
171 views

Game Maker - Shader CGA - how to swap the palette

I created a shader that get the actual color of the surface and render it to the closer of a cga palette I have to change it to swap the palette in 4 colors but I don't know how secondary, I have to ...
1
vote
1answer
488 views

Problems with BlendOp Max

I'm trying to write a shader that doesn't blend additively etc etc. I'd like to take whichever of the source or destination colours is brighter and use that and ...
1
vote
1answer
76 views

Fragment shader operations before vector transformations

I feel like I'm misunderstanding how to work with vector/fragment shaders. My vector shader is as follows: ...
1
vote
1answer
913 views

HLSL texture sampler always returns white

I'm facing in problem in HLSL with Monogame that I can't figure out. The gist is that sampling from a texture seems to always return white rather than the texture's actual color. My pixel shader code ...
3
votes
2answers
732 views

How do I get a Light's Range value in Shader?

I'm trying to write a simple frag/vert shader that, depending on whether it is in the range of a light, will paint the appropriate colour from either the 'lit' texture or from the 'unlit' texture. ...
3
votes
1answer
10k views

How do I calculate UV space from world space in the fragment shader?

In my vertex shader I have calculated the world space o.worldSpacePosition = mul(unity_ObjectToWorld, vertIn.vertex); How do I convert that world space into uv ...
1
vote
1answer
92 views

Transform luminosity (Watt) to be usable in shader

I'm studying the color and the Luminosity of Stars. I'm trying to figure how to transform information of Luminosity i perceive at a given distance to something usable into a shader. For instance , ...