Tagged Questions
0
votes
0answers
40 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
84 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
61 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
votes
1answer
64 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 ...
1
vote
1answer
47 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
122 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
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
428 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 ...
0
votes
0answers
93 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
0answers
224 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 ...
3
votes
1answer
208 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
147 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
248 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
105 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 ...
0
votes
1answer
180 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
0answers
83 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
189 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 ...
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 ...
0
votes
1answer
72 views
Vertex and Fragment Shader worldNormal
How to access/calculate worldNormal in a Vertex and Fragment shader ?
Thanks a lot !
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 ...
1
vote
1answer
931 views
Volumetric Fog Shader - Camera Issue
I am trying to build an infinite fog shader. This fog is applied on a 3D plane.
For the moment I have a Z-Depth Fog. And I encounter some issues.
As you can see in the screenshot, there are two views.
...
2
votes
1answer
341 views
Fog shader camera problem
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. ...
3
votes
2answers
147 views
Opengl shader questions
I'm currently building a shader that takes a 2D texture sampler and uses UV coordinates to map it. This works fine for all textured objects. However, I'm having a bit of a problem as I'm trying to ...
2
votes
2answers
254 views
3D Distortion Effect
I'm trying to make a distortion effect similar to this:
However I'm not making a 2d screen space effect. I'm applying it to a 3d scene and I want it to be placed IN the world, so it can be blocked ...
0
votes
1answer
109 views
Shader registers for different graphics card
The title is not very explicative, so i'll try to make myself clear.
I have two "working"(on which i work on) PCs : a desktop that runs an NVIDIA GT440 an a laptop with a RADEON HD 4650. I have a ...
2
votes
1answer
102 views
What is a Fragment Pipe?
I remember someone saying "24 fragment pipes on nVidia 7800" in a presentation.
Am I correct in saying that a fragment is the data that can generate a pixel in the frame buffer? Or are fragments the ...
7
votes
1answer
967 views
Optimizing performance of a heavy fragment shader
I need help optimizing the following set of shaders:
Vertex:
precision mediump float;
uniform vec2 rubyTextureSize;
attribute vec4 vPosition;
attribute vec2 a_TexCoordinate;
varying vec2 tc;
...
1
vote
1answer
74 views
I have a frag shader, one with an empty s_lightMap, how and why is it effecting the output?
I have an image of concrete rocks of different shades of colors, and I'm applying this shader, but without referencing s_lightMap's uniform in my program:
precision mediump float; ...
1
vote
1answer
368 views
GL_EXT_shadow_samplers killing my shader
I have the following fragment shader for my scene
#extension GL_EXT_shadow_samplers : require
...
vec4 color = texture2D(uTextureUnit0, varTexCoord0);
if (colorTransformEnabled != 0) {
vec3 ...
1
vote
1answer
1k views
How to do Triplanar Texturing
Ok maybe i'm missing something because its getting late and i've been programming now for about 72 hours straight (minus a nap or 2) ...
I'm trying to write a shader for unity that will apply ...
4
votes
1answer
219 views
Premultiplied Alpha And Alpha Testing
I have a shader that is supposed to work with either alpha blending or alpha testing, but the color values being passed in are premultiplied alpha values.
Is there an easy/standard way to have it ...
0
votes
2answers
207 views
How to implement input-texture limited alphablending of 2 textures with HLSL?
I try to implement a HLSL shader the does the normal Alphablend with premultiplied colors (just as XNA4 does) but depending on some existing colors. One can think of adding a glow to a 2D terrain ...
1
vote
1answer
383 views
Apply portion of texture atlas
I'm trying to write a shader that only maps a portion of a large texture to my sprite and I'm getting a strange behaviour with my current code.
This is what I have right now:
Texture atlas ...
2
votes
1answer
617 views
shader coding: calculate screen coordinates of fragment
Good morning,
I'm new to shader coding and trying to implement some visual effects code in shaders using billboards. (Yes, I couldn't have picked anything harder to start with, but I'm lucky that way)
...
11
votes
1answer
1k views
Toon/cel shading with variable line width?
I see a few broad approaches out there to doing cel shading:
Duplication & enlargement of model with flipped normals (not an option for me)
Sobel filter / fragment shader approaches to edge ...
12
votes
2answers
972 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 ...
1
vote
1answer
252 views
Why can't a blendShader sample anything but the current coordinate of the background image?
In Flash, you can set a DisplayObject's blendShader property to a pixel shader (flash.shaders.Shader class).
The mechanism is nice, because Flash automatically provides your Shader with two input ...
2
votes
1answer
232 views
Graphic hardware texture formats shaders relational speed
I'm interested to know, is there a direct correlation to the speed that a shader will run based on the bit depth of a texture upon which it is running. For example: If I have a 2 bit stencil texture ...
7
votes
5answers
3k views
What rendering techniques would I use to draw a drop shadow effect for cards in a card game?
What type of shading algorithm might be used to create shadows like these?
the one I'm making is similar but it is all done with a 2D drawing API powered by OpenGL so there is no Z coordinate.
In ...
1
vote
0answers
523 views
How can I run the pixel shader effect? [closed]
Stated below is the code for my pixel shader which I am rendering after the vertex shader.
I have set the wordViewProjection matrix in my program but I don't know to set the progress variable i.e in ...