A programming language for OpenGL shaders.

learn more… | top users | synonyms

0
votes
1answer
82 views

How can I avoid applying textures to a fragment in a shader when the surface normal is (0, 1, 0)?

I have a small GLSL shader with a vertex shader and a fragment shader. I want to avoid applying textures to faces that have a normal equal to (0, 1, 0). Is this possible? These are my shaders: ...
1
vote
1answer
118 views

Separate shader programs or branch in shader? [duplicate]

I have a bunch of point lights and directional lights. Instead of checking the light type in the fragment shader and then branch for either point light calculation or directional light calculation, is ...
2
votes
0answers
128 views

Blank texture in Frame Buffer Object in Deferred Rendering

I'm running the tutorial 35 from olgdev.atspace.co.uk, and it's so strange that the result is a blank screen. This tutorial is performing the first step of Deferred Shading, which means decoupling of ...
1
vote
1answer
241 views

View to normal calculation in GLSL

Sorry for the terrible title, but I really cant think of anything better.. Suggestions welcome. I am trying to do something like showcased in this video: http://www.youtube.com/watch?v=CaTI2d0tQME ...
0
votes
0answers
56 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
189 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
2answers
225 views

When is the Z coordinate normalized in GLSL?

I thought that whenever you transform an object to world space, then view space and finally screen space, the last matrix you apply(the projection matrix) normalizes the z values between 0 and 1. ...
1
vote
1answer
137 views

How does HLSL handle clip(vector)?

My goal is to convert clip() to GLSL, version 1.5. I'm currently doing a basic: if (x < 0) discard; But if x is not a scalar, obviously I can't use the "<" operator. So I'm wanting to ...
0
votes
1answer
95 views

Why do the ALPHA channel in TGA is not visible?

Good morning GDSE, I am loading a TGA using loadTGA function found in superbible 4th edition source code. Here is how the image looks in Gimp You can see I have enabled alpha channel in Gimp, I ...
5
votes
1answer
462 views

Exponential Variance Shadow Mapping - implementation

I use a variance shadow mapping with a "standard" light bleeding fix in my graphics engine which is based on deferred rendering.. I have a single shadow map for a directional light beacause a test ...
2
votes
1answer
242 views

Is this GLSL equivalent to this HLSL?

I was wondering if the both shader codes are equivalent. So the question is, is this GLSL vNormal = mat3(FUSEE_ITMV[0].xyz, FUSEE_ITMV[1].xyz, FUSEE_ITMV[2].xyz) * fuNormal; Equivalent to this ...
0
votes
0answers
77 views

OpenGL moving a texture

I am working on a game, i have a model to which i have attached multiple textures. Both the textures are static, but If i want to move the texture which is at the top, is it possible? By top i mean, ...
1
vote
1answer
122 views

How can I extract the RGB color data from a TGA image?

I am working in OpenGL, and I am trying to create terrains using height maps. I am using my own functions to load a TGA image, and in order to pass data to heightmap vertex shader I need to retrieve ...
1
vote
1answer
116 views

Fragment shader seems to floor() imprecisely

I'm trying to interpolate coordinates in my fragment shader. Unfortunately if close to the upper edge the interpolated value of fVertexInteger seems to be rounded up instead of beeing floored. This ...
0
votes
1answer
124 views

fragment shader directional light positioning with camera

Im trying to set up directional lighting in the fragment shader. So the direction of my light moves with the camera position. #version 150 core uniform sampler2D diffuseTex; ...
2
votes
1answer
244 views

Aquire disassembly of shader code

Is there a way to get the disassembly that your driver generates when compiling a shader? I noticed that you can get an accidental disassembly dump if you go over the maximum thread group size ...
2
votes
2answers
290 views

GLM Velocity Vectors - Basic Maths to Simulate Steering

UPDATE - Code updated below but still need help adjusting my math. I have a cube rendered on the screen which represents a car (or similar). Using Projection/Model matrices and Glm I am able to ...
2
votes
1answer
46 views

Accessing 3D texture data without normalized coordinates directly, but with filtering

texelFetch() exists to access texture data with texture coordinates in "image dimensions", but texelFetch skips filtering. In case of 2D textures, it's possible to use a rectangle texture sampler to ...
1
vote
2answers
220 views

OpenGL position from depth is wrong

My engine is currently implemented using a deferred rendering technique, and today I decided to change it up a bit. First I was storing 5 textures as so: DEPTH24_STENCIL8 - Depth and stencil ...
1
vote
2answers
501 views

In GLSL is it possible to offset vertices based on height map colour?

I am attempting to generate some terrain based upon a heightmap. I have generated a 32 x 32 grid and a corresponding height map -> In my vertex shader I am trying to offset the position of the Y ...
0
votes
1answer
144 views

Problems when rendering code on Nvidia GPU

I am following OpenGL GLSL cookbook 4.0, I have rendered a tesselated quad, as you see in the screenshot below, and i am moving Y coordinate of every vertex using a time based sin function as given in ...
1
vote
0answers
118 views

GLSL, Internal error: assembly compile error for fragment shader at offset 513

My vertex and fragment shaders link correctly. When I try and link my shader program I get the error: "Internal error: assembly compile error for fragment shader at offset 513". Pastebin of fragment ...
2
votes
1answer
181 views

Incorrect lighting results with deferred rendering

I am trying to render a light-pass to a texture which I will later apply on the scene. But I seem to calculate the light position wrong. I am working on view-space. In the image above, I am ...
1
vote
0answers
106 views

Bad texture on model with different GPU [closed]

I have some kind of distortion on the texture of my 3D model. It works perfectly well on an AMD GPU, but when testing on a integrated Intel HD graphics card it has a weird issue. I don't have a ...
3
votes
4answers
427 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
317 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
73 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
53 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 ?
4
votes
3answers
837 views

Implementing skeletal animation and GPU skinning (DOOM MD5)

DISCLAIMER This question has been completely rewritten to narrow the scope of the question in light of previous suggestions and answers, but the same problem still persists. Currently I'm trying to ...
1
vote
1answer
494 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
185 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
242 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 ...
3
votes
1answer
527 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 : ...
1
vote
2answers
777 views

Developing GLSL Shaders? [closed]

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
168 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
280 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 ...
0
votes
1answer
495 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
160 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
456 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
2answers
689 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
295 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
219 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
85 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
230 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
62 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
167 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
143 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 ...
2
votes
1answer
995 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
550 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
138 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; ...