Questions tagged [glsl]

A programming language for OpenGL shaders.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Per-object screen space uv issue

I am currently trying to sample a texture in screen space. This works well : ...
3
votes
0answers
41 views

Help in understanding atmospheric scattering shading

I have a made a planet and wanted to make an atmosphere around it. So I was referring to this site: Click to visit site I don't understand this: As with the lookup table proposed in Nishita et al....
3
votes
1answer
1k views

How can I achieve simulated fluid surface deformation in a bottle?

I'd like to mimic this effect seen in Half Life: Alyx: I can't figure out what is going on here, people say "it is just a shader effect it isn't simulating anything", but I don't think that is true ...
0
votes
1answer
29 views

Debugging Python OpenGL apps

How do I debug OpenGL apps written in python? I tried but I was unable to use standard tools like nvidia nsight or glsl-debugger or renderDoc on python code. Are there any specialized tools for ...
0
votes
0answers
11 views

How to make a per object horizontal scanline effect

I am trying to create a scanline / horizontal bar effect to use for specific objects instead of an image effect that covers the whole screen. So far i have managed to make this Vertex shader ...
2
votes
0answers
18 views

THREE.ShaderMaterial cannot perform antialiasing

I created a ShaderMaterial to draw a box in three.js using the following key code: ...
0
votes
1answer
30 views

How to map texture across whole face?

I'm trying to map a texture to a square face in OpenGL 3.2, but the texture gets tiled in the upper right corner. I've tried changing the uv coordinates, vertices and shaders, but nothing seems to ...
0
votes
1answer
28 views

Implement spherical mapping for texture coordinates

I am using a texture of a world map and I am trying to put that image on a sphere made up of many triangles. Each triangle has points a,b,c with their own (x,y,z) coordinates. I am trying to use the ...
0
votes
0answers
21 views

Vertex skinning, calculating the bone matrices (for bind pose) and then animating them

I am attempting to do HW skinning in Opengl. Please note that I am purposefully doing it in a not-game ready optimized way, because I need this to scale. I wrote the following code to 'apply' the ...
0
votes
0answers
17 views

Draw circle OpenGL 3.3 [duplicate]

How do I draw a perfect/smooth circle using OpenGL 3.3 and GLSL? I can only find old OpenGL tutorials or ones that have a blocky circle. I would also like to be able to resize the circle to become an ...
0
votes
0answers
48 views

Discarding GLSL fragment values not working with stencil buffer

I am trying to make a system where I can outline sprites, but I can only get it to work correctly when I use a regular-shaped texture. Here is what an outlined regular texture looks like: However, ...
2
votes
0answers
28 views

How to apply a color transform to textures when using pre-multiplied alpha?

I'm trying to apply a color map to my textures. The map is a 4x4 matrix that adjusts the contribution of each RGBA channel returned from the fragment shader. My texture needs to use pre-multiplied ...
0
votes
0answers
47 views

Is it more performant to index in the vertex shader or fragment shader?

I have a shader that draws 2D quads from a texture atlas using instancing. I'd like to add a feature that allows me to map each of the RGBA channels in the texture using a 5x5 matrix. For example, the ...
1
vote
2answers
209 views

Drawing outlines around 2D objects OpenGL

I am trying to draw an outline around any arbitrary object using OpenGL and shaders with a different color than the original object, while also retaining compatibility with alpha values <1. I am ...
0
votes
1answer
62 views

How to correctly reset vertex attributes after modification

I am trying to use the same vertex shader for two different use cases to preserve memory, but I am having issues where the modifications of one shader run are passed on to the next run, even after ...
0
votes
0answers
47 views

Random world Points in GLSL for tree placement

I'm doing tree placement in the geometry shader in GLSL. I've made a seeded random vec3 function based on gold noise that looks like this: ...
0
votes
1answer
84 views

How should shader be structured? (GLSL)

