Questions tagged [glsl]

A programming language for OpenGL shaders.

Filter by
Sorted by
Tagged with
0
votes
1answer
27 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
54 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
25 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
32 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
13 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 ...
1
vote
0answers
26 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
43 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
22 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
23 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
116 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
31 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
23 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
88 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
25 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
92 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
110 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
28 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
64 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
567 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
83 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
65 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
35 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
91 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
64 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
233 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
44 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
79 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
86 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
23 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
84 views

How to draw a screen space decal along a desired projection direction and control which surfaces it affects?

I am currently programming a complex 2D lighting system which calculates lighting in 3D space. Something like what I want to achieve (Source @pixpilgames from Twitter): I recently learned how to ...
0
votes
0answers
49 views

Ray Tracing in One Weekend, how to add depth of field to view matrix?

I'm working through the infamous Ray Tracing in One Weekend book as I implement it on a OpenGL compute shader, the only thing I have left to do is add depth of field. I have this function that ...
0
votes
0answers
17 views

Constant size geometries for glDrawArraysInstanced calls

In my application I can keep the objects constant sized ...
0
votes
0answers
50 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
0answers
50 views

Using break statement in a GLSL compute shader

I'm writing a compute shader that is invoked once for each vertex of a geometry, and does a distance based search to find the the N closest vertices. To do this each invocation iterates over the ...
0
votes
1answer
50 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
285 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
128 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
69 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
47 views

glsl wrong light direction

I'm practicing the Phong lighting model with glsl, and here's my shaders: vertex shader: ...
0
votes
0answers
34 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. ...
4
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
137 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
116 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
41 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
299 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
26 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 ...
0
votes
0answers
247 views

Discarding GLSL fragment values not working with stencil buffer

I am trying to make a system where I can outline sprites, but I can only get it to work correctly when I use a regular-shaped texture. Here is what an outlined regular texture looks like: However, ...
2
votes
0answers
37 views

How to apply a color transform to textures when using pre-multiplied alpha?

I'm trying to apply a color map to my textures. The map is a 4x4 matrix that adjusts the contribution of each RGBA channel returned from the fragment shader. My texture needs to use pre-multiplied ...
0
votes
0answers
63 views

Is it more performant to index in the vertex shader or fragment shader?

I have a shader that draws 2D quads from a texture atlas using instancing. I'd like to add a feature that allows me to map each of the RGBA channels in the texture using a 5x5 matrix. For example, the ...

1
2 3 4 5
18