Tagged Questions

A programming language for OpenGL shaders.

learn more… | top users | synonyms

0
votes
0answers
13 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
5 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
79 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
84 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
84 views

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

Just from model position, model normal and texture uv?
0
votes
1answer
31 views

How to load and render PhysX 3.3 heightfield

I'm trying to load a PhysX 3.3 heightmap and render it with OpenGL using glm and glfw, but so far it doesn't seem to be working. I'm basing my code on the PhysX samples, and am also using FreeImage to ...
0
votes
1answer
67 views

Per vertex diffuse lighting not propogating across entire model

I'm not sure how to describe this problem so I've added a picture. When I add per vertex diffuse lighting to my model (just a field of cubes for simplicity) the lighting effect applies to each ...
1
vote
1answer
57 views

What is the relationship between glVertexAttribPointer index and GLSL location?

I've been getting some strange results when trying to implement a normals buffer for the purpose of rendering lighting. It seems to be related to the indexes for glEnableVertexAttribArray, ...
2
votes
1answer
91 views

How to share values between different shader programs?

I am using Unity but this might concerns all type of shaders. I would like to know if this is possible to share values between different shader pass.Let's imagine that I am computing something in the ...
3
votes
2answers
150 views

Shader - Calculate depth relative to Object

I am trying to calculate depth relative to the object.Here is a good solution to retrieve depth relative to camera : Depth as distance to camera plane in GLSL varying float distToCamera; void main() ...
0
votes
1answer
45 views

GLSL: Vertex attribute to int

I'm trying to write a shader which renders a multitextured geometry wihout rerendering the geometry with each texture. In my test I'm not using textures, I just convert the texture index to a color ...
2
votes
0answers
103 views

Problem with uniforms in OpenGL

I have a strange problem I can't figure out. On the CPU I have class that handles the material properties for a model. material = new Material(); material->Emissive = vec3(0.1, 0.0, 0.0); ...
0
votes
3answers
69 views

Arbitrary number of VBO to Vertex Shader

I am currently using standard modern OpenGL way to render a mesh via VBO and attributes glEnableVertexAttribArray(aVertexPosition); glBindBuffer(GL_ARRAY_BUFFER, VBO); ...
0
votes
1answer
59 views

Why does my vertex shader produce no output until I add some arbitrary value to the position attribute?

I want to draw a textured quad but there is nothing drawn and the setup should be right. This is my vertex shader: #version 330 in vec2 position; in vec2 texel; out vec2 texCoord; void main() { ...
2
votes
0answers
81 views

Skybox rendering

