Questions tagged [glsl]

A programming language for OpenGL shaders.

Filter by
Sorted by
Tagged with
1
vote
0answers
26 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: ...
2
votes
1answer
28 views

LIBGDX ShaderProgram not passing uniforms

I'm trying to implement a Shader that turns any RGB values below 190 into black. LIBGDX code: ...
0
votes
0answers
22 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"...
0
votes
0answers
25 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 ...
0
votes
1answer
31 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 ...
1
vote
1answer
39 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 ...
0
votes
0answers
28 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. ...
0
votes
1answer
35 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 ...
2
votes
1answer
64 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: ...
0
votes
0answers
29 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 ...
0
votes
1answer
46 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 ...
0
votes
0answers
14 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 ...
2
votes
0answers
30 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 ...
0
votes
0answers
46 views

Help needed to render textures using fragment shader (or procedural textures)

Recently, I have been making a 3D game. I was messing with my shader files, when I ran into a problem. The "texture" I made for the fragment shader just renders on top of the object, and ...
0
votes
0answers
23 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, ...
0
votes
0answers
29 views

Screen space reflections shown at incorrect position

I have been trying to add a SSR post-processing effect into my engine for a while now, but it always seems to fail on the same thing: Reflections are not properly positioned below the object instead ...
2
votes
1answer
186 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 ...
0
votes
0answers
34 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, ...
1
vote
2answers
27 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 ...
0
votes
1answer
176 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: '#...
0
votes
1answer
30 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: ...
1
vote
1answer
105 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 ...
5
votes
1answer
127 views

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

I'm writing some Vulkan code and write my shader in GLSL. I tried to use Renderdoc to debug my shader, but I only got disassembly code. Is it possible to debug shaders at the level of GLSL if I have ...
0
votes
0answers
37 views

WebGL transparent gradient mask at edge

I need to make a feature in WebGL, where I have horizontal list of meshes (example 20) and I want to show only 3 and 2 at edge are fade in/fade out. And it slowly animates from one side no another (...
1
vote
1answer
76 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 (...
4
votes
1answer
685 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 ...
0
votes
0answers
87 views

How to implement PCSS properly?

I'm trying to implement PCSS in OpenGL/GLSL, but I have problems understanding the details especially the conversions between the coordinate spaces. The existing implementations are so different from ...
2
votes
1answer
70 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 ...
0
votes
0answers
58 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. ...
0
votes
1answer
97 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: ...
0
votes
1answer
74 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 ...
2
votes
1answer
269 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: ...
1
vote
0answers
45 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), ...
1
vote
0answers
92 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 ...
0
votes
1answer
104 views

How to convert from frag position to UV coordinates when my viewport doesn't cover the screen?

So, I'm implementing SSAO as part of my rendering pipeline using OpenGL/GLSL. It works pretty well when I have a camera that takes up the entire screen. However, when my camera is smaller than the ...
0
votes
0answers
26 views

Send Geometry Data to Multiple Shaders

So I am implementing a deferred rending model for my engine, and I want to be able to send all scene geometry into a single shader to calculate ambient, diffuse, normal, ect thats not the question. ...
0
votes
0answers
55 views

Repeat/Scroll texture on CubeMap

I need a method to scroll an image across all sides of a cube map in a way similar to scrolling a UV texture across a water's texture to give the appearance of movement by shifting the normals. I want ...
0
votes
1answer
56 views

Efficiently color a procedural mesh?

I'm creating a procedural world with LWJGL and GLSL. I want to better visualize the biome map being produced and the height map it creates, but my attempts so far have been very inefficient. My first ...
4
votes
2answers
347 views

GLSL: How can I optimize this lighting (fragment) shader? Basic 2D game, 30+ light sources cause significant frame loss

I am using a fragment shader to create circular light sources in my 2D game. Full code at the bottom. Essentially, an array of light source objects (called Lights in the code) are passed into the ...
0
votes
1answer
129 views

What is the difference between these two shaders in terms of performance?

I have implemented a two pass Gaussian blur shader in GLSL like this: ...
1
vote
0answers
73 views

Wireframe shader sometimes won't render parts depending on camera rotation

I'm trying to make a stylized wireframe shader for a game using this method, but it seems to be conflicting with my character controller. Here's some images to better show what's going on: https://...
0
votes
1answer
53 views

glsl wrong light direction

I'm practicing the Phong lighting model with glsl, and here's my shaders: vertex shader: ...
0
votes
0answers
36 views

Per-object screen space uv issue

I am currently trying to sample a texture in screen space. This works well : ...
3
votes
0answers
52 views

Help in understanding atmospheric scattering shading

I have a made a planet and wanted to make an atmosphere around it. So I was referring to this site: Click to visit site I don't understand this: As with the lookup table proposed in Nishita et al. ...
5
votes
1answer
4k views

How can I achieve simulated fluid surface deformation in a bottle?

I'd like to mimic this effect seen in Half Life: Alyx: I can't figure out what is going on here, people say "it is just a shader effect it isn't simulating anything", but I don't think that is true ...
-1
votes
1answer
160 views

How do I debug OpenGL apps written in python?

How do I debug OpenGL apps written in python? I tried but I was unable to use standard tools like nvidia nsight or glsl-debugger or renderDoc on python code.
2
votes
0answers
147 views

THREE.ShaderMaterial cannot perform antialiasing

I created a ShaderMaterial to draw a box in three.js using the following key code: ...
0
votes
1answer
43 views

How to map texture across whole face?

I'm trying to map a texture to a square face in OpenGL 3.2, but the texture gets tiled in the upper right corner. I've tried changing the uv coordinates, vertices and shaders, but nothing seems to ...
0
votes
1answer
345 views

Implement spherical mapping for texture coordinates

I am using a texture of a world map and I am trying to put that image on a sphere made up of many triangles. Each triangle has points a,b,c with their own (x,y,z) coordinates. I am trying to use the ...
0
votes
0answers
28 views

Draw circle OpenGL 3.3 [duplicate]

How do I draw a perfect/smooth circle using OpenGL 3.3 and GLSL? I can only find old OpenGL tutorials or ones that have a blocky circle. I would also like to be able to resize the circle to become an ...

1
2 3 4 5
18