Questions tagged [glsl]
A programming language for OpenGL shaders.
956 questions
0
votes
0
answers
41
views
Share custom lighting data struct with GLSL vertex & fragment shaders
I've reached normal maps as I was learning OpenGL, and I decided to calculate the tangents on the CPU.
The issue is that my lighting uses custom structs and it ...
1
vote
1
answer
172
views
How the intersection of BVH boxes can determine whether or not a triangle appears?
I'm programming a Ray Tracer using Rust and OpenGL, I've already made Ray Tracing work in the basics by converting the data to an SSBO and sending it to the Shader in a basic way... The problem is ...
0
votes
1
answer
87
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 ...
2
votes
1
answer
325
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
0
answers
705
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
1
answer
185
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
160
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
71
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 ...
0
votes
0
answers
103
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 ...
1
vote
1
answer
159
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 ...
2
votes
1
answer
87
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 ...
1
vote
1
answer
202
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
92
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 ...
2
votes
1
answer
319
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
868
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
5k
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 ...
0
votes
1
answer
137
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
201
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 ...
1
vote
1
answer
125
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
773
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/...
1
vote
1
answer
767
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, ...
1
vote
1
answer
1k
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
votes
1
answer
420
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 ...
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
1
answer
583
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 ...