Questions tagged [glsl]

A programming language for OpenGL shaders.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 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 ...
user avatar
  • 123
0 votes
0 answers
27 views

Shadow mapping not working properly in OpenGL

I wanted to create shadows for my 3D graphics project, but when I created the framebuffer, the depthmap and the shaders, I get a non-lit scene as it has no diffuse lighting. These are my default ...
user avatar
-1 votes
1 answer
59 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: ...
user avatar
0 votes
1 answer
35 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 ...
user avatar
  • 1
1 vote
1 answer
64 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 ...
user avatar
-1 votes
1 answer
161 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 ...
user avatar
0 votes
1 answer
104 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: ...
user avatar
0 votes
0 answers
67 views

World bending (inception like) implementation from scratch

I'm doing my very first engine in c from scratch as an exercise and I wanted to implement this as an added bonus. However I know 0 about three.js or GLSL and I'm having a really hard time ...
user avatar
  • 101
0 votes
0 answers
27 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
1 answer
98 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
45 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
203 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
14 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
86 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
80 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
74 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
42 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
133 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
34 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
34 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
39 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
205 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
78 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,096
0 votes
0 answers
22 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
114 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
56 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
219 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
123 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
60 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
94 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
50 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
53 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
50 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
143 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
102 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
141 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
94 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
48 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
199 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
17 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
57 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
620 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
94 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
55 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
666 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
61 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
175 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
206 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
183 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

1
2 3 4 5
19