A programming language for OpenGL shaders.

learn more… | top users | synonyms

0
votes
0answers
27 views

How much is atomicAdd slower than an atomic counter?

I am considering replacing an atomic counter in my shader code with a SSBO an atomicAdd operation. What I need to know is the difference in performance of these two. I know the atomic counter executes ...
1
vote
2answers
42 views

glsl uniform int as index of const array

I have a const array that define a few materials for directionnal light. I'd like to change the material using an uniform int as index of that array. Doing that leads to severe framerate drop. I know ...
0
votes
0answers
32 views

loading a model, which has multiple meshes using assimp

I have been using Open Asset Import library(assimp) along with OpenGL API to load and render 3D models. I followed some tutorials and have got the output as expected. But, I have failed to understand ...
0
votes
0answers
25 views

Achieve SSAO with deferred rendering,GLSL

I'm trying to add SSAO effect to my engine and it doesn't look as it should. To achieve this effect I based on this article. I'm using also deferred renderer so I entered some modifications: ...
0
votes
2answers
41 views

Passing array to uniform in glsl error

Here is my attemps to pass array to uniform array: struct Vector{ float x,y,z; } float threshold[2] = { 0.5, 0.25 }; Vector *kernel = new Vector[_kernel_size]; // _kernel_size==16 // fill kernel ...
1
vote
1answer
50 views

OpenGL Post Processing Introducing Artifacts on Certain Systems

Playing around with God-Rays in my framework, I was greeted with the following artifacts on my laptop: The artifacts themselves act almost like noise, flickering around the image rapidly. They also ...
0
votes
0answers
25 views

Motion Blur (as per GPU gems article) only considers camera rotation, not translation

I am following this article and have implemented it exactly as described: http://http.developer.nvidia.com/GPUGems3/gpugems3_ch27.html The problem is that things are only blurred when the camera is ...
-1
votes
2answers
88 views

How can I optimize these GLSL bitwise operations?

I need the following part of my vertex shader simplified. Sb=Sb|((gl_VertexID&(128+1))<<9); Sb=Sb|((gl_VertexID&(512+4))<<6); Sb=Sb|((gl_VertexID&(2048+16))<<3); ...
3
votes
1answer
111 views

If-clause in GLSL

I read a few thing about, that in GLSL both sides of the if-clause is executed, so do you have any idea for a workaround for this one: uniform int uses_bones; uniform mat4[] bone_transformations; ...
1
vote
1answer
34 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
52 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
27 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
37 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
69 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
52 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
66 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
56 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
52 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
84 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
48 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
57 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
81 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
73 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
72 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 ...
0
votes
1answer
43 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
37 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
26 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
56 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
41 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
47 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
64 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
509 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
55 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
110 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
76 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
91 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
50 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
58 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
334 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
69 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 ...
0
votes
1answer
90 views

Grayscale and 2D lighting using cocos-2dx

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
53 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
67 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
77 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
349 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
53 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
81 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
2answers
146 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
71 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
53 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.