Questions tagged [fragment-shader]
A program that runs on the GPU to determine output colors for pixels. Also known as a fragment shader.
23
questions
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 ...
23
votes
2answers
12k views
Do I lose/gain performance for discarding pixels even if I don't use depth testing?
When I first searched for discard instruction, I've found experts saying using discard will result in performance drain. They said discarding pixels will break GPU's ability to use zBuffer properly ...
3
votes
1answer
1k views
Multiple pixel shader passes
I currently have a pixel shader that calculates the texture and I have another that calculates the light. I want another shader that does both. What I would ideally like to do is instead of creating a ...
1
vote
1answer
842 views
Unity: cg fragment shader processing array of points
I need to write a fragment shader which would somehow be aware of N points that are in the scene and darken pixels based on their world coord distance to the points. I'm looking for a method that ...
1
vote
1answer
1k views
Color grading, shaders and 3d textures
I'm trying to implement color correction with the 3d lookup table. The lookup table is actually just a 2d texture 256x16 and consists of 16 squares which one is 16x16.
When it comes to rendering, I ...
7
votes
2answers
10k views
How to implement color changing fragment shader?
I have a background of a given size and filled with a given color. I want to change it with an animation effect, starting from the center and spread out until it extends the whole background. The new ...
3
votes
1answer
12k 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 ...
7
votes
1answer
4k views
2D Line drawing with Pixel Shaders
Recently I asked a question, what is the fastest way to render 2D lines using DirectX, and one of the answers mentioned this paper on Fast Prefiltered Lines which uses Pixel Shaders to accomplish ...
2
votes
1answer
741 views
How to use Pixel Bender (pbj) in ActionScript3 on large Vectors to make fast calculations?
Remember my old question: 2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing?
I figured I could use a Pixel Bender Shader to do the computation for ...
5
votes
3answers
8k views
OpenGL additive blending not working as expected
I am trying to achieve additive blending with point sprites. When the sprites overlap, all I get is solid red, when I expect to get a smooth blend from red->yellow->white. My sprite texture has all ...
5
votes
1answer
2k views
How do I achieve supersampling / anti-aliasing in pixel shaders?
I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect:
But I noticed there is aliasing in my resulting image (the above image is a ...
4
votes
2answers
533 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:
<...
3
votes
2answers
1k views
How to set multiple times, in a single spritebatch, the same pixel shader parameter
I make a test with Effect class in XNA and I want to set multiple times the same parameters (MyParameter in below code).
My code is :
...
2
votes
2answers
2k views
Ward model implementation: specular component too weak
I'm trying to implement the Ward shading model, the anisotropic, computationally efficient version:
This is how I made it:
...
1
vote
1answer
522 views
6
votes
1answer
598 views
Why does writing to a D3DFMT_R32F render target clamp to 1?
I'm currently implementing a picking system. I render some objects in a frame buffer, which has a render target, which has the D3DFMT_R32F format.
For each mesh, ...
3
votes
1answer
5k 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 ...
3
votes
1answer
404 views
How to access the nth element in a 2d texture from a pixel shader in XNA
How can I access the nth element in a texture2d from a pixel shader? For example if I wanted to get the 5th vector4 from 10 x 10 texture2d
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
...
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
330 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 ...
1
vote
1answer
721 views
DirectX11 pixel shader in pipeline is missing
I'm writing a program which displays a MS3D model using DirectX, and unfortunately, the result shows nothing on the screen.
When I use the Graphics Debugger from Visual Studio 13, I notice that the ...
-2
votes
1answer
2k 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