A programming language for OpenGL shaders.

learn more… | top users | synonyms

1
vote
1answer
101 views

OpenGL/GLSL/LWJGL return value from shader

I'm trying to do some bone animation. I don't want the whole skeleton to be loaded to the GLSL shader every time, even tough it's not needed, because one vertex is parented to one bone, not more. My ...
1
vote
1answer
84 views

Can drawing to an FBO be done purely with a depth input texture, or do I also need a color attachment?

I am trying to implement Exponential Shadow Maps and I've got it almost working. The part I am stuck on is the "optional" separable Gaussian blur of the depth map to give soft-looking shadows. I am ...
0
votes
0answers
41 views

GLSL billboarding

I want to make billboarding using GLSL. For what I've got so far it works, but not exactly the way I want. My vertex shader looks like this: #version 120 uniform float partSize; varying vec2 ...
0
votes
0answers
48 views

Trying to get the fragment shader to output a list

I am trying to figure out a way to get the Fragment Shader to output a list of gl_VertexID-s. I want to use the GPU to get a list of vertices in the viewing frustum. Is there any way I can get a ...
1
vote
1answer
101 views

Averaging normals, or tangents

I am using a library to load an obj but it doest compute the tangets for each vertex, which I need for normal mapping and pom. I computed my tangets, and bitangents, everything appears to be fine, but ...
0
votes
0answers
106 views

2D GLSL Lighting and Sprites

I'm trying to make a 2D game engine, and I really want to support ambient light as well as multiple point lights that you can define the color, intensity, radius, etc from uniforms in glsl shaders. ...
1
vote
0answers
85 views

glGetUniformLocation returns 23724032

as the title says, I have a problem using glGetUniformLocation call that returns, for the following code, the value 23724032. I'm writing a little engine and the draw function of my models is: void ...
2
votes
1answer
60 views

What will happen if the argument of mix() or clamp() is above 1 or below 0?

There's two magnificent intrisincs: mix() in GLSL and clamp() in HLSL, which are used to implement linear interpolation. Let's say we have a variable: float v = ?; // where ? can be [-FLOAT_MAX, ...
0
votes
0answers
74 views

What limits the number of vertices the GPU can process per clock cycle?

I am currently experimenting with OpenGL to make my own game. I wrote some test code to see what are the limits of my GPU. I own a Geforce 840m. This essentially consists of a draw command ...
0
votes
1answer
144 views

Java, Crashing with a Shader on Intel HD Graphics

I just got a new computer (Acer Aspire ES1-311) which has an integrated Intel HD Graphics card, and I noticed that this fisheye shader crashes my game (LibGDX game, VM Crash): varying vec2 ...
0
votes
1answer
129 views

Getting the real fragment depth in GLSL

I am trying to write a simple GLSL shader that just renders the real (not normalized) depth of a fragment as a floating point value. So far, I've figured out how to get the depth of a vertex, and ...
0
votes
0answers
58 views

SFML - Rendering a torch with a fire animation [duplicate]

I have coded a 3D maze simulator in SFML using raycasting. However, I want to add a torch to the screen, so that the lighting seems more realistic. From my understanding, I would have to use ...
1
vote
1answer
128 views

How does an energy-conservative Blinn-Phong-Fresnel model work?

What is a plausible, basic equation/pseudo-code for energy-conservative Blinn-Phong shading, including Fresnel with a coloured light-source? The net gives so many alternatives that it's hard to ...
1
vote
1answer
132 views

How can I make this shader background more efficient?

I want to use a shader as a background for a mobile game. I'm using libgdx for my project. I've never written glsl before, but here's my attempt so far: http://glslsandbox.com/e#22332.13 On desktop ...
0
votes
0answers
122 views

C++ - SFML - OpenGL - GLSL - smooth waving texture

