Tagged Questions
2
votes
1answer
62 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 ...
0
votes
0answers
55 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;
...
0
votes
1answer
127 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
0answers
68 views
Deferred rendering extremely slow [closed]
I'm trying to setup deferred rendering in my Voxel Engine, and so far it works pretty good:
The texture, worldpos, normal and uv textures seem to be correct.
One problem:
With normal rendering ...
0
votes
2answers
82 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
90 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
94 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
96 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 ...
0
votes
0answers
62 views
Drawing point light sources - hdr [closed]
I'm using HDR and Reinhard tone mapping (link - equation 4). Point light sources that a small objects (spheres) filled with uniform color.
Components of the color(r,g,b) can exceed [0,1] range ...
-1
votes
1answer
120 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 ...
2
votes
1answer
76 views
OpenGL Calculate Matrices
Im trying to switch from the glTranslate etc to my own Matrices, but for some reason it does not work. Here are my 2 functions to create the view- and projection matrix:
public Matrix4f ...
0
votes
1answer
67 views
Get world-position in Vertex shader
I'm wondering how I can get the final position of a vertex. I use glTranslate in my render code, and I'm not getting the world-coordinates correct. My world is devided in chunks and my position get's ...
0
votes
1answer
96 views
GLSL Shaders-> How to manage?
As your game get's bigger and bigger, you will use more and more different shader effects.
Let's take an easy example:
I have clouds in my voxel-based world, and I want to give it a blue-ish tint ...
3
votes
2answers
234 views
Using a programmable pipeline in a game engine
As a learning experience, I'm developing my own 3D game engine using OpenGL. I'm a little confused as to how to implement my rendering engine such that it uses a programmable pipeline while still ...
0
votes
0answers
40 views
Specular Light not working Phong shading
I want to implement Phong-Shading using GLSL. I also want to calulate all values using uniforms in the shaders.
Nearly everything works fine, but there is an error with the specular term of the ...
0
votes
1answer
59 views
Direction from the camera to the light source
I'm currently writing a game using OpenGL and GLSL. For the shader I need the direction from the current camera to the light source. The lightsource is given by lightSource.position as a uniform as ...
1
vote
3answers
199 views
Set a variable inside a GLSL fragment shader that persists for the render
Is it possible to set a varying variable inside a fragment shader and have it persist? I'd like to use the depth component of the first fragment and use it on all the others, making the fragments all ...
3
votes
2answers
394 views
2D water shader similar to Limbo's effect
I'm wondering how I would go about creating a 2D water shader that is seen in this video http://www.youtube.com/watch?v=phChFfi4GOs
The water effect that limbo uses is pretty awesome. I'm not so ...
3
votes
1answer
152 views
variable number of lights in a glsl shader?
I want to render an arbitrary number of lights in my fragment shader. I do not understand how you can properly pass them into the shader though. For example, I want something like this:
uniform int ...
0
votes
1answer
74 views
How to alter the angle of texture projection
I'm currently working on a 3Dish game; it's on a grid, with 3D props and the camera looking down on the grid at about 45ยบ, but I want to use 2D sprites for the player and NPCs.
Currently, I'm using a ...
-1
votes
2answers
155 views
GLSL: Why can only some of the matrices be found? [closed]
I've been learning GLSL and to start I've been trying to replicate the fixed-function pipeline functionality with it, for 2D graphics. I've done it successfully in most things, so far, but I came into ...
2
votes
1answer
115 views
gbuffer - how to store an integer data
In a gbuffer I store a diffuse color in following texture:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
I want to store an integer data which ...
5
votes
1answer
418 views
How to do simple bump mapping
I'm trying to do bump mapping, and I'm getting fairly close at achieving my goal. I miss one crucial piece of my puzzle to have bump mapped effect in my scene; I need to transform the normals from my ...
0
votes
1answer
94 views
Reinhard tone mapping and color space [closed]
I found two ways of doing tone mapping (first, second):
//Ld - this part of the code is the same for both versions
float lum = dot(rgb, vec3(0.2126f, 0.7152f, 0.0722f));
float L = (scale / ...
2
votes
1answer
111 views
RGB to xyY color space conversion and luminance
The luminance calculated by following GLSL functions (fragment shaders - tonemap) has different value:
float GetLuminance (vec3 rgb)
{
return (0.2126 * rgb.x) + (0.7152 * rgb.y) + (0.0722 * ...
0
votes
1answer
61 views
How do I pass textures into a fragment shader in Slick?
I've written a shader that uses three different textures, tex0, tex1, and tex2. I can load it into Slick and successfully display it, but I can't figure out how to set the three different textures. ...
2
votes
1answer
185 views
How to solve artifacts caused by vertex lighting in my voxel engine?
My current lighting system bakes the light amount based on ray-tracing from the light source to the 8 corners of the block (so per-vertex) and the distance to the light on the blocks. It works ...
0
votes
1answer
120 views
How to get a smooth dimming with SSAO?
I implemented SSAO in my game based on the tutorial at gamerendering.com. But the results I get are disappointing. Instead of a smooth effect as seen in the nvidia demos, my implementation causes ...
0
votes
2answers
86 views
LWJGL Game crashes on some other machines [closed]
I just tried running my game on a friend's laptop, but for some reason it crashes. The exported .jar runs fine on my machine, and some others too. I can see that is has something to do with the ...
3
votes
3answers
398 views
Voxel engine artifacts
There are white little dots between blocks at random places, mainly at very near blocks. They disappear when I move the mouse and change the view direction.
I use Vertex Arrays with ...
1
vote
1answer
113 views
OpenGL VBO Additional Attributes
If I have a buffer with my vertices, normals and texture coordinates, and I use glDrawArrays to draw the VBO to the screen, how can I send attributes per vertex that I placed in an array to the shader ...
3
votes
2answers
242 views
Do opengl games tend to use multiple shaders? [duplicate]
For any given object that you want to render, there may be a whole bunch of things that need to be considered for rendering (Material, Texture, Lighting, Blending etc). But, you may also have some ...
0
votes
0answers
121 views
Program created with glCreateProgram is not identified as a valid OpenGL program outside [closed]
I've starting programming in OpenGL and I decided to create my own class to manage shader objects.
In the class constructor I create a new program calling glCreateProgram, and I'm able to print its ...
2
votes
1answer
299 views
glsl 150 struct in uniform buffer object
Can I do this in opengl 3.2 / glsl 150?
glsl shader:
struct LightSource {
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec4 position;
vec4 direction;
};
...
layout(std140) uniform ...
2
votes
1answer
155 views
How to transform a shadow map to camera view?
I'm making a rendering engine as a hobby to learn more about 3D. I have a deferred renderer with the G-buffer (color, normal and depth). I also have a lighting controller that uses only spotlights at ...
-5
votes
3answers
210 views
in the shadow of a sphere [duplicate]
(Related, but somewhat different, to my previous question)
How can I determine in a fragment shader if a fragment is in the shadow of a sphere?
That is, if it is occluded by the sphere and is past ...
1
vote
0answers
135 views
What is the recommended way to output values to FBO targets? (OpenGL 3.3 + GLSL 330)
I'll begin by apologizing for any dumb assumptions you might find in the code below since I'm still pretty much green when it comes to OpenGL programming.
I'm currently trying to implement deferred ...
0
votes
1answer
149 views
Using two FBOs results in the second FBO having nothing drawn to [closed]
I'm writing a deferred renderer, and I use two FBOs: the first one for G-buffer (color, normal, depth) and the second one for lighting (light output), so the first one has three textures bound and the ...
3
votes
2answers
283 views
Jagged transparency when rendering translucent textures (OpenGL 3.2 + GLSL)
Like most others, I'll start off mentioning that I'm still a beginner when it comes to OpenGL and GLSL programming. So bear with me on any dumb mistakes you may spot in the code ahead.
I'm basically ...
-1
votes
1answer
176 views
GLSL code is very slow…why? [closed]
I know this is a very difficult thing to simply modify without the full project code, but I am having a massive performance problem with GLSL code that seems to be very efficient to me. I am stuck at ...
0
votes
0answers
81 views
Starting OpenGL ES 2 [closed]
Really, I'm a bit confused now.
I want to learn OpenGL ES 2, and eventually make games for Android and iPhone.
Thing is, I don't really have any of these devices, so I need solution for emulating ...
1
vote
1answer
241 views
Cook Torrance model implementation : black specular light
I am trying to implement the Cook-Torrance model, and this is how I calculate the parameter Rs:
float Rs(float m,float F,vec3 N, vec3 L,vec3 V, vec3 H)
{
float result;
float NdotV= ...
2
votes
1answer
199 views
How to rotate a direction
I'm working a spotlight for my deferred renderer and I'm having trouble with matching the mesh to the visual representation of the light. Right now my mesh is a cone, the apex of the cone is at ...
2
votes
0answers
65 views
Fragments never falling into spot light's cone
I am using GLSL version 1.20 with OpenGL 2.1 .
I am trying to compute when a fragment falls into the area of a spot light. I have already set all the light values with glLightfv and glLightf, also ...
0
votes
3answers
255 views
Phong lighting model unrealistic result
I am using OpenGL 2.1 and GLSL 1.20 .
I am trying to compute the fragment color applying the Phong lighting model.
This is the formula I have (the original formula has a summation, but since the ...
1
vote
1answer
111 views
What book/guide should I follow for GLSL [closed]
I searched a lot on the web without coming to a real solution and if I ask this it's because I really have difficulties getting an answer. I need to learn well GLSL 1.20 with OpenGL 2.1.
I have ...
0
votes
1answer
115 views
vec4 for vec3 multiplication while calculating the specular value
I'm following this tutorial to calculate the specular color of a vertex.
I use OpenGL 2.1 with GLSL version 120.
This is the formula that I apply:
spec= (R*eye)^s * Ls * Lm
With:
...
0
votes
1answer
108 views
deferred rendering and a few shading functions
How to use a few shading functions together with deferred rendering (for example some objects are shaded based on a lighting equation,
other get a fixed color) ? I draw a full screen quad when ...
12
votes
1answer
565 views
Why does this geometry shader slow down my program so much?
I have an OpenGL program, and I'm rendering a terrain mesh. I displace the vertices in the vertex buffer and don't really color them in the fragment shader yet. I'm adding a geometry shader one part ...
0
votes
1answer
90 views
OpenGL RTT FrameBuffer question and Rendering to texture while sampling it
What i need to do:
Blur the selected texture and pass the texture to another effect for postprocessing.
Notice that i want one texture passed all over.
How do i want to do this:
Bind the FBO ( ...