Questions tagged [glsl]
A programming language for OpenGL shaders.
956 questions
0
votes
1
answer
38
views
What's wrong with the TBN map?
I'm trying to import 3D models into OpenGL using Rust and GLFT models, the problem is that this function used to work... Now it doesn't work at all!
It's working to load the 3D model, with the texture ...
1
vote
1
answer
67
views
Strange scaling on my textures when they are upscaled or zoomed into
I am having a strange issue with my sprites, which is kind of difficult to describe, but hopefully the attached images will illustrate. I have drawn two 1 pixel lines on my sprite to help with this, ...
2
votes
1
answer
192
views
9 Slicing in OpenGL, want to have the center of the texture repeat instead of stretch
I have some sprites in my game, mostly though not entirely UI related, that I would like to be able to scale to different sizes without warping the borders of the sprite.
Looking around I was able to ...
0
votes
1
answer
62
views
Rotating SDF rectangle with Matrix4
Hei
I'm trying to create my own UI renderer from scratch using SDF functions,
got it working pretty good without any transformations, but now I would like to add ...
0
votes
0
answers
330
views
When compiling shaders in OpenGL, I get random error messages
I am trying to follow LearnOpenGL while coding in the Zig language, and something that is very odd is that sometimes my shader compilation fails even though I changed nothing between executing the app....
0
votes
0
answers
71
views
Pyglet - How can I add a bloom postprocessing step to my scene?
I have a simple Pyglet scene below. I would like to apply a postprocessing step to add bloom to the scene. How can this be done using pyglet?
I've tried looking through all the documentation for ...
0
votes
0
answers
44
views
Compute Shader - Buffer Output Size Differs From Input Image Dimensions
I am trying to build a compute shader to retrieve pixel color values from a noise-generated image using GLSL and Godot 4.2. The image itself is a 3840 x 2160 and formatted in RG8. I would expect ...
0
votes
0
answers
109
views
SSAO Looks Like Depth Buffer
I have problem with ssao, i'm using vulkan and follow Sascha Willems vulkan ssao example
here: https://github.com/SaschaWillems/Vulkan/blob/master/examples/ssao/ssao.cpp
my ssao result looks exactly ...
0
votes
1
answer
105
views
How do I interpolate light intensity for tilemap's lightmap?
I implemented lightmap creation for a tilemap, but I cannot figure out how do I interpolate light intensity values. For now, my lighted tiles create an obvious grid-like structure. It was pretty easy ...
0
votes
1
answer
129
views
GLSL ported shader not working in HLSL
I have been working on an Infinity Grid shader for my engine.
It was already implemented to Vulkan’s GLSL, so it worked great with OpenGL’s (4.6) GLSL.
Here's a reference.
This basic shader with ...
0
votes
0
answers
62
views
How to render two different meshlets at two different LODs in a Mesh Shader?
I would like to know how to render two different meshlet at two different LOD values.
So, for example, I render the meshletA at LOD1 and I render the mesheletB at LOD2.
Please let me know if this is ...
0
votes
1
answer
115
views
How to setup gradient lighting in OpenGL shader?
I setup simple single light source lighting around campfire object.
However, as can be seen, the transition between lightened area and unlighted one is sharp.
The GLSL fragment shader code:
...
0
votes
1
answer
103
views
GLSL limit uniform sampler2D to 4 for some reason
I'm writing a deferred rendering pipeline and my fragment shader looks like this:
...
0
votes
1
answer
32
views
Uniforms management
I wanted to know if there is any special optimization going on with uniforms and shaders.
The issue I'm facing is that when increasing an uniform which is clamped to an option by a modulo, it only ...
3
votes
2
answers
1k
views
It's possible to use more than 4 channels of a texture in GLSL?
I have a Texture with 6 channels. Each channel store a mask that is used to change a color of a part of my player's sprite.
When the texture only had 3 channels it was easy to implement this color ...
0
votes
0
answers
55
views
How do I pick terrain in GLSL/OpenGL by picking 2D vertices positions?
Presumably the problem is with the internal formats and my understanding of that, but I've been stuck a while, got this sort of approaching working fine on a more straight forward colour picker, but ...
2
votes
1
answer
220
views
GLSL wrong data read from attribute
I'm developping an OpenGLes 3.0 app with Java and I started writing the shader code. For some reason, it seems to mix up the attributes data locations and I don't understand why. Here's the code :
...
1
vote
1
answer
92
views
Problem recreating shader on Phaser 3
I'm trying to recreate the following shader from shadertoy using Phaser 3:
https://www.shadertoy.com/view/wdG3Rz
I managed to fix the errors I was getting but it just loads an empty black square when ...
1
vote
1
answer
75
views
Issues with binding structure layout in the shaders which translated from glsl to hlsl
I have a small issue with my shaders. Sorry if it is not the right place for this question. In general, the essence is that for my application on dx12, I have shaders in glsl (I'm too lazy to rewrite ...
2
votes
1
answer
58
views
I can't find what I'm doing wrong when rendering a point light that is clipped by the floor
I have a top down camera on my game, and I'm rendering a point light on my opengl fragment shader.
When the point light is far away from the floor it looks like I would expect it should look, like a ...
0
votes
0
answers
103
views
GUI shader that draws different textures on corners, edges, and center?
I'm working in GLSL but feel free to write a solution using any shader language, or even pseudocode / language agnostic, I can translate it myself.
I'm trying to create a shader that can draw a "...
1
vote
1
answer
156
views
How do I make the joints and weights skinned with the variables I'm using?
For some time now I have been trying to do skeleton animation using Rust and OpenGL(specifically the gl library), I loaded the animation information correctly(with the gltf library), the bone ids and ...
0
votes
0
answers
36
views
0
votes
1
answer
127
views
Can’t understand what this shader is doing
I believe this is a fragment shader which is supposed to distort an image by creating a zoom and swirl like affect but I have no idea what the shader is actually doing
...
0
votes
0
answers
57
views
Moving a texture with a vert shader
I'm working on a mod for a game and trying to add my own shader. I know practically nothing about shaders, but another similar shader exists and with their modding teams permission im using it as a ...
1
vote
1
answer
315
views
GLSL 9-Slice (or 9-Patch) working with single texture, but not with atlas texture
I've been able to implement 9Slice for textures when the texture is just itself, that means, it does not contain any subtexture except itself. This is the code I'm using:
...
2
votes
1
answer
154
views
Vulkan shadow map artifacts
I am experiencing some weird shadow artifacts.
I suspect it to be some sort of self shadowing/depth bias thing.
My shader for the shadow map is quite simple:
...
0
votes
1
answer
93
views
Vulkan Phong shader problem
Light increases its intensity as it come closer the origin model.
Vertex Shader:
...
0
votes
1
answer
542
views
Fade edges of 2D spline-mesh
I'm re-writing my Unity game in Raylib and are trying to recreate a path/road-shader I made with Shader Graph.
The first picture is how it looks in Unity, with faded/blurred edges.
The path is a 2D ...
1
vote
1
answer
126
views
Vertex Shader Sphere Projection and CPU Distance Calculation
I have multiple planes whose vertices are transformed to a position on a sphere in the vertex shader. The GLSL function called pointToSphere transforms a point <...
1
vote
1
answer
3k
views
How To Convert World Space Normal To Tangent Space?
This question is a continuation of this post on How To Make Seamless Custom CubeMap?
The idea is to create a cube map with procedurally generated noise, extract the noise and a normal map of the noise ...
1
vote
1
answer
152
views
Getting coordinates within a bezier space
I have created an object that is comprised of two bezier curves (constructed of an identical finite segments equal to a variable named resolution). The two curves ...
0
votes
1
answer
89
views
Issues with implementing shadow mapping produces weird results
This is my first attempt in implementing shadow mapping. I am using right hand coordinate system and my projection matrices are producing z values from 0 to 1.
I've decided first to use orthogonal ...
0
votes
1
answer
81
views
Discontinuous Normals on a Normalized Cube Mesh with Displacement Texture
In my project, I have created a normalized cube using six plane meshes. To improve its visual quality, I added a displacement texture and calculated the normals for that texture to ensure proper ...
0
votes
1
answer
154
views
How to scale down noise intensity?
I'm currently making a planet and for that, I added noise, to create terrain on the surface. The method I'm using is creating simplex noise (that ends up looking like the image below)
And I write ...
0
votes
1
answer
355
views
Sending different textures to instanced elements draw call
I'm making a little OpenGL renderer. Currently I use VAOs/VBOs and batch all the entities with the same VAO. I then draw using glDrawElementsInstanced. I am ...
1
vote
1
answer
108
views
Why is my texture moving?
I tried sampling equirectangular texture as a reflection. It simply does not work as intended. The texture is moving with my camera in a weird manner. Here is what I tried to do.
Fragment shader:
<...
0
votes
1
answer
52
views
Semi transparent objects show fuzzy halos when in shadow
I'm having some issues when drawing a semi transparent object after an opaque object, and the object is in the shadows.
On the left, the torch is rendered just fine, I can see a nice blend of the ...
0
votes
1
answer
567
views
Help with calculating tangent/binormal in Vulkan fragment shader using GLSL
I need help understanding what am I doing wrong with transformation/calculation of tangents and binormals using GLSL. I'm using Willems' PBR demo shaders as a reference: https://github.com/...
0
votes
1
answer
58
views
How do I distort a 2D texture based on the movement of a point that starts at the center?
So there's this point that starts in the center. If the user drags it up towards the top of the texture, the top squishes and the bottom stretches. If the user drags it down, the top stretches on the ...
1
vote
1
answer
619
views
How to subdivide an octahedron into a sphere?
For a game I'm making, I have to tessellate an octahedron into a sphere on the GPU (shaders). What I've done is I've successfully tessellated the faces, but I'm having trouble subdividing more spaces, ...
2
votes
1
answer
1k
views
How do I get the depth texture in an expression in Godot 4's visual shader?
I'm working on a tutorial for creating wake waves with Godot, versions 3.5 and, importantly, the upcoming 4.0. It uses shaders (including visual) and works fine so far, but in attempting to get the ...
1
vote
1
answer
934
views
No vertex shader bound at draw?
I tried asking this on reddit but I didn't get any answers so I might as well try here
So I'm making a program to generate some terrain and it's not giving me the results I expected. It's drawing ...
1
vote
1
answer
443
views
Simple GLSL shader results in "1: '€' : unexpected token" compilation error
I have a very simple shader here:
...
-1
votes
1
answer
361
views
Batch rendering model matrix to shader
I'm working on a batch renderer. I'm limited to using one shader per batch (one draw call for everything).
I want to use a TBN matrix for my lighting. To calculate the TBN matrix for each object I ...
1
vote
0
answers
299
views
GLSL GLTF Instanced Hardware Skinning
I'm beating my head on trying to get hardware skinning going in my engine.
We're using OZZ Animation and TinyGLTF together to animate models.
The issue seems to either stem from how OZZ maps their ...
13
votes
1
answer
4k
views
How to do color post processing in WebGL, when you can not read the color of the current pixel?
In a WebGL 2 GLSL fragment shader, one can not access the pre-existing color value of the current pixel, i.e. the color that is already there in the framebuffer before the pixel that is currently ...
0
votes
0
answers
278
views
How to do perspective transformation of linear depth in vertex shader
I know mathematics of perspective transformation.
...
0
votes
1
answer
457
views
How to pass voxel data to shader?
I am working on a voxel game, and I approached the point where I need to add day/night in my world. Apparently, I should just be able to pass the torch and sunlight values into my shader and multiply ...
0
votes
1
answer
234
views
GLSL Shader r GL_INVALID_OPERATION from glUniform1f error with textureSize
For debug purposes I've minimised the shader to the following:
...