2
votes
2answers
104 views

Render with multiple lights (one pass per light)

I have already a system that at the moment handle multiple lights just passing an array of light struct and loop through it. I had been told to switch to a multipass rendering approach. How should I ...
1
vote
1answer
81 views

GLSL to Cg: why is the effect different?

With reference to this question, where I was trying to make the shader compile, I am now trying to make an effect appear. The effect can be shown here, through a GLSL shader: But when I use the ...
0
votes
2answers
63 views

Passing variables down the pipeline glsl

I am sorry to post a question that may be easily tested, but I don't have an OGL4+ hardware at the moment and I have to make some design decision beforehand so I wanted a clear scenario. Looking at ...
0
votes
1answer
40 views

GLSL to Cg fragment shader

I have found very useful resource on the Swiftless website on OpenGL. Unfortunately, I cannot manage to adapt a GLSL fragment shader to my project, which uses Cg. Here it is: uniform sampler2D ...
0
votes
0answers
109 views

Problem when using two different shaders

I have created a simple shader for drawing my scene in OpenGL. When another shader was introduced, a problem appeared. I use the first shader and draw few objects in the scene. Then I use the second ...
3
votes
1answer
87 views

what happens with missing vertices in geometry shader

I am relatively new to GLSL shader programming, and the documentation I found is unfortunately often inscrutable. I am having trouble understanding a few things with how geometry shaders fit into the ...
1
vote
0answers
76 views

How to shade hair (line segments) correctly in GLSL

I render my hair geometry in line segments. The problem I have is with the correct shading of the hair. From what I've read I understood that I need the direction of the line segment and the ...
0
votes
0answers
26 views

Shadow bias selection with moving light

I've been looking at shadow mapping and although I managed to get them to work selecting an appropriate bias. The problem is when I start moving the light. The shadows work fine for not extreme ...
-1
votes
1answer
79 views

More than 8 lights without deferred shading / lighting [closed]

I want to know if there is any technique (efficient) to use more than 8 lights in a scene made ​​with OpenGL and GLSL. Without making use of deferred shading / lighting. I have not implementadon ...
1
vote
2answers
130 views

2D Outline shader in GLSL

I have a simple prototype with 2D worms-like destructible terrain. I use a trivial shader to discard pixels based on a mask. varying vec2 v_texCoords; uniform sampler2D u_texture; uniform sampler2D ...
1
vote
2answers
88 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 ...
1
vote
1answer
51 views

Handling multiple lights of different types in GLSL

I want to be able to support multiple lights of different types (point, spot & directional). Note that I also want to be able to render transparent/translucent objects, which rules out deferred ...
2
votes
3answers
268 views

GLSL Sphere from Vertex

I am working on a particle simulation where we have a lot of spheres which can have different radii. Using this tutorial http://mmmovania.blogspot.de/2011/01/point-sprites-as-spheres-in-opengl33.html ...
0
votes
0answers
40 views

gl_ClipDistance[] not working

I am unable to get gl_ClipDistance to work. The results I'm getting are the same as if I didn't enable clip distance. I have called glEnable(GL_CLIP_DISTANCE0); and glEnable(GL_CLIP_DISTANCE1); in ...
1
vote
1answer
65 views

Normal Mapping space confusion

I've been reading today about normal mapping. Up to now, the only normal mapping I encountered was with maps already in world space so I just extracted the info from the texture and transformed them ...
-1
votes
2answers
48 views

GLSL Normals not transforming propertly

I've been stuck on this problem for two days. I've read many articles about transforming normals, but I'm just totaly stuck. I understand choping off W component for "turning off" translation, and ...
1
vote
0answers
35 views

Normal map lighting bug in bottom right quadrant

I am currently working on getting normal maps working in my project, and have run into a problem with lighting. As you can see, the normals in the bottom right quadrant of the lighting isn't ...
2
votes
1answer
260 views

OpenGL 4D textures with bilinear interpolation

