A program that runs on the GPU to determine output colors for pixels. Also known as a fragment shader.

learn more… | top users | synonyms (1)

0
votes
1answer
59 views

How to fix this existing shadow shader/material with alpha textures?

I hope I could get some help here in finally resolving this problem of mine re: shadow casting with alpha textures. Here's a screenshot on what I am hoping for as a result: A friend of mine just ...
0
votes
0answers
45 views

Chroma Keying Shader

I want to apply chroma keying shader for my application. For this I used GPUImage plugin. In that I found GPUImageChromaKeyingBlendFilter class to satisfy my needs. In plugin, ...
1
vote
2answers
88 views

Bad pixels on shader when loading cached binary programs

I have been trying to cache binary shader programs in my game and load them accordingly using "glGetProgramBinaryOES" and "glProgramBinaryOES" respectively. I was successfully able to cache and load ...
0
votes
1answer
74 views

How to change pixel color of Texture with Fragment Shader

I want to change the pixel color of a texture. I don't know where to start and what to add. Really need help, I only find useless snippets in the internet. My current Code: public void ...
1
vote
2answers
89 views

Fast fullscreen quad rendering in Direct3D 11?

For the last few weeks, I've been trying to port a DX9 implementation of HDR rendering (tone mapping, bloom, stars, etc.) over to DX11. I believe I've got all features working but I'm not getting good ...
-1
votes
1answer
67 views

Combine Two Shader Program [closed]

For my android application, I want to apply brightness and contrast shader on same image. At present I am using gpuimage plugin. In that I found two separate program for brightness and contrast as ...
0
votes
0answers
45 views

Pixel Shader : Backbuffer is 'Black'

After Fiddling around I am pretty sure this is not a Shader issue. Edit 4: The only diference I can see is that BasicEffect calls these methods before drawing: // Make sure that domain, hull and ...
0
votes
0answers
42 views

Very basic OpenGL ES 2 error

This is an incredibly simple shader, yet I'm having a lot of trouble understanding what's wrong with it. I'm trying to send a float to my fragment shader. Its purpose is to adjust the alpha of the ...
2
votes
2answers
124 views

Strange if-else branching behavior in a fragment shader

In my fragment shader I have passed an uniform int uLightType variable, which indicates what type of light is in usage right now. The problem is that if-else branching does not work correctly - the ...
1
vote
1answer
76 views

Manually writing a dx11 tessellation shader

I am looking for resources on what are the steps of manually implementing tessellation (I happen to be using Unity CG, but any help is appreciated). Today it seems that it is all the rage to hide ...
1
vote
1answer
49 views

Depth Map resolution shifting

the problem is with shadow mapping as you can see, actually it works fine but in a certain condition that the Depth Map size must be equal to the size of rendering buffer, I use an infinite ...
0
votes
1answer
138 views

Optimizations using GLSL shaders

I have written a simple OpenGL application using GLSL shaders. Actually, my program just displays a simple cube with a phong lighting effect like below : Here's a peace of the client code : ...
1
vote
1answer
40 views

Having trouble setting color in fragment shader

For some reason, the color isn't applying to the object. Here's my fragment shader code. There's probably something obvious wrong with it that i'm not seeing. #version 330 core out vec3 Color; ...
0
votes
1answer
92 views

How does OpenGL determine different outputs with shaders?

Lets say I have this GLSL code: #version 330 out vec4 outputColor; void main() { float lerpValue = gl_FragCoord.y / 500.0f; outputColor = mix(vec4(1.0f, 1.0f, 1.0f, 1.0f), ...
0
votes
1answer
116 views

Normal Map Issues

I'm experiencing a very strange result in my very simple normal map implementation on iOS 7 - OpenGL ES 2.0. I'm only using the bare parameters necessary and I'm also skipping on all the tangent and ...
2
votes
2answers
241 views

3D position to UV coordinates in fragment shader

I am interested in converting an arbitrary 3D position computed at run time in the fragment shader to its corresponding UV coordinates. Notice that the 3D position I am interested in is NOT a 3D ...
0
votes
0answers
66 views

Shadow wall sight problems

i used this tutorial https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows to make my shadows. I think its a pretty nice and easy method. I render all my shadow in a Framebuffer and ...
1
vote
2answers
184 views

gl_FrontFacing - is there perfomance cost?

If I use gl_FrontFacing in my PS, is there any performance cost during vertex transformation (like cross product from triangle vertices), or is this value computed any time ?
0
votes
1answer
54 views

blend skybox runtime

I use soil to load the cubemaps. the fragment shader uses cubeMap2 as the current cube map. However, I want to change the cube Map based upon an event. My problem is how can I change the cube map. ...
1
vote
1answer
139 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 ...
1
vote
1answer
221 views

GLSL blur shader algorithm results in a lumpy blur?

I'm writing a Gaussian blur shader and it's coming along pretty well. However, when I run it on a circle, the result is lumpy. I'm using a simple nested for loop to create the blur. Here's the code ...
0
votes
2answers
141 views

Is there a way to optimize this 2D lighting effect shader? [duplicate]

I'm doing a little 2D game in C++ with Direct3D 11. In the game I want to render a sort of shadow that covers part of the screen: To do this I am using this pixel shader: float4 PS_Main( PS_Input ...
0
votes
1answer
71 views

Why would I lose the D3D device during an HLSL unroll?

I have a pixel shader that downsamples a texture from one size to another. The downsample shader uses a nested 'for' loop to traverse the uv coordinates. When the for loop executes more than four ...
1
vote
1answer
1k views

Shader which supports vertex colors and pixel lights?

From my question at Unity Answers: Hello everyone, I'm facing a bit of a problem here: I need a shader which has the ability to colour individual vertices and be lit pixel by pixel. Until recently, I ...
0
votes
1answer
463 views

