Questions tagged [fragment-shader]

A GPU program used in rendering. It is executed for each sample taken from a rasterized primitive. The output of this process is a number of values and a floating-point depth.

Resources

1506 questions
0
votes
1 answer

Shader Texture Always Facing The Camera

I have this basic shader, though I ran into some trouble which really bugs me! I'm applying the texture using the fragment shader though however I move or rotate the camera, the texture on the face will always be facing the camera (I've added a GIF…
vallentin
  • 23,478
  • 6
  • 59
  • 81
0
votes
1 answer

Shader not showing up properly

I've been playing with shaders with a toy called ShaderToy and trying to create a top-down view water effect for a 2D game based on the code (for the shader) from Jonas Wagner. You can easily copy/paste this code in ShaderToy and see the effect. The…
Ivan
  • 51
  • 1
  • 6
0
votes
2 answers

GLSL for loop acting weird

I tried to implement something in glsl to do texture splatting, but the for loop is acting weird and gives different results for code that does exactly the same. Code 1: for(int i = 0; i < 5; ++i) { if(i == 1) { float fade =…
0
votes
1 answer

2D GLSL light radius/intensity

I have a simple GLSL fragment shader that I'm using for 2D lights, is there any way to modify this to implement setting a light's radius and/or intensity? Currently the only modifications available are to the constant/linear/quadratic light…
user1560249
  • 343
  • 2
  • 5
  • 14
0
votes
1 answer

Sampler1D mapping blank with no errors

I eventually hope to colorize an image based on 3 1d samplers. I wrote this quick program to test if I could map the red channel of a texture to itself, a so called linear mapping. Right now the code is showing a blank screen, despite all of my…
Mikhail
  • 7,749
  • 11
  • 62
  • 136
0
votes
2 answers

Can't draw triangle using Opengl

in this code i want to draw a simple triangle on a blue background using openGL however when i compile and run the code only a window with the blue background appears (without the white triangle that is supposed to be drawn), iam using Xcode my…
BulBul
  • 1,159
  • 3
  • 24
  • 37
0
votes
2 answers

OpenGL ES Green Screen... But I want to use black

This works great for green screen, my background is green and using this code it makes green = alpha. lowp vec4 textureColor = texture2D(u_samplers2D[0], vTextu); lowp float rbAverage = textureColor.r * 0.5 + textureColor.b * 0.5; lowp float gDelta…
Ian Clay
  • 592
  • 1
  • 8
  • 18
0
votes
1 answer

Fog shader camera

I have some difficulties with my vertex-fragment fog shader in Unity. I have a good visual result but the problem is that the gradient is based on the camera's position, it moves as the camera moves. I don't know how to fix it. Here is the shader…
MaT
  • 1,556
  • 3
  • 28
  • 64
0
votes
1 answer

Fragmentshader and framebuffer solid colour

Dear Stackoverflowers, Lately I have been making my first baby steps in the world of shaders, using GLSL and openGL in C# with OpenTK, and I've stumbled into some problems which I seem to be unable to solve. I started off with one shader program and…
Perry
  • 98
  • 7
0
votes
1 answer

Calculate percentage of a fragments depth position relative to a range

In my fragment/pixel shader I am trying to calculate a fragment's depth position in percent [0-1] in an given range. What I have is a bunch of shapes (there is no relative data given from them) but all the shapes have one thing in common and that…
Placeable
  • 589
  • 8
  • 22
0
votes
1 answer

OpenGL Shaders Generate Colors

I have a sprite 10x10 pixels. How can i change colors with shaders-programm in real-time. All the blue color on the sprite turned to green. All the green color on the sprite turned to white. ETC... Example of Sprite 10x10 This is example of…
Dino Balloons
  • 79
  • 1
  • 1
  • 6
0
votes
1 answer

error when creating program and trying to get attribute Location | Opengl ES 2.0 Android

I am trying to draw a textured square on the screen, but whenever I try to use glGetAttribLocation it gives me a runtimeException and glError 1280. I have no clue why when tested on a new end device, such as Samsung Galaxy S 3, no error was found.…
Baruch
  • 1,618
  • 5
  • 23
  • 42
0
votes
1 answer

opengl es 2.0 specular lighting

this is my very first post here but I'm banging my head against a wall trying to figure out this problem. The code below is my fragment shader for an incredibly simple Opengl es 2.0 app. The vertex shader is doing all the usual business. The…
0
votes
1 answer

Particle System error

Im working in Particle System Class from this tutorial Particles - Anton's OpenGL 4 Wiki - Dr Anton Gerdelan Code: //Pixel Shader // shader to update a particle system based on a simple kinematics function #version 150 in vec3 v; // initial…
0
votes
1 answer

How to properly declare variables in CSS custom fragment shader?

For some reason every time I declare a custom variable in my CSS fragment shader, the shader stops working. I have no idea why this is the case since I'm quite sure the syntax is correct. Here is my HTML code and my CSS: #holder{ width:600; …
Discombobulous
  • 1,112
  • 2
  • 14
  • 25