I want to use and interpolated 4D texture in OpenGL, i.e. a texture that is accessed with a texture coordinate vector (s, t, p, q) and interpolated linearly in every texture coordinate. The extension ...
1
vote
0answers
59 views

Different way to pass uniforms to seperate draws in glMultiDrawElementsIndirect

Given OpenGL version 4.3 and GLSL 430, what would be the best way to pass a matrix to each model in a draw call to glMultiDrawElementsIndirect? I am thinking of going the way of a TBO and indexing it ...
0
votes
2answers
61 views

Trouble getting shadow maps working

I am trying to implement shadow maps in my game following this tutorial. For some reason, the light is not being occluded. In the above screenshot, the big white sprite in the foreground is a ...
0
votes
1answer
138 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
262 views

Deferred Rendering With Diffuse,Specular, and Normal maps

I have been reading up on deferred rendering and I am trying to implement a renderer using the Sponza atrium model, which can be found here, as my sandbox.Note I am also using OpenGL 3.3 and GLSL. I ...
0
votes
1answer
76 views

why is glVertexAttribDivisor crashing?

I am trying to render some trees with instancing. This is rather weird, but before sleeping yesterday night, I checked the code, and it was in a running state, when I got up this morning, it is ...
1
vote
1answer
75 views

Gamma Space and Linear Space with Shader

I am using Unity and I can choose between two color space mode in the settings: Gamma or Linear Space. I am trying to build a Custom Lighting Surface shader but I am facing some problems with those ...
1
vote
1answer
132 views

gl_VertexID values when calling glDrawElements

I am struggling a bit to understand the values that gl_VertexID primitive contains when the vertex shader is executed. I have the standard modern rendering pipeline, in which after setting up ...
0
votes
2answers
284 views

GLSL: can i use matrix transformation functions in vertex shader?

I have a working OpenGL code where i render a terrain with some trees. I am doing all the matrix mathematics on the client side. Because of which the frame rate of my app is very low, around 25-30 ...
0
votes
1answer
50 views

Providing texture coordinates and using indexed drawing at the same time

Please consider the following vertex structure struct vertex { vec3 posL, normalL; }; Using this vertex layout, we can provide the vertex data in an interleaved way, i.e. ...
0
votes
0answers
50 views

Using multiple uniform blocks in OpenGL

I'm using OpenGL with JOGL and want to use two unfirorm blocks in my vertex and pixel shaders. The following GLSL-Code shows the definitions:- uniform perObject { Material uMaterial; mat4 ...
2
votes
1answer
70 views

How to store an array into a texture and sampler the texture in vertex shader correctly?

I'm a new learner about OpenGL and GLSL. I'm coding a program in which i wanna store a group of datas in a texture and get the data by sampling the texture in vertex shader. Then i want to set the ...
1
vote
1answer
40 views

Having trouble setting color in fragment shader

For some reason, the color isn't applying to the object. Here's my fragment shader code. There's probably something obvious wrong with it that i'm not seeing. #version 330 core out vec3 Color; ...
0
votes
1answer
92 views

How does OpenGL determine different outputs with shaders?

Lets say I have this GLSL code: #version 330 out vec4 outputColor; void main() { float lerpValue = gl_FragCoord.y / 500.0f; outputColor = mix(vec4(1.0f, 1.0f, 1.0f, 1.0f), ...
1
vote
1answer
101 views

Why is the light following my camera around?

I have implemented a simple Phong shader without specular highlights for now (just ambient + diffuse components) The problem however, is that the calculations seem to be done in camera space; as I ...
0
votes
1answer
67 views

How do I follow this glsl1.2 + lights + shadows tutorial?

I am following this great tutorial but I have many questions. Let's see if I understand the basic idea. 1. I must create the same number of FBOs that lights (maximum 8). 2. I must create the same ...
3
votes
2answers
117 views

GLSL: sampler2D fallback to constant color?

So I have the following situation: I'm sharing a blinn shader accross many meshes. Some meshes have specular & normal maps, others do not. I'd like to, without making the shader code too ...
5
votes
1answer
146 views

