Questions tagged [glsl]

A programming language for OpenGL shaders.

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

Questions about normal mapping in TBN space

The questions are about code sample doing normal mapping. The linked shader is vertex shader doing calculation in tangent space. The code works correctly and renders a nice fireplace and ground with ...
user avatar
  • 197
1 vote
0 answers
56 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 ...
user avatar
0 votes
0 answers
25 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-...
user avatar
  • 21
0 votes
2 answers
99 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 ...
user avatar
  • 21
0 votes
0 answers
12 views

Trying to write to GL_R16UI buffer, but everything is zero

I've written some render data to an offscreen RGBA texture, and it works. However, I don't need a full 32 bits to hold this data, so I wanted to convert to a 16-bit buffer where I can just write ...
user avatar
0 votes
0 answers
82 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 ...
user avatar
0 votes
1 answer
40 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, ...
user avatar
0 votes
0 answers
29 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 ...
user avatar
1 vote
2 answers
29 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-...
user avatar
  • 43
-2 votes
1 answer
81 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 ...
user avatar
0 votes
0 answers
22 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, ...
user avatar
  • 1
0 votes
0 answers
29 views

How do I represent team colors without Pixel Shaders in DirectX?

So I have been programming a RTS game in DirectX, and, of course, there needs to be team colors so that the players are not confused as to which troop is theirs. I managed to give each troop a hue ...
user avatar
1 vote
1 answer
31 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 ...
user avatar
  • 191
0 votes
1 answer
93 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 ? ...
user avatar
0 votes
0 answers
36 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 ...
user avatar
  • 1,076
0 votes
0 answers
19 views

Parallax mapping issue

Can anyone guess why this shader is only working from a top down view position (0.0, -1.0, 0.0). The parallax mapping calculation in the shader below is basically copied directly from learnopengl.com ...
user avatar
  • 21
0 votes
0 answers
77 views

Ursina Engine shaders not supported

Ursina shaders don’t work for me. I’m running Ursina 4.1.1 on Python 3.8.5 on macOS 10.15.5. Shaders I tried: lit_with_shadows_shader screenspace_shaders.fxaa_shader screenspace_shaders.ssao_shader ...
user avatar
  • 257
2 votes
0 answers
44 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 ...
user avatar
  • 21
1 vote
0 answers
154 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 ...
user avatar
1 vote
0 answers
98 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 ...
user avatar
  • 111
1 vote
0 answers
44 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: ...
user avatar
2 votes
1 answer
71 views

LIBGDX ShaderProgram not passing uniforms

I'm trying to implement a Shader that turns any RGB values below 190 into black. LIBGDX code: ...
user avatar
0 votes
0 answers
34 views

Is there a technique to properly illuminate a PBR material when using directional light?

I use the following formula to calculate PBR color for each light source. For the sake of this post, let's assume that there is only one directional light. I am using Vulkan; so, +Y is "down"...
user avatar
  • 189
0 votes
0 answers
45 views

Multipass rendering pipelines comparison (basic, uber, compute, ...)

I'm working on a project in wich as you can see in V1 it's doing a lot of drawcalls, 3 per instance of MyRenderer actually, in the first place I would like your opinion on this pipeline, if I'd be ...
user avatar
  • 21
0 votes
1 answer
48 views

Dynamic textureIds in glsl

I have a bunch of texture IDs that each correspond to an image, I would like an integer to be passed in as an attribute, and then just get a ...
user avatar
0 votes
1 answer
118 views

Tangent Space Light Direction Incorrect?

I have normal mapping with a directional light in place. I noticed the lighting looks off but am unsure why it is happening. I believe it is related to the TBN matrix and possibly the handedness fix ...
user avatar
  • 21
0 votes
0 answers
69 views

How to map 2d point on grid/plane mesh to 3d point on sphere with minimal distortion?

I have a grid of voxels that I want to "bend" into a sphere via a vertex shader with minimal distortion. I've tried 2 approaches so far, both of which don't quite give me the desired effect. ...
user avatar
0 votes
1 answer
92 views

GLSL Shade a box different colors for two ends with one material in Three.js

First, I knew the following basic knowledges, GLSL Language, Learn WebGL2 ​- GLSL ​* GLSL Shaders OpenGL - Coordinate Systems, [OpenGL - Advanced GLSL] 3D Game Shaders For Beginners - GLSL ...
user avatar
  • 121
0 votes
1 answer
86 views

OpenGL 2D texture lookup returns zero (black)

I am trying to use a 2D texture as a lookup table for pre-computed values. In each case I set all values of the texture to 0.5 for testing. When I use a 1D texture, it works and I get 0.5: ...
user avatar
  • 125
0 votes
0 answers
43 views

How does Physical Based Shading work with multiple light sources?

I have implemented a PBR shader in my game engine that works with a single light source. Everything is good and made sense at a higher level about what each algorithm does. Now I am working on adding ...
user avatar
  • 189
0 votes
1 answer
148 views

Debugging shader script in GLSL ES - Game Maker 2 (CompileError)

I am trying to use this shader in the game I am making with Game Maker Studio 2. I tried to convert it for GM2 and here is my result: Shader type I used on GM2 is ...
user avatar
  • 111
