A programming language for OpenGL shaders.
2
votes
3answers
148 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 ...
0
votes
1answer
85 views
GLSL billboard move center of rotation
I have successfully set up a billboard shader that works, it can take in a quad and rotate it so it always points toward the screen. I am using this vertex-shader:
void main(){
vec4 tmpPos = (MVP * ...
0
votes
0answers
61 views
Triangle Clipping
I want to determine which part of a triangle is visible in a frustum in OpenGL, is there a way to get visible coordinates of triangle in the viewing frustum?
0
votes
1answer
43 views
Working with floats in OpenGL ES 2
Are there any reasons or situations one would use in their shader float(1) over just 1.0 ?
3
votes
2answers
308 views
MD5 vertex skinning problem extending to multi-jointed skeleton (GPU Skinning)
Currently I'm trying to implement GPU skinning in my project.
So far I have achieved single joint translation and rotation, and multi-jointed translation. The problem arises when I try to rotate a ...
0
votes
1answer
44 views
GLSL 2d Per Pixel Lighting
First time writing shaders, and having a bit of an issue getting per-pixel lighting to work. The problem is pretty simple, but I'm afraid am doing something wrong here.
Vertex Shader:
#version 150
...
1
vote
1answer
78 views
Bump mapping Problem GLSL
I am having a slight problem with my Bump Mapping project. Although everything works OK (at least from what I know) there is a slight mistake somewhere and I get incorrect shading on the brick wall ...
1
vote
0answers
50 views
Geometry shader and triangle adjacency
I'm currently trying to change my project to use GL_TRIANGLE_ADJACENCY instead of GL_TRIANGLES.
Following this question, I have managed to construct my index buffer fine, but when it comes to the ...
2
votes
0answers
106 views
Shadow mapping does not work correctly using GLSL shaders
I'm a beginner in shadow mapping. I have in my scene two meshes : a cube and a floor. The scene is lighted by a single point light.
Here's for the following display the light properties :
...
0
votes
2answers
201 views
Developing GLSL Shaders?
I want to create shaders but I need a tool to create and see the visual result before I put them into my game. As to determine if there is something wrong with my game or if it's something with the ...
0
votes
2answers
61 views
HLSL's Tex2D for GLSL?
I am trying to port a HLSL shader to GLSL. I'm just not quite sure how to convert this line:
outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(-4.0 * pxSz.x * blurSize,0)).a * 0.05;
...
3
votes
1answer
138 views
OpenGL FBO not being drawn to
In my project I'm trying to implement a deferred rendering system, problem is, I can't seem to get a second FBO to work.
UPDATE 1
Here is the FBO initialization code:
/// G-Buffer FBO
GLuint ...
-1
votes
1answer
85 views
GLSL - Declaring global variables outside of the main function scope
Does it help to declare variables outside of your main function scope in GLSL? Do these variables actually get reused and is it more efficient?
Here is the code in question:
varying vec2 vposition;
...
1
vote
2answers
62 views
GLSL: define a constant for both vertex and fragment shader
I have a constant for defining an array in the vertex shader. I want to use this constant also in the fragment shader to define another array of the same size. Naive attempts fail (simply use the ...
6
votes
1answer
247 views
How would one draw many objects using the same VBO
I'm kind of stuck with this question for some time now, maybe because I don't know exactly what to search for, it might be a term I have not heard of yet as most tutorials ends after drawing one ...
0
votes
1answer
214 views
Draw wireframe overlay of model in GLSL
I have a 3D model that has a GLSL script, and I want to draw a line on each border of its polygons in the fragment shader.
What should I do? Note: I am using Ogre3D, so I can't use OpenGL's ...
3
votes
0answers
186 views
Jet engine exhaust shader [closed]
How would I create a jet engine exhaust effect, as shown in the image from Fzero GX below.
GLSL and OpenGL examples/solutions are prefered, though other resources are also welcome.
Requirements
...
0
votes
0answers
97 views
Fragment shader not applying intended color to output
I started working with OpenGL recently, having previously worked on mods. I'm using GLFW3, GLEW, and whatever tutorials I can find. So far I've come up with this code:
//Headers
#include ...
0
votes
0answers
71 views
Normal mapping and translation, lighting not displaying correctly
I got a normal mapping issue. I have a texture and a normal texture on each model loaded via the ASSIMP library.
I am calculating the tangent vectors on each object with the help of the ASSIMP ...
7
votes
2answers
184 views
Diffuse Reflection confusion
From what I've read, with a simple directional light, the color of a point, if you only take diffuse reflection into account (intensity = 1), should be
color = color_of_point * color_of_light * ...
3
votes
2answers
39 views
Local shape color blending
I am trying to implement this in Unity 4 Pro.
But I am stuck in the blending part. I don't understand how you could blend multiples textures/colors using multiples volumes on an object. How could you ...
0
votes
1answer
106 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 ...
0
votes
0answers
116 views
Shadow-casting through time acting in “reverse” before next notciable shadowmap update
question was re-written to better explain the problem
I have a scene of big thin parallelepiped, small cube, and a light source, all aligned on Y axis, like so:
_
| |
| |----[ ]----Light
|_|
Both ...
0
votes
0answers
50 views
Apply UV map texture to model in GLSL
I am using Ogre3D and I have a bunch of 3D models with UV mapping done in Blender, and I have to apply a texture to them. How is this done in GLSL? I don't want anything fancy, I just want to see the ...
1
vote
1answer
230 views
Skyboxes using glsl Version 330
So I am trying to get a skybox working with OpenGL 3.3 and glsl Version 330. After scouring the web for a while, I could not find a completely modern OGL skybox tutorial anywhere, so I found an older ...
0
votes
3answers
266 views
OpenGL tile rendering
Currently I'm trying to render a TileMap using OpenGL 2.1, GLSL 1.2.
I would like to draw every tile in just one draw call.
I use a single texture with all tiles, identifying each one by an index.
...
0
votes
1answer
85 views
VBO in a class doesn't draw when The class has a destructor
I am making this class QuadTemplate
class QuadTemplate
{
public:
QuadTemplate()
{
vbo=0;
uvbuffer=0;
vao=0;
TextureID=0;
vboType=0;
...
3
votes
2answers
253 views
Rotating an object when the center in not the origin - opengl
I'm beginning with GLSL and I learning the basic, I am using glm to do the matrix calculations at this point everthing ok,the problem is how I can move the origin to the center of my object, not the ...
3
votes
1answer
87 views
Directional light shader not behaving as expected
I coded my first glsl shader which manage diffuse and specular effects of a directional light.
This is the fragment shader.
#version 120
//matrix
uniform mat4 model_matrix;
//directional light ...
5
votes
2answers
837 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 ...
1
vote
0answers
74 views
Matrix array doesn't seem to get populated
I'm trying to stream an array of matrices to a vertex shader, but it seems that only the first matrix works. What could be the problem? I suspect that I upload the matrices in a wrong way.
C#
...
3
votes
1answer
593 views
Incorrect GPU skinning
I'm having some problems with implementing skinning and skeletal animation. It seems that the skeleton and the mesh are loaded correctly, but the mesh gets funky when the bone transformations are ...
2
votes
2answers
111 views
Using two shaders instead of one with IF statements
I've been working on porting a relatively large opengl ES 1.1 source to ES 2.0.
In OpenGL ES 2.0 (which means, everything uses shaders), I want to draw a teapot three times.
The first one, with a ...
3
votes
1answer
140 views
Do GLSL 4.x subroutine variables cause any performance overhead?
There's not too much deep information about them on the web.
How are they implemented and how they work under the hood? I'd like to know that they cause any performance overhead or not, especially in ...
0
votes
1answer
58 views
Vertex and Fragment Shader worldNormal
How to access/calculate worldNormal in a Vertex and Fragment shader ?
Thanks a lot !
0
votes
1answer
146 views
GLSL: Strange light reflections
According to this tutorial I'm trying to make a normal mapping using GLSL, but something is wrong and I can't find the solution. The output render is in this image:
Image1
in this image is a plane ...
2
votes
1answer
64 views
Shader Variable Types
I have a simple question. what are the meaning of :
half4 myHalf;
myHalf.yyyy;
myHalf.xxzz;
// or
myHalf.yw
Thanks a lot !
3
votes
2answers
309 views
GLSL Atmospheric Scattering Issue
I am attempting to use Sean O'Neil's shaders to accomplish atmospheric scattering. For now I am just using SkyFromSpace and GroundFromSpace. The atmosphere works fine but the planet itself is just a ...
1
vote
1answer
117 views
How to do directional per fragment lighting in world space?
I am attempting to create a GLSL shader for simple, per-fragment directional light. So far, after following many tutorials, I have continually ran into the issue: my light is specified in world ...
4
votes
1answer
123 views
Better solution for boolean mixing?
Sorry if this question has been asked in the past, but searching Google and here didn't yield relevant results, so here goes.
I'm working on a fragment shader that implements both conditional/boolean ...
2
votes
1answer
130 views
TBN Matrix : Eye vs. World Space Conflict
I am tired of misleading and insufficient articles making me more confused each time I read, I need a clarification that will solve my TBN matrix problem forever.
Each article I read informs me ...
1
vote
1answer
433 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.
...
0
votes
0answers
107 views
GLSL gl_ModelViewMatrix breaks my code?
So I have the following shaders which work (to the extent that they are completed anyway).
//Vertex Shader
uniform float offset;
void main()
{
gl_TexCoord[0].t = gl_MultiTexCoord0.t;
...
2
votes
1answer
138 views
What is the interval of fragment-shader code execution?
Without any intended delay, is the code of a fragment-shader run once per frame? If not, how often will the code be executed? (I'm new to shaders: I'm talking about glsl if it makes any difference)
0
votes
1answer
150 views
Shader program compiles fine on Ati, fails on other vendors
Got a real annoying problem here.
My shader program compiles fine on my Ati Radeon HD card, but on Nvidia and Intel it failes to compile.
Vertex shader:
#version 120
attribute vec3 in_position;
...
0
votes
2answers
219 views
What is the best method to update shader uniforms?
What is the most accepted way for keeping a shader's matrices up to date, and why?
For example, at the moment I have a Shader class that stores the handles to the GLSL shader program & uniforms. ...
2
votes
1answer
139 views
GLSL Multiple Uniform Structs
I'm developing a lighting system for my voxel game, and I have to send multiple (alot, say up to 200) lights to my shader program. Those lights contain the following data:
Position (vec3)
Color ...
2
votes
1answer
186 views
Simple Optimized Blur Shader
I have a vertex-fragment shader that use the Unity3D GrabPass functionality (it grabs the screen). And I apply my GrabPass to have a transparent effect.
GrabPass {
"_GrabTex"
}
sampler2D ...
1
vote
1answer
247 views
GLSL Light (Attenuation, Color and intensity) formula
I'm implementing point lights in my Voxel engine, and I'm really struggling to get a good flow of light, from 100% near the light source to 0% at the light radius.
I have 5 arguments for the ...
-1
votes
1answer
135 views
OpenGL shader problem
So, I've been working on this game engine for a while now, and just the other day my friend tried running the program and his output doesn't match my output...
My Program Output:
His Program ...