I've been writing, deleting and rewriting OpenGL programs in C++ but usage of shaders confuse me. I don't know how it should be structured. Scenario A: (In a world we have a sun, the sun should ...
0
votes
1answer
66 views

How can I fix the artifacts near the shadow edges in my variance shadow map?

I'm trying to implement variance shadow mapping in my engine. I'm using WebGL 2 and now I have only one directional light source. It's working, but it has a serious issue near the shadow edges and I ...
2
votes
1answer
69 views

How to make shadows softer as distance increases?

I'm trying to make shadows become more blurry as the distance between the caster and receiver, so they look a little more realistic. What method can I use to achieve this?
-1
votes
1answer
45 views

Render output difference cause

There are two 3D applications compared side by side: I'm looking for difference cause. These might be the cause, but I'm not sure: Color Lighting Shading code (GLSL) ? Can anybody help me with ...
0
votes
0answers
28 views

Calculating PBR Lighting returns weird results at (0, 0, 0) or lower positions

I'm writing a Physically Based Renderer with the help of this tutorial here https://learnopengl.com/PBR/Lighting The vertex shader they use can be found here: https://learnopengl.com/code_viewer_gh....
0
votes
1answer
84 views

VAO not showing

My VAO is simply not showing up and i'm not sure if my matrices are wrong or if the shader is wrong… Please have a look a see what is wrong… My code is big so i'll post the essential. ...
1
vote
1answer
45 views

How can I implement a side scrolling seamless fog shader?

I've run into a problem trying to code a 2d game. The way I've set up the game is that you run through underground dungeons and fight enemies, for ambiance I've added a smoke/fog shader to superimpose ...
0
votes
0answers
133 views

Correctly Implementing SSAO

I am trying to implement Normal-Oriented SSAO and i'm having an issue with the results. Portions of the screen are inverted/wrong, typically half way through the screen but not always, it seems tied ...
0
votes
1answer
35 views

Understanding arguments to a signed distance field function

I'm looking into drawing a box using Inigo Quilez's code: ...
1
vote
1answer
57 views

Need help with a grab Shader

How can I make grab Shader similar to https://docs.unity3d.com/Manual/SL-GrabPass.html in GLSL. The idea, is that you grab exact pixels from background (ex. from composited renderTarget) and put on ...
1
vote
1answer
128 views

How to change the amount of Fast Linear Gaussian blur in GLSL?

I implemented the GLSL from http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/, but is unclear to me how to reduce or increase the amount of blur. Has it something to do ...
0
votes
0answers
27 views

GLSL - Drawing 2D UI elements over objects in 3D space

I posted a similar question earlier but I wasn't specific enough about what I wanted to do. I have meshes being rendered in 3D space as expected. What I would like to do is display 2D billboarded UI ...
0
votes
1answer
84 views

Strange diagonal line artifact in simple ripple shader

I have a simple shader, converted from GLSL to HLSL. This is the original: https://www.shadertoy.com/view/tdKSWG The problem is that there is a very visible diagonal line artifact going from UV(1,1) ...
0
votes
1answer
86 views

How to load large arrays to gpu and render with OpenGL?

I am trying to make a volumetric rendering of a cloud. I have been defining the cloud density functions on the glsl shaders and performing ray-marching methods successfully. But now I would like to ...
2
votes
1answer
41 views

GLSL variables as main function params vs on their own line?

I am learning OpenGL and GLSL. I was taught that the in/out variables should be formatted like this: ...
0
votes
0answers
64 views

What does the keyword “interface” mean in GLSL?

interface vs_out { vec3 get_color(); }; struct vs_out_impl : vs_out { vec3 get_color() { return vec3(1,0,0); } } Where is this behavior defined? ...
0
votes
0answers
44 views

Weird behaviour with glsl shaders

Dear people from the forum, I am trying to develop a game prototype which uses OpenGL and I am designing the entire graphic engine. My game requires some tricks with the shaders, and therefore I had ...
0
votes
1answer
59 views

GLSL: gl_ModelViewMatrixTranspose vs. gl_ModelViewMatrix

What is the difference between doing these two operations? Don't the first transform the vector from model space to view space? Then what does the second operation do? gl_ModelViewMatrix * vec4(...
3
votes
0answers
92 views

Strange normal mapping artifacts - OpenGL / GLSL

I have been following a few tutorials to learn some graphics programming with OpenGL, and recently implemented Normal Mapping. It works well for the most part, especially for objects with normal-...
0
votes
2answers
175 views

How to write a shader that only uses a bump map without a normal map

So I understand that for best results one uses a height (or bump) map and a normal map together. And I also understand that one can calculate a normal map from a height map using some sobel operator. ...
0
votes
2answers
240 views

How to decorate the floor with a grid?

I got this photo from mixamo.com — I want to draw grid lines similar to this on my floor. I'm sure this is easy by using textures, but I'm trying to avoid using textures as much as possible. Is there ...
0
votes
1answer
109 views

How to keep track of (count) vertices processed so far in GL ES SL 2.0 vertex shader?

I'm trying to learn how to use GLSL ES 2.0. In OpenGL ES 2.0, there is no gl_VertexID keyword to obtain the number of vertices processed so far. So I was wondering ...
3
votes
1answer
553 views

GLSL shader algorithm to render a sprite map with a single draw call (on a single sprite mesh)

I'm trying to render a tile map world on a single sprite mesh (instead of one sprite per tile.) This significantly reduces the array vertex bus labor for extremely large worlds: In order to do this, ...
0
votes
1answer
53 views

Rotate mesh to normal

I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with. So head pixel in my texture is a normal ...
2
votes
1answer
105 views

How can I make an OpenGl/GLSL varying vary throughout a quad instead of a triangle in OpenGl 3.3?

I am, like many others, currently working on a block-based game in C++ and OpenGl. Recently, I added ambient occlusion support. This ambient occlusion is created by modulating the brightness of a ...
-1
votes
1answer
115 views

object changing position when scaled

These are my matrices. when i move the pivot point to one unit in x and if the scaling is set to 1 than everthing works fine. the pivot point has moved to one unit and the cube has stayed in its ...
1
vote
1answer
163 views

How to use Pivot Point in Transformations

How to translate object using Center point I have a rectangle which has a center point away from the position of rectangle. when i rotate rectangle it rotates around its center axis. if i multyply ...
0
votes
1answer
174 views

Quaternion rotation is inverse of what I expect

I'm trying to learn quaternions and decided to implement my own quaternion class. To test it I made a couple vertex shaders, one that gets a model matrix (calculated from the quaternion) and another ...
-1
votes
1answer
161 views

When should MRT (Multiple Render Targets) be used?

I had a question about exactly when I should use the MRT. This is not about rendering models, but about post processing. For example, I need to draw some cubic textures (something like skybox ...
0
votes
0answers
98 views

Reconstruct world position from depth

I am trying to restore the position from the depths. I separately created a position map in view space, which I use as a basis for tests. But I can not get the same result when I try to reconstruct ...
3
votes
1answer
116 views

Shader is distorting a Texture of a sprite it's working on

I've been testing out fragment shaders in SFML, trying to learn how to write and use them and I've run into a recurring problem. Every shader distorts the texture. Top left is the distorted test ...
1
vote
0answers
88 views

Screen Space Reflections: Artifacts problem

I'm trying to implement a simple (so far) screen space reflections shader. Below is my code: ...
2
votes
1answer
214 views

Strange GLSL performance problems

I'm having weird performance problems with a GLSL shader I'm working on. This small example fragment shader: ...
1
vote
1answer
129 views

OpenGL Lines between triangles?

I'm currently using marching cubes to generate a mesh, and have encountered this incredibly weird problem. Looking from below the terrain, these weird fully lit lines appear between every triangle. ...

1
2 3 4 5
18