Questions tagged [glsl]

A programming language for OpenGL shaders.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 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
281 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
61 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
61 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
55 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
23 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
58 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
95 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
79 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
91 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
77 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
44 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
0 answers
135 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
47 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
  • 11
1 vote
1 answer
340 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
0 answers
432 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
379 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
0 votes
0 answers
88 views

Screen Space Reflections bug in OpenGL

I tried to implement screen space reflections in my OpenGL project using a raytracing algorithm. But something is wrong in it. Here's a video of the visual results so far. As you see, when I try to ...
KeDa Miao's user avatar
1 vote
1 answer
178 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
242 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
0 votes
0 answers
58 views

What is a good way to optimize lighting while keeping it accurate?

I have a lighting shader that currently has two lighting calculation methods. I have a PBR based model and a regular lighting model. I understand that lighting is going to be taxing, but I am getting ...
Landon Harter's user avatar
1 vote
0 answers
134 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
3k 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
123 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
161 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
87 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
173 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
32 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
87 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
120 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
148 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 votes
1 answer
249 views

How to generate terrains in real time?

I am trying to make a terrain editor for my Empire Earth OpenGL clone engine. Are there any articles of how to generate terrains in real time? It would be cool if it had pseudocode, even cooler if it ...
rjhwinner03's user avatar
0 votes
1 answer
122 views

How can I adjust this shader so that my atmospheric scattering works on spheres not positioned at the origin?

I have the following vertex and fragment shaders, adapted from this shader on shadertoy. Vertex: ...
NeomerArcana's user avatar
1 vote
1 answer
234 views

Screen space reflections bug

I try to implement screen space reflections in my graphics engine using ray marching algorithm. After a lot of trying I got this result: https://youtu.be/yzkgpcliBVQ As you can see, the reflections ...
Алексей Карамбович's user avatar
0 votes
0 answers
137 views

Per pixel shadows with depth / displacement map

I am looking to draw 2D sprites that cast artificial 3D shadows onto a flat terrain using an additional depth-texture when rendering the sprites. A black/white depth texture is used to add a height-...
Dahl's user avatar
  • 21
0 votes
2 answers
772 views

Rendering top down water on a 2D surface (OpenGL)

i'm looking for suggestions on how i could use shaders to create a water effect on the surface in the picture (below): I am using noise to create heightmap and normalmap textures that is uploaded to ...
Dahl's user avatar
  • 21
0 votes
0 answers
122 views

What's the solution to this kind of shadow acne?

I'm working with a OpenGL ES/GLSL homebrew engine my company developed, in C++. Below is a screenshot of it rendering shadow acne. The light's direction is too perpendicular to the face of the curve ...
KiraHoneybee's user avatar
0 votes
1 answer
163 views

Why is this shader using multiple render targets not working?

I have a webgl shader that uses multiple render targets. This one only renders to one texture for now. However, I plan that this shader shall render more. However, as soon as I add layout qualifiers, ...
Kotetsu Chan's user avatar
0 votes
0 answers
416 views

How to decompose a GLSL mat4 to original RTS values within vertex shader?

I need to get the rotation differences between the model and the camera. convert the values to radians/degrees and pass it to the fragment shader. for that I need to decompose and the Model rotation ...
Sadern Alwis's user avatar
1 vote
2 answers
143 views

Does OIT Rendering work for semi-transparent textures with opaque parts?

I'm Work ing on a minecraft-like game (in OpenGL with c++) and I'm tryping to Implement Transparency for Blocks like windows, ice, leafs and water. I've tried to implement Weighted Blended Order-...
TheBaum's user avatar
  • 43
-2 votes
1 answer
561 views

Why do we use GLSL(Shader) instead of CUDA?

I'm meaning GLSL and CUDA both utilize GPU to their maximum power and in some cases, I heard CUDA runs faster on Nvidia graphic card. So my question is why don't we use CUDA more often for GPU graphic ...
is code's user avatar
0 votes
0 answers
79 views

Problem to show more than one texture in OpenGL

I'm trying to build a dodecahedron dice. The problem I face is that I'm not able to show more than one texture. I have 12 textures, one for each face. I guess the problem is on the fragment shader, ...
Bocho's user avatar
  • 1
1 vote
1 answer
104 views

Unity Shader w Color Bar for Fragment Color Manipulation

Situation I have a shader for images with "wonky" colors - the reason the colors are so messy is because it's a sneaky way to encode data into the RGB color channels eg the red channel is ...
Jacksonkr's user avatar
  • 223
0 votes
1 answer
1k views

GLSL Convert YUV to RGB

I have a problem where I have YUV, but UV texture is embedded into one texture.. How would I convert Y-UV into RGB ? ...
andre_lamothe's user avatar
0 votes
1 answer
373 views

GLSL - if or #if for conditional sampler read

I have a GLSL ES 3.0 shader and in certain scenario, I want to read from two textures instead of one and do a lerp between them. However, I am not sure what is a better solution. Use standard runtime ...
Martin Perry's user avatar
  • 1,106
2 votes
0 answers
174 views

Best practices for treating Light Volumes in Deferred Lighting pipeline

This topic is about ways to handle light volumes in a deferred lighting pipeline. I currently have a deferred lighting pipeline where spheres are sent to an openGL GLSL lighting shader. The sphere ...
slexov's user avatar
  • 21
1 vote
0 answers
431 views

1Bit Bayer Ordered Dithering Shader

I’m having a problem trying to fix my 1bit ordered dithering shader. This shader is going to be perfect to be used but there is some detail that I would like to fix. First of all, this shader is not ...
Heavybrush's user avatar
1 vote
0 answers
248 views

Cursor trail with fragment shader

I wish to draw a simple mouse trail using fragment shaders, similar in appearance to drawing the following in processing (omitting the step of clearing the canvas). I cannot wrap my head around the ...
msalla's user avatar
  • 111
1 vote
0 answers
120 views

LWJGL Using gl_VertexID properly?

I've gotten back to making lwjgl games, and I'm trying to make a sort of wave type vertex shader. I call this to make it wave: ...
Pale_Gray's user avatar
2 votes
1 answer
232 views

LIBGDX ShaderProgram not passing uniforms

I'm trying to implement a Shader that turns any RGB values below 190 into black. LIBGDX code: ...
Rainma22's user avatar

1
2 3 4 5
19