Questions tagged [glsl]

A programming language for OpenGL shaders.

Filter by
Sorted by
Tagged with
0 votes
1 answer
70 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 ...
Kenny Tutorials's user avatar
0 votes
0 answers
49 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 ...
Giuseppe's user avatar
0 votes
1 answer
63 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: ...
Steyrix's user avatar
  • 203
0 votes
1 answer
36 views

GLSL limit uniform sampler2D to 4 for some reason

I'm writing a deferred rendering pipeline and my fragment shader looks like this: ...
Ronen Ness's user avatar
0 votes
1 answer
25 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 ...
Yvain's user avatar
  • 135
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 ...
IDKsla's user avatar
  • 33
0 votes
0 answers
34 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 ...
Paul's user avatar
  • 1
2 votes
1 answer
154 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 : ...
Gyoo's user avatar
  • 114
1 vote
1 answer
42 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 ...
Javier Villanueva's user avatar
0 votes
0 answers
16 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 ...
Zhukov Artem's user avatar
2 votes
1 answer
40 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 ...
ellipticaldoor's user avatar
0 votes
0 answers
58 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 "...
Charanor's user avatar
  • 7,840
1 vote
1 answer
127 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 ...
Arthur Sally's user avatar
0 votes
0 answers
23 views

TBN matrix multiplication by normal map texture sample gives incorrect results

Vertex shader: ...
Nickname WENGREEN's user avatar
0 votes
1 answer
96 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 ...
Kayla's user avatar
  • 107
0 votes
0 answers
39 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 ...
JoshB's user avatar
  • 1
1 vote
1 answer
76 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: ...
borja vazquez's user avatar
2 votes
1 answer
65 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: ...
Symlink's user avatar
  • 123
0 votes
0 answers
37 views

Need help with artefacts when rendering shadows using a shadow map

I am encountering some weird artefacts when rendering shadows using a shadow map. I am using C++ with Vulkan and GLSL shaders. This is the vertex shader that calculates the ...
Symlink's user avatar
  • 123
0 votes
1 answer
57 views

Vulkan Phong shader problem

Light increases its intensity as it come closer the origin model. Vertex Shader: ...
BrutaL _'s user avatar
0 votes
1 answer
225 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 ...
Johan Tovesson's user avatar
1 vote
1 answer
88 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 <...
Miguel Myers's user avatar
1 vote
1 answer
2k 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 ...
Miguel Myers's user avatar
1 vote
1 answer
115 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 ...
Magikarp's user avatar
0 votes
1 answer
72 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 ...
Zhukov Artem's user avatar
0 votes
1 answer
75 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 ...
Memory1's user avatar
0 votes
0 answers
63 views

Creating a flattened (panorama?) 2D view of a cubemap

I am trying to generate a 360 degree view of a scene by sampling a depth cubemap using spherical coordinates. x and y represent the horizontal, or azimuth, and elevation angles respectively and the ...
marcos's user avatar
  • 1
0 votes
0 answers
66 views

Strange shadow artifacts from lighting when importing blender model in opengl

I'm trying to add model loading to my opengl/sdl2 renderer and I'm successfully loading meshes using assimp after following the tutorial at learn opengl, however when I make my own simple models and ...
YamMan's user avatar
  • 49
0 votes
0 answers
198 views

three.js shader to keep moving vertices of points cloud inside sphere

I am trying to achieve the effect of having a points cloud with moving points while also keeping them confined within a sphere of radius X. I have managed to do it without using shaders but I want to ...
Dimitris Karagiannis's user avatar
0 votes
1 answer
116 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 ...
Chillzy's user avatar
  • 47
0 votes
1 answer
211 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 ...
BinarSkugga's user avatar
1 vote
1 answer
83 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: <...
Eskimo Joe's user avatar
0 votes
1 answer
49 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 ...
jucarave's user avatar
0 votes
1 answer
294 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/...
krz's user avatar
  • 1
0 votes
1 answer
53 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 ...
Emily's user avatar
  • 21
1 vote
1 answer
459 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, ...
Chillzy's user avatar
  • 47
0 votes
1 answer
710 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 ...
Michael Macha's user avatar
1 vote
1 answer
612 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 ...
Chillzy's user avatar
  • 47
1 vote
1 answer
299 views

Simple GLSL shader results in "1: '€' : unexpected token" compilation error

I have a very simple shader here: ...
Liyuu_'s user avatar
  • 31
-1 votes
1 answer
295 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 ...
J. Doe's user avatar
  • 101
1 vote
0 answers
191 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 ...
KKlouzal's user avatar
  • 252
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 ...
Anders's user avatar
  • 243
0 votes
0 answers
196 views

How to do perspective transformation of linear depth in vertex shader

I know mathematics of perspective transformation. ...
JiangnanLong's user avatar
0 votes
1 answer
258 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 ...
X Builder's user avatar
  • 101
0 votes
1 answer
133 views

GLSL Shader r GL_INVALID_OPERATION from glUniform1f error with textureSize

For debug purposes I've minimised the shader to the following: ...
Hasen's user avatar
  • 194
0 votes
0 answers
261 views

How do I make a shader that simulates acrylic paint being smeared on a surface?

I know something about shaders, I have written some very basic shaders. This is the most advanced shader I have written so far. It's been several days since I conceived the idea of trying to recreate ...
blablaalb's user avatar
0 votes
0 answers
38 views

WebGL fragment shaders for SNES S-PPU?

I’m not very experienced with WebGL and want to ask if this project is potentially feasible and also for a few hints about what direction I may want to take. I’d like to implement all of the logic ...
OrgnlDave's user avatar
  • 133
0 votes
1 answer
174 views

Wrong results in Fragment shader when using clamped value

I'm following a tutorial and I want to clamp all position values of a triangle between 0 and 1 then output them as a color this is the code for my vertex shader: ...
ViperTheGuy's user avatar
0 votes
1 answer
203 views

Is it possible to have shared data between shaders in GLSL that is loaded once?

For my game engine, I would like to be able to load all of the matrices (i.e. mvp, model, etc.) once per frame to save a bit of time, and have a set of uniforms that any shader can access by using ...
hoZer's user avatar
  • 1
1 vote
1 answer
185 views

How do I modify parts of a texture on a quad?

I am programming a Real Time Strategy game, and I was wondering how I could retexture one part of a terrain quad to change a texture in the position where I click at. For example, if I clicked in the ...
rjhwinner03's user avatar

1
2 3 4 5
20