How can I implement real-time mutual object reflection?

So, given a scene like this (cubemap skybox with "real" spheres) Everything looks great, except for the fact that the spheres don't reflect each other. What's a good way to go about this? The ...
2
votes
2answers
241 views

3D position to UV coordinates in fragment shader

I am interested in converting an arbitrary 3D position computed at run time in the fragment shader to its corresponding UV coordinates. Notice that the 3D position I am interested in is NOT a 3D ...
1
vote
1answer
93 views

In glsl, how do indices work?

I have made a vertex shader and fragment shader and kind of know how they work, and I know that you specify what index you want your vertices to be in inside the shader program. So if the vertex was ...
1
vote
1answer
231 views

GLSL - std140 uniform block - fields(vec, float, mat4) always 0.0

Ok, First of all, if just use uniforms everthing works like it should. Switching to uniform blocks nothing goes, as all values look like 0.0. I tested this with various if-then-else stuff within the ...
1
vote
1answer
101 views

GLSL associating multiple uniform samplerBuffers

At the moment I'm not sure how my VBO and TBO associate with a specific uniform samplerBuffer in my shader, I have not linked them using the location or the vbo/tbo together. It seems to still work ...
1
vote
0answers
216 views

Normal mapping does not work correctly using GLSL and OpenGL

Hello I wrote a simple OpenGl program using GLSL to render a simple uv mapped plane using the normal mapping technics. Here's the display with a simple phong shading (without normal mapping) : Now ...
2
votes
1answer
117 views

How to work with smaller intermediate textures in OpenGL and GLSL?

I'm working on a project rendering water simulated through smoothed-particle hydrodynamics (SPH) with a non-photorealistic look to use in games. In the actual stage of the project everything about ...
1
vote
1answer
340 views

SSAO looks wrong

I'm trying to implement SSAO based on this tutorial. My setup: OpenGL 3.2 Forward renderer View-space depth and normal in a single 16-bit floating point texture. The result I get is this: The ...
0
votes
1answer
101 views

why is my OpenGL texture transparent?

I have a terrain in OpenGL, and two textures which I am combining using GLSL mix() function. Here are the textures I am using. Now I am able to combine and mix these two textures, but for some ...
0
votes
2answers
175 views

How to mix pixel colors in Shader?

I have a pixel that have a colour RGB. This color is calculated by the shader and can be anything. How can I override this color by a colour I choose. If my pixel is white it's simple, I can do this: ...
0
votes
1answer
68 views

Combine framebuffer-textures to default framebuffer

I know frame-buffers are not textures themselves, but they do contain a texture, given they are set up correctly, which I believe mine are, as: (status == GL_FRAMEBUFFER_COMPLETE) returns true. ...
1
vote
1answer
194 views

How to achieve anisotropic filtering

I am loading a texture and using glGenerateMipmap() on it to achieve some level of mipmaping. I get different result on nVidia gt 555m, and on Intel HD 3000. The texture rendered by nVidia is not ...
9
votes
3answers
644 views

How can I create a glitter effect?

I am trying to create a glittering effect for my realtime shader but I don't know how. Here is one example, and another example. What technique can I use to implement this?
-3
votes
1answer
101 views

GLSL does weird things to my view matrix [closed]

uniform mat4 model; uniform mat4 view; varying vec4 vColor; void main(){ gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = view * model * gl_Vertex; vColor = gl_Color; if(view * ...
2
votes
1answer
207 views

Assimp renders a partial amount of vertices

I'm building a 3D game, and i'm trying to load some assets with the nice Assimp library. The model should look like the one in the first picture, but instead, it takes the form of some kind of ...
1
vote
1answer
93 views

Indirect indexing (uv coords read from texture)

In the vertex shader, I need to make a texture fetch, where the texture coordinate itself is read from some other texture. vec2 uv = texture(someTexture,coords).xy; vec4 val = ...