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

HLSL 2D Pixel Shader Recursion Help? (XNA)

I am using the latest version of XNA. I am attempting to write a lighting pixel shader for my 2D game. (Thinks Starbound's lighting system) To do this, I need to implement a recursive function to spread light onto the texture. Unfortunately, when I…
ben
  • 133
  • 13
0
votes
1 answer

Image pixel slider effects are not working

I'm using PixelShader effects for an image. Image effects for adjusting Contrast, Brightness, CMY & RGB using SLIDERS Blend mode Image effects which are predefined & loaded in a combo box and users can select their own choice. This is the Image…
linguini
  • 1,939
  • 5
  • 49
  • 79
0
votes
1 answer

How to create wpf effects that extend outside the controls bounds?

I've been fiddling with shazzam to create all kinds of cool PS effects but I still don't understand how an effect can affect areas outside the element its applied on, like the original blur or dropshadow effects for an exmaple. Can anybody…
Jake Freelander
  • 1,471
  • 1
  • 19
  • 26
0
votes
1 answer

Stage3D function

I've been learning about stage3D, and am trying to render something for the first time. No run-time errors appear during the course of this program, but I am not seeing any output... my code is as follows (with comments where necessary) import…
Conduit
  • 2,675
  • 1
  • 26
  • 39
0
votes
1 answer

Force Pixel Shader Effect to run in parallel for only 1 image

I have wpf application showing very large image with pixel shader effect (contrast adjust) on it. Perform very nice until I scale up the image (which brings great amount of pixels to be rendered). I noticed that if I'm cropping the image to smaller…
sagur
  • 1
0
votes
1 answer

What "brightness factor of 20" might mean?

I'm trying to reproduce a behavior of closed source software. Description of processing contains the following wording, which isnt clear for me: ... and a post-process brightness factor of 20. For me, the term "factor" means "coefficient" or…
user2667089
0
votes
2 answers

XNA Unexpected ')' Effect Compiler

My XNA HLSL Compiler keeps telling that I have unexpected ')' at the end of a subtraction. The PixelShader: float3 lightDir = normalize(LightDirection); float3 viewDir = normalize(input.View); float3 normal = input.Normal; float diff =…
Daniel Sharp
  • 169
  • 1
  • 2
  • 12
0
votes
1 answer

DirectX10: apply an effect to a texture

I have a texture that becomes the input to a pixel shader. Code snippet: mDevice->CreateShaderResourceView(myTexture, nullptr, byRef(mBckSRView)); ...->AsShaderResource()->SetResource(mBckSRView); However, I want to apply a blur filter to this…
cabanier
  • 3
  • 1
0
votes
1 answer

SlimDX 3D Graphics Pixelshader Issue

I am working on a simple 3D app that will draw a cube using SlimDX. Currently it should draw a single triangle on the screen, but instead it does nothing. If I examine things using the graphics debugger feature in VS2012, I can see that the output…
Mike F.
  • 11
  • 4
0
votes
1 answer

hlsl unexpected acos result

I found a few strange HLSL bugs - or Pix is telling nonsense: I have 2 orthogonal Vectors: A = { 0.0f, -1.0f, 0.0f } and B { 0.0f, 0.0f, 1.0f } If I use the HLSL dot function, the output is (-0.0f) which makes sense BUT now the acos of that output…
Tomas Dittmann
  • 424
  • 7
  • 18
0
votes
1 answer

Pixel Bender calculation over ALL pixels result

What I want is (basically) the same as "sum all the pixels of an image". However it seems that this can not be achieved by shader (I think that is why I'm asking ;-)): I want to pass the image + a parameter "treeshold" and check for each pixel of…
voskyc
  • 127
  • 3
  • 14
0
votes
1 answer

DirectX 11, Combining pixel shaders to prevent bottlenecks

I'm trying to implement one complex algorithm using GPU. The only problem is HW limitations and maximum available feature level is 9_3. Algorithm is basically "stereo matching"-like algorithm for two images. Because of mentioned limitations all…
Lukasz Spas
  • 595
  • 2
  • 9
  • 23
0
votes
1 answer

DX Shader Assembly Registers

I'm starting to learn dx assembly but I'm really confused there are some registers i can't seem to find what are they for anywhere these registers are: mov_pp mov_sat and basically all of them that have something different from normal assembly…
Makenshi
  • 993
  • 3
  • 15
  • 28
0
votes
1 answer

Pixel shader with SharpDX and DirectX toolkit outputting pure red color

I am creating a Windows Phone 8 app and I'm working with camera. When I don't use any shader, my C# code works perfectly: void photoDevice_PreviewFrameAvailable(ICameraCaptureDevice sender, object args) { …
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
0
votes
0 answers

Rendering a line into a 1x1 RenderTarget2D does not change the target's pixel color

What I am trying to achieve is the following: my pass will return a huge array with several unique numbers repeating over and over, which I need to retrieve and process on CPU. I tried rendering into a 2000x1 texture and then sampled it on the CPU…
cubrman
  • 884
  • 1
  • 9
  • 22