I am sorry if this is trivial, but I got into OpenGL just very very recently. I am trying to render skybox (with cubemaps) and this is what I have done: Created a VBO with vertices positions (36 ...
-2
votes
1answer
94 views

GLSL- How to change a certain color of a sprite, to another color passed into the shader?

I have been googling for over an hour, trying to find out how to do something very simple, which I see in tons of games. I tried to understand GLSL, but it seems like a ton of learning for a single, ...
0
votes
0answers
62 views

Problems texturing a sphere using a cubemap

I have a single problem which I've attempted two methods to resolve. Neither is giving me 100% results. I've read about 100 tutorials and looked at code but it's just not working out for me; I believe ...
2
votes
1answer
91 views

OpenTK GL.DrawElements is never called

I found this C++ code here. It draws simple rectangle. Works great. #define GLEW_STATIC #include <iostream> #include <glew.h> #include <freeglut.h> const GLchar* vertexSource = ...
0
votes
0answers
27 views

Is it possible to loop over an array of samplerCube/samplerCubeShadow using OpenGL/GLSL?

I try to manage a scene with several point lights. For the moment my program works perfectly with just one point light. So I have in my fragment shader the following uniform declaration: uniform ...
5
votes
0answers
144 views

Why does accessing a uniform float make my shader more than twice as slow?

My fragment shader was significantly slowed down by a recent change, and I've been trying to understand why. I isolated the main slow-down to accessing a single particular uniform float. If I include ...
0
votes
1answer
118 views

3D position of an arbitrary UV coordinate

I have a UV map for a 3D mesh that encodes "links" between pairs of UV coordinates. I have previously defined this links (or pairs), one to one. The links are enconded using the function rgb_color(u1, ...
1
vote
2answers
54 views

Vertex Skinning Looks Messy on Real Android Device using Monodroid

I have no problem doing the "vertex skinning" for three-dimensional animation. All goes well when using the emulator (and genymotion). However, when run on a real device (such as Samsung and Lenovo) ...
2
votes
1answer
57 views

How to know when graphics driver or card changes

I'm about to start work on implementing GLSL binary shader compilation and I was curious how to handle the cases when the shaders need to be recompiled, such as when the driver (or perhaps even the ...
0
votes
1answer
88 views

Blurring part of the screen - optimisation

I develop 3d menu and sometimes I need to blur only part of the screen. I use a forward rendering. I create a frame buffer object with 3 color attachments. Rendering looks like this: bind fbo ...
1
vote
1answer
32 views

Only affect pixels in buffer with alpha 0

I'm working on a transition effect where I have a texture and simply draw that as a pattern to my buffer. Here is a demo, use "e" to start the effect again. This looks fine but it won't work if the ...
1
vote
0answers
128 views

Is it reasonable to use a 2D texture as a lookup table in GLSL

I need a lookup table in a shader. The input values would be color values and the output other color values. Something like: uniform float lut[256]; color = vec3(lut[int(color.r*255.)], ...
1
vote
1answer
100 views

Vertex shader in OpenGL/GLSL - transformation of the interior of a textured quad

I have a LWJGL project and ran into a problem with a vertex shader I wrote. In my scene I am rendering a map whose ground consists of rectangular tiles. On top of that there are other objects (I used ...
0
votes
1answer
65 views

Proper way to encapsulate a Shader into different modules

I am planning to build a Shader system which can be accessed through different components/modules in C++. Each component has its own functionality like transform-relevated stuff (handle the MVP ...
0
votes
2answers
64 views

Best way to detect if vec3 is between vec3(x) and vec3(y) in glsl

As titled I am sampling from a texture and if the color is somehow gray [vec3(.8), vec3(.9)] and an uniform is 1 I need to substitute that color with another one I am not a glsl veteran but I am ...
0
votes
0answers
32 views

GLSL 150 (or upper) per pixel lighting base code

I'm looking for a working example of smooth per pixel shading for one directional light I've seen this example http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/lighting.php but its old GLSL ...
5
votes
1answer
253 views

How can glass breaking effect from Smash Hit be achieved? [duplicate]

I saw Smash Hit the other day and was amazed by the physics of the game, specially the shattered glass effect: I've read other posts about this subject but I still feel that they don't share enough ...
2
votes
2answers
160 views

Water silhouette shader using GLSL

I have this problem to solve using Cocos2d-x 3.x: In my game there is water represented by rectangle texture, modified by the code on the go. I also have a character moving around, rotating etc. I ...
0
votes
0answers
20 views

Shader | Special Effect - Unit selection [duplicate]

I would like to know how the shaders used to show which unit is selected are made. Here is an image to illustrate. How the merge effect of the blue circles can be achieved ? I didn't found any ...
1
vote
1answer
52 views

Unity, shader, vertexID

I'm writing a shader and I just wanna ask if it's possible to get the ID of the vertex that is currently being manipulated. I read something about gl_vertexID, but I couldn't find out if that is ...
1
vote
0answers
117 views

implementing shadows into my 2D GLSL-based lighting system

I'm writing a lighting system in OPENGL using GLSL shaders, and I'm pretty happy with the light casting I have so far, but I'm totally stuck on casting shadows. Everything I've found online on this ...
1
vote
1answer
109 views

GLSL Processed Image to OpenGL

I've tried wording and rewording this question in various forms of search and can't seem to find an answer to it. If I'm wording it wrong and/or just not finding the right information, feel free to ...
3
votes
2answers
133 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
2answers
135 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
97 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
83 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
128 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
129 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 ...
0
votes
1answer
79 views

What coordinates are we passing to pixel shader from vertex shader?

I have read articles about shader programing and understood the very basic knowledge of shader programing. One thing I always get confused is about the texture mapping. What I pass(output) from VS to ...
1
vote
0answers
98 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
32 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 ...
0
votes
1answer
144 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
534 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
107 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 ...
2
votes
1answer
81 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
353 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 ...