Questions tagged [pixel-shader]

Pixel shaders, also known as fragment shaders, compute color and other attributes of each fragment. Pixel shaders range from always outputting the same color, to applying a lighting value, to doing bump mapping, shadows, specular highlights, translucency and other phenomena.

Pixel shaders, also known as fragment shaders, compute color and other attributes of each fragment. Pixel shaders range from always outputting the same color, to applying a lighting value, to doing bump mapping, shadows, specular highlights, translucency and other phenomena.

They can alter the depth of the fragment (for Z-buffering), or output more than one color if multiple render targets are active.

In 3D graphics, a pixel shader alone cannot produce very complex effects, because it operates only on a single fragment, without knowledge of a scene's geometry. However, pixel shaders do have knowledge of the screen coordinate being drawn, and can sample the screen and nearby pixels if the contents of the entire screen are passed as a texture to the shader. This technique can enable a wide variety of two-dimensional postprocessing effects, such as blur, or edge detection/enhancement for cartoon/cel shaders.

Pixel shaders may also be applied in intermediate stages to any two-dimensional images in the pipeline, whereas vertex shaders always require a 3D model. For instance, a pixel shader is the only kind of shader that can act as a postprocessor or filter for a video stream after it has been rasterized.

310 questions
0
votes
1 answer

How can I dynamically make only a certain part of my sprite transparent? Through a Shader or something

I have a sprite for my player character and would like to add a ghost effect to the sprite. I simply want to make a transparent version of the character. The issue is I have my player graphics split into different pieces to make animation easier so…
0
votes
1 answer

Collision checking in pixel shader

I'm implementing kind of 3D Model tools using DirectX 11 and I need to paint the collision area between 2 meshes with Pixel-level accuracy. So I think I should do something in pixel shader but I don't have enough experience with shader…
0
votes
1 answer

Alpha values below 0.5f are invisible

I am currently developing on a new mechanism to visualize laser beam hits on spaceships' shields. The development on the CPU side is done and the Vertex Shader is working fine, but I have an issue while creating the Pixel Shader: Any transparency…
GameDevAlien
  • 195
  • 1
  • 17
0
votes
1 answer

how can i get the pixel shader asm code "Ld"?I'm writing HLSL

When I'm reading the asm code ,I dont know how to get the instruction "ld" just below. Which function should I use in HLSL to get it? Or had it be replaced with the update of versions? The following is asm code: ld r0.xyzw r0.xyzw t19.xyzw I tried…
0
votes
0 answers

How to make an "icy mountain" shader without branching

I created a simple graphics program using DirectX 12 for learning purpose. I heard that using If statements in the shader code is not good for performance. However i couldn't wrap my head around how to achieve the effect on the attached image…
funtar
  • 1
0
votes
1 answer

What is OpenGL ES 2 Shader language analog for HYDRA (pixel bender) sampleLinear?

So I look onto OpenGL ES shader specs but do not see such... For example - I created simple "pinch to zoon" and "rotate to turn around" and "move to move center" HYDRA pixel bender filter. it can be executed in flash. It is based on default pixel…
Rella
  • 65,003
  • 109
  • 363
  • 636
0
votes
1 answer

How is vertex data used in pixel Shader

A triangle has 3 vertices. A pixel shader receives data from the vertex shader. If each vertex has a different color, the transition is calculated between the colors. This calculation of such a transition, does it do this for all the data the pixel…
0
votes
0 answers

cut and merge images in shader

my test image divide 4 part. | 1 | 2 | 3 | 4 | I need cut 1, 3 part and merge 1 + 3 and cut 2, 4 part and merge 2 + 4 final result | 1 | 3 | 2 | 4 | I was search shader example. but just find blend or mixing image. please help me.
byungkyu
  • 629
  • 1
  • 10
  • 16
0
votes
0 answers

Validation failure tex2D HLSL Shader Model 6.0

So apparently tex2D is still supported in HLSL shaderModel 6.0 so why does doing something like the following produce validation errors: float myFloat = tex2D(MySampler, In.texCoord).w; It does not like tex2D, if I make a Texture2D MyTex variable…
Sixjac
  • 339
  • 4
  • 16
0
votes
1 answer

How to apply multiple shader effects to a DrawingVisual?

I have got a DrawingVisual object (dv) and draw an image after a complex transformation to its DrawingContext (dc). After the dc.Close(), I want to run multiple shader effects on the dv object. First, a custom Tint effect, then a blur effect. Later…
Tamakwa
  • 21
  • 4
0
votes
2 answers

XNA Distance Vector to HLSL float2

I have applied a noise effect to a texture using this pixel shader. float2 noisePower; float noiseFrequency; float camMoveX; float camMoveY; texture noiseTexture; sampler2D noiseSampler = sampler_state { Texture = ; …
Lamar
  • 581
  • 7
  • 22
0
votes
1 answer

How are vertex shader and pixel shader related?

I know this had been asked a million times, but I just don't get some details. As an example, lets say that I have a swap chain created and one staging ID3D11Texture2D. What I can do with it is load a bitmap into this 2D texture and then copy it to…
some_user
  • 11
  • 2
0
votes
1 answer

Help to understand Pixelate effect

I'm new a HLSL and I'm trying to understand a pixelate sample. However, I haven't been able to find a reference about how a couple of operations are. Here is the shader…
hmadrigal
  • 1,020
  • 11
  • 19
0
votes
1 answer

Graphics debugging in MSVC 2017 - An error occured. Playback of your application may be incomplete

I successfully recorded a DX11 diag session once. When running it the second and any further time, when I click on a frame I get this error: An error occured. Playback of your application may be incomplete. (HRESULT = 0x00630000) "Unknown error…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
1 answer

Cannot initialize a vector array with an integer index in WebGL/GLSL?

I'm wondering why I can't initialize an array with an integer index. In shadertoy it seems to work but it doesn't work when I use this pixel shader via three.js: void main(void) { vec2 p[1]; p[0] = vec2(0.0, 0.0); // works int i = 0; …
Shai UI
  • 50,568
  • 73
  • 204
  • 309