I have this shaders: Fragment: uniform float time; uniform sampler2D texture; void main() { float t = time; vec2 aux = gl_TexCoord[0].xy; // This would also make waving/deform the ...
1
vote
1answer
151 views

GLSL: Incompatible Types at Initialisation (and no available implicit conversion)

I'm recieving the following error when compiling my GLSL shader: Incompatible types in initialization (and no available implicit conversion) It occurs on line 94: int shadowMap = ...
0
votes
1answer
55 views

Opimized lineral to sRGB glsl code

Currently I use simple and ugly implementation of lineral -> sRGB transfrom float sRGB(float x) { if ( x <= 0.00031308) return 12.92*x; else return 1.055*pow(x,(1/2.4) ) - 0.055; } vec3 ...
0
votes
0answers
40 views

Encoding Floats to RGBA and Blending causing artifacts

I am using float packing to encode a float value inside a RGBA texture because I don't have access to float texture unfortunately. Here are the function I am using for encoding and decoding. inline ...
1
vote
0answers
114 views

Uniform Buffer Binding-points

I believe Uniform Buffers/Blocks has been the hardest thing to grasp in OpenGL. Hopefully this will be my final issue regarding this. I have created a uniform buffer that contain data of Light ...
0
votes
1answer
80 views

Encoding Float to RG/RGBA and Blending

Encoding a float value inside a RG or RGBA texture is very interesting and useful but it is also become quite useless when you use blending as the result and the values might be altered because of ...
0
votes
0answers
104 views

Assimp - generate tangents and bitangents

I have started using Assmip 3.1.1 in my OpenGL application. Let's consider a simple example. Here is obj triangle model: mtllib triangle.mtl v -5.0 0.0 0.0 v 0.0 0.0 0.0 v 0.0 5.0 0.0 vn 0.0 0.0 ...
0
votes
1answer
107 views

Render model with meshes with materials and/or textures

I'm making a model class that is using Assimp in the background. I want my models' meshes to be able to have a material and an optional texture on top of that. Right now I'm doing it like this: for ...
7
votes
1answer
995 views

How to implement this kind of ripples with a GLSL fragment shader?

So I have already implemented the reflection part: uniform sampler2D texture; uniform vec2 resolution; uniform vec3 overlayColor; void main() { vec2 uv = gl_FragCoord.xy / resolution.xy; if (uv.y ...
0
votes
1answer
75 views

Cubemap faces rotation in GS shader

I Can't get correct rotations for cubemap faces. Thats should come to geometry shader, from camera "view" matrix I want make 6 faces for my cubemap, but seems I can't get it correctly... My first ...
0
votes
1answer
171 views

Trying to implement Camera

I'm trying to implement a Camera class in order to walk and look on the world as follow: #ifndef _CAMERA_H_ #define _CAMERA_H_ #include <glm\glm.hpp> class Camera { public: Camera(); ...
1
vote
1answer
145 views

How to calculate reflection vector from point sprite sphere?

So far I achieved building a cube map following this tutorial. Then I drew three points using glDrawArrays(GL_POINTS,0,3) and calculate the normals based on a sphere. To compute the incoming light ...
0
votes
1answer
143 views

Fragment Shader output type error

StackExchange! I've been working with opengl for a bit and I'm trying to finally load the shaders instead of having them inline. I'm having a ton of issues, though. As soon as I solve one, another ...
2
votes
1answer
76 views

Failing to move exponential depth term to depth shader in exponential shadow mapping

I'm playing around in my little toy project to see if I can understand how exponential shadow mapping works. To begin, I have the following two fragment shaders: Light depth texture shader ...
-1
votes
1answer
96 views

how to turn (or solidify) water or fuild into solid material (Renderring Effect)

i want to implement an effect like this. for example, let's assume the clay are made of particles. liquids of clay flows for a while, then it becomes dry and rest.finally those particles becomes only ...
4
votes
1answer
586 views

C++ OpenGL ShadowMap Issue/Artifacts

I am currently implementing basic shadow mapping in my C++ Custom Engine using GLSL 4.10. It is currently working with basic PCF anti-aliasing and very minimal reduction for unwanted artifacts. Here ...
0
votes
1answer
78 views

Reconstruct shader vertices in OpenGL

I'm not sure if 'reconstruct' is the correct term for this but essentially what I am trying to do is calculate vertex positions (that are already calculated via shader) on the CPU for the purpose of ...
-1
votes
1answer
159 views

How to optimize my lighting shader?

I want to create a lighting effect on a gray-scaled world using cocos2d-x. What I've done is creating a layer which runs a shader program that receives light positions and radiuses as input and ...
0
votes
2answers
55 views

Overload how an object instance of a class is treated when used

So I've made this struct that encapsulates a glm::vec4. This is because vec3s are treated as 16-byte in GLSL, but I don't want to assign a vec4 if I only really need 3 components. Anyway, my question ...
0
votes
1answer
100 views

Ray casting problem using JOGL

I'm trying to port an old perfectly functioning ray casting implementation from my lwjgl project (FF pipeline) to a new project using JOGL and shaders. My problem is that my ray no longer intersects ...
0
votes
0answers
116 views

Artifacts rendering high-poly procedural meshes with OpenGL

I am having some issues when rendering some procedural generated meshes. There are some really wierd artifacts when rendering high-poly count meshes (not that much actualy). I have been able to ...
3
votes
1answer
445 views

I want to render some surfaces in GLSL with normal maps, and some without

I have normal mapping working in my game, but I want to only use normal mapping for some surfaces, and not others. Right now, as far as I can tell, my shader is applying an incorrect normal of (0, 0, ...
0
votes
0answers
92 views

Dynamic VBO update possibly corrupting data?

I want to draw a line between two vertices. On a mouseclick the vertex data will change and I want to update the line to use the new values. I am using a VBO for this and it looks like the update ...
1
vote
1answer
127 views

How do I convert from rectangular to spherical coordinates?

This seems like a fairly basic and common problem. Is there a builtin way to achieve it or do I have to write the algorithm on my own? If I do, how should it work?
0
votes
3answers
302 views

Combine flat and smooth shading with a single model geometry

I need to be able to switch between smooth and flat shading interactively. Is there a way to do this efficiently with a single geometry? For example, smooth shading does not require duplicate ...
0
votes
0answers
93 views

Tessellation shader pass-through : Nothing displayed

I am trying to set a pass-through tessellation shader and then build on top of that while learning. From what I found/read I need to do in the TE shader everything that was done in the vertex shader ...
1
vote
1answer
67 views

Is it possible to look up a texel from a texture in GLES2 GLSL framgent shader without using sampler?

Is there some way I can directly access texture memory from fragment shader in GLES2 GLSL? I don't need the sampler to be involved since I am just using it as a look-up table.
1
vote
1answer
188 views

Is it possible to use unnormalized texture coordinates from a GLES2 GLSL fragment shader?

I want to look up a texel from my GLES2 GLSL fragment shader using un-normalized texture coordinates (0-w, 0-h instead of 0-1, 0-1). The reason is that this texture is used as a look up table and I ...
0
votes
1answer
136 views

Uniform Block solve padding/alignment for vec3 in CPU struct

I have a struct on the CPU which I'm sending to a uniform block in my shader. After a bit frustration I finally got it to work. The problem I had was that vec3s are actually treated as 16-bytes, or in ...
1
vote
1answer
53 views

What is the fastest way to know if the current coordinate in screen-space is odd or even in GLSL/GLES2 frag shader?

I want to make a post-effect where every second column of pixels is colored differently, and I want to implement this as a GLSL fragment shader on GLES2. The question is what is the most effective way ...
1
vote
1answer
192 views

Basic terrain shader without using external texture

I have this: (Right now I have the height map in a x*x size 2D array and a 1D vector too.) What I am trying to achieve is something like this: Without using any textures, only plain colors. So ...
0
votes
0answers
26 views

Artefact in VSM as if GL_DEPTH_TEST disabled

I am trying to implement VSM and I incurred in a strange issue. I render them as follow: glUseProgram(shadowMapProgramID); glEnableVertexAttribArray(0); glBindFramebuffer(GL_FRAMEBUFFER, ...
0
votes
0answers
26 views

Transform screenquad around object's view space boundaries (GLSL)

Im not sure how to ask this, but essentially I am looking for a way to optimize rendering screen quad lights per object. I have a deferred renderer that draws directional lights onto a screen quad. ...
1
vote
2answers
444 views

How can I pass a std::vector<Vector3f> to my shader?

I have a Vector3f type which has x, y, and z properties. I have a std::vector of these vertices which describe my terrain. I would like to pass these values to a vertex shader through a uniform ...
2
votes
1answer
146 views

Shader - Transmittance or Absorption

I am trying to create a transmittance or absorption shader (glsl, hlsl, cg, etc...) in realtime but I don't find any good tutorial or white paper about this subject. I only find offline rendering ...
1
vote
1answer
152 views

Is it possible to calculate the TBN matrix in the fragment shader?

Just from model position, model normal and texture uv?