0 votes
0 answers
16 views

Directional lighting messups with uniforms

Recently, I've been making a 3D game, and I have more progress! I am trying to implement lighting, but when I want to change the directional light uniform manually, it gets weird. Here's an example ...
user avatar
1 vote
0 answers
51 views

Determine terrain color based on slope and height with many types of terrain

I've got a specific problem. Take this as a challenge, if you will. I have a 3D mesh representing a cliffy terrain. It's constructed from a simple height map. The goal is to determine what type of ...
user avatar
0 votes
0 answers
26 views

Not clearing FBO's Texture error in battery economy mode

When rendering inside a FBO's texture, I'm not using glClear() but overwriting each fragment, GL_BLEND is set to true. This works just fine, but I just realised when my laptop switch to economy mode, ...
user avatar
  • 21
2 votes
1 answer
480 views

Any fast alternative to sine in GLSL?

Should I just use the built-in sin() function or my custom sine function? I'm concerned about performance here. I don't care about accuracy much here because I use it to just get wave effects in my ...
user avatar
0 votes
0 answers
67 views

PBR GLSL shader incorrect lighting. Half being shaded

I have been following the tutorial at LearnopenGL to implement physically based rendering into my Vulkan game engine, and have gotten the following incorrect lighting results: The light is overhead, ...
user avatar
1 vote
2 answers
41 views

unsmooth blending with deferred shading and light volumes

So I implemented deferred Shading with a single full screen light pass (picture 2) (by passing the light-data as an array to the shader) and deferred shading with point light volumes (picture 1) (by ...
user avatar
0 votes
1 answer
526 views

Get a warning about extension when compile GLSL code with glslc compiler shipped with vulkan SDK

Trying to compile my pixel shader,and a warning generated: D:\CS\ComputerGraphics\vulkan\WindowsProject1>D:\ProgrammingTools\vulkan\Bin\glslc shader.frag -o frag.spv shader.frag:3: warning: '#...
user avatar
0 votes
1 answer
52 views

Depth to World Space Position problem

I am having a problem with turning depth to world space position. I am using GLSL. What could go wrong? Here is the code: ...
user avatar
1 vote
1 answer
157 views

Why does my stencil buffer allow pixels through?

I'm rendering a scene using OpenGL. The scene consists of a grassy environment and a small lake (visible as two surfaces). To achieve water surface transparency, I'm using a stencil buffer to render ...
user avatar
  • 529
4 votes
1 answer
185 views

Is it possible to debug shaders in GLSL level instead of assembly language level?

I'm writing some Vulkan code and write my shaders in GLSL. I tried to use Renderdoc to debug my shaders, but I only got disassembly code. Is it possible to debug shaders at the level of GLSL if I have ...
user avatar
1 vote
1 answer
160 views

Why is my tessellation output failing to reach my geometry shader?

I'm attempting to render grass using GLSL tessellation and geometry shaders. For vertex input, I'm using position and normal. For reference, here's an image of the grassy field without tessellation (...
user avatar
  • 529
4 votes
1 answer
1k views

How to write shaders that can be compiled for DirectX, OpenGL, and Vulkan

I recently finished writing the DirectX renderer for my game engine. Now I have an OpenGL, DirectX as well as a not yet finished Vulkan renderer. Well, the majority of the renderers work perfectly now ...
user avatar
1 vote
1 answer
98 views

2D shadow from polar coordinates has hard cut-off at a certain radius

I'm trying to cast shadows from a 1D texture that goes from white to back according to the distance given by an occlusion map. That part I think I got it right. The problem lies on the algorithm to ...
user avatar
0 votes
0 answers
121 views

In a shader how to map UV coordinates of texture to the UV coordinates of a tile in a tile set?

I am writing a fragment shader for a tile set. In the shader I have the UV coordinates of the whole texture, however, I am interested in the UV coordinates of the current tile that is being rendered. ...
user avatar
  • 707
0 votes
1 answer
157 views

Why does reading my depth texture in GLSL return less than one?

I've created a depth texture in OpenGL (using C#) as follows: ...
user avatar
  • 529
0 votes
1 answer
124 views

Shader Flickering Normal Map Lighting

I am encountering an issue when using a normal map with directional and/or point lighting. Without using the lighting, I am able to render the object fine. When any amount of lighting is applied, it ...
user avatar
  • 21
2 votes
1 answer
406 views

Is linear filtering possible on depth textures in OpenGL?

I'm working on shadow maps in OpenGL (using C#). First, I've created a framebuffer and attached a depth texture as follows: ...
user avatar
  • 529
1 vote
0 answers
56 views

GLSL link fails with C9999 (too many buffer declarations?)

I'm receiving a C9999 (*** exception during compilation ***) linker error for an OpenGl 4.6 compute shader. It seems to be related to the number of SSBOs I have declared (14 separate declarations), ...
user avatar
  • 11
1 vote
0 answers
118 views

Basic 2D Lighting Optimization Issue in Fragment Shader with OpenGL (GLSL)

I'm using a fragment shader to implement 2D lighting (code further below). Even though I am satisfied with the visuals of the light i noticed that it has a quite big GPU usage, and when trying to add ...
user avatar

1
2 3 4 5
19