problem using glm::lookAt and glm::perspective

I'm trying to change the code from the 22th tutorial at http://ogldev.atspace.co.uk/, using the GLM library, but the result seems wrong. The problem is shown in the below picture: While it should be: ...
1
vote
0answers
90 views

Can't understand the Schlick model formula

I'm trying to implement the Schlick shading model in the fragment shader. I took the formulas from Karsten Schwenk's "a survey of shading models for real-time rendering": First of all I don't ...
0
votes
0answers
31 views

Strauss model : no specular component [duplicate]

I implemented the Strauss model with the metalness, transparency and smoothness parameters, taking the formulas from the book "Programming vertex geometry and pixel shaders", this is how I implemented ...
1
vote
1answer
572 views

Two pass blur shader using libgdx tile map renderer

I am trying to apply the following technique: blur effect using two pass shader to my libgdx game using the OrthogonalTiledMapRenderer. The idea is to blur the background wich is also a tilemap but ...
1
vote
2answers
257 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: float alphaX=0.5, alphaY=0.5; // asinotropic roughness float ...
0
votes
0answers
98 views

How can I compute spotlight attenuation when I only have a spotlight cutoff angle?

I am trying to compute the spot light attenuation, though I don't have a spotCosCutoff (cosine of the spotlight cutoff angle) predefined variable in the shader so I have to compute it myself. This is ...
2
votes
2answers
67 views

Compiling 2 Dimensional Constant Arrays Right into Pixel Shader to use as Lookup Table

I want to use a small 2 dimensional look up table in a fragment shader, but I don't want to pay for the performance cost of fetching it from memory for every fragment. Is it feasible/reasonable to ...
2
votes
0answers
229 views

Ashikhmin-Shirley model implementation: ugly result

I am trying to implement the Ashikhmin-Shirley model using these formulas: This is the GLSL 1.2 fragment shader code: uniform vec4 materialAmbient, materialDiffuse, materialSpecular; uniform ...
1
vote
2answers
334 views

What is the depth that a pixel shader may output? Is it necessary to write Depth?

In DirectX11, what does the depth that a Pixel Shader can output mean? Does a pixel shader need to output a depth so that we "write" the depth? If not, why would we output it? For any doubts, I'm ...
3
votes
1answer
209 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 ...
0
votes
3answers
150 views

directional lightning

I have managed to get a point light working, but I am facing problem with directional lightning. Fragment shader uniform vec4 lightColour ; uniform vec3 lightPos ; uniform float lightRadius ; ...
2
votes
2answers
262 views

How can I remove branches from a fragment shader function?

I have a fragment shader, when I've carefully managed to remove most branching decisions, as I have found out through research here that they are bad. But I have one function that I just can't work ...
0
votes
2answers
107 views

Alpha interpolation in a pixel shader

How does the interpolation in a fragment shader work when it comes to the alpha parameter? I'm programming a shader with SharpDX, DirectX11. My idea is to interpolate 2 3d points of a segment, so ...
3
votes
4answers
581 views

How many times fragment shader is executed?

I have an OpenGL code, with 3 different shader programs. I have a simple question, I know fragment shaders are executed for every every fragment in the scene. But is there a way using which we can ...
2
votes
2answers
899 views

Computing pixel's screen position in a vertex shader: right or wrong?

I am building a deferred rendering engine and I have a question. The article I took the sample code from suggested computing screen position of the pixel as follows: VertexShaderFunction() { ... ...
0
votes
1answer
186 views

Why i can not load a simple pixel shader effect (. fx) file in xna?

I just want to load a simple *.fx file into my project to make a (pixel shader) effect. But whenever I try to compile my project, I get the following error in visual studio Error List: Errors ...
1
vote
1answer
266 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 ...
1
vote
0answers
84 views

How do I align textures properly with an exploding sprite / breakable body?

I'm working on a game based on Box2D and Starling which includes breakable bodies - bodies/objects that when hit with sufficient force break apart (into smaller pieces). I've managed the physics part ...
0
votes
1answer
192 views

Creating a fragment shader to darken a white texture over time - OpenGL GLSL

So as a part of learning OpenGL, I've now decided to try and be a bit more creative with shaders, as part of a practice game I'm making using C/OpenGL. I'm completely new when it comes to working ...
2
votes
3answers
988 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 ...
7
votes
2answers
4k views

GLSL Shader - Change Hue/Saturation/Brightness

I'm trying to change the hue of an image using a GLSL fragment shader. I want to achieve something similar to Photoshop's Hue/Saturation Adjustment layer. In the following image you can see what I've ...
4
votes
1answer
813 views

using heightmap to simulate 3d in an isometric 2d game

I saw a video of an 2.5d engine that used heightmaps to do zbuffering. Is this hard to do? I have more or less no idea of Opengl(lwjgl) and that stuff. I could imagine, that you compare each pixel ...
0
votes
1answer
73 views

Vertex and Fragment Shader worldNormal

How to access/calculate worldNormal in a Vertex and Fragment shader ? Thanks a lot !
9
votes
1answer
333 views

How do I implement 2D shadows cast between layers?

How could I implement 2d shadows that are cast by objects in a different layer? NOT like the dynamic lighting in the well known tutorial from Catalin Zima : But like the shadows of the pipes in ...
0
votes
1answer
122 views

Per-fragment lighting system behaves like ambient lighting system

This is the relevant section of my fragment shader varying vec3 normal; varying vec3 halfv; ... vec4 color = ambient * gl_LightSource[0].ambient; vec3 n = normalize(normal); float ...
2
votes
0answers
110 views

Writing to a D3DFMT_R32F render target clamps 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, I set an integer constant ...