Questions tagged [glsl]

GLSL is the OpenGL shading language. Use this tag for questions which are specifically about shaders written in this language. For generic shader questions use [shader] instead.

Filter by
Sorted by
Tagged with
1
vote
0answers
33 views

Projective Texture / Shadow Mapping — Why is the perspective division performed in the fragment shader?

I've just worked my way through this OpenGL shadow mapping tutorial. While I understand the basic algorithm, one thing puzzles me: During the 2nd render pass all vertices are transformed into the clip ...
0
votes
1answer
31 views

Stumped on GLSL error C5041 (cannot located suitable resources to bind variable… possibly large array

I have an OpenGL based graphics engine coming along quite nicely, but I'm currently stumped on a problem that arose after adding a new vertex shader output array. The vertex shader is outputing the ...
1
vote
1answer
118 views

How to compute normal in quartic Walton-Meek's Gregory patch in tessellation shader?

I am programing a tessellation shader in OpenGL which computes the quartic Walton-Meek's Gregory patch. I am searching for a local G1 method with good shading/visual results. So I am trying this patch....
1
vote
2answers
37 views

Help with wireframe artifacts on mesh procedural UV texturing

My goal in my project is to render a procedural texture for a given mesh based on a predefined camera projection. The way I choose to accomplish it is by creating tex coords based on only the visible ...
1
vote
1answer
67 views

Shader code for putting an atmosphere over a planet

I'm working on a game set in space with procedurally generated planets, and I'm trying to write a shader that puts an atmosphere over a planet given the color of the atmosphere and the strength of the ...
2
votes
0answers
52 views

Calculate the distance between two 3d points in screen coordinates

Given the Point A with the coordinates gl_FragCoord.xy, I have to find the distance to the Center of the cube face to which it belongs in screen coordinates. ...
0
votes
0answers
26 views

Is there a way to animate 'Tiling' of UV map using GLSL or Shader Language?

I'm looking for a way in where I could not only change the Texture UV Map 'Tiling' inside of Unity, but animate it by just having the 'X' go back and forth now and then from like 0.98 to 1.02 or ...
0
votes
0answers
21 views

What quad will fill the screen, which can be inverse-projection-view transformed to map to the near frustum plane?

I've been experimenting with raytracing using GLSL. I had success rendering a cube which encloses the object. Now I want to do a full-screen raytrace, and I want to construct a quad which covers the ...
0
votes
0answers
22 views

How to visualize a dataset , generated in curvilinear grid, in opengl with texture maping?

I have a dataset obtained from astronomical simulation. This data was created in a curvilinear grid with polar coordinates. The form of this dataset is a simple array (1d) of intensities, i can ...
0
votes
0answers
27 views

Mathing gl_PerVertex declarations

Half a year ago the vulkan validation layer of matching the declaration of gl_PerVertex between shaders (e.g. vertex and geometry). Hence following pair of shaders now throws a validation error: <...
2
votes
1answer
133 views

GLSL Compute Shader doesn't run for large inputs

The shader takes an SSBO of Photons that have a position, direction, wavelength and intensity and each thread is responsible for tracing exactly one photon through the grid, where at each grid cell ...
1
vote
1answer
51 views

Wrapping normals around a sphere

I'm using a vertex shader to effectively wrap vertices on a sphere. Starting with world_position already after multiplying the vertex by the model transform matrix ...
2
votes
0answers
45 views

Communication between vertex shader executions

Look at this vertex shader: ...
2
votes
1answer
79 views

Strange dark spot when lighting in deferred rendering PBR shaders

It's probably something obvious but there seems to be a strange issue with lighting in my pipeline. I'm trying to keep everything in world space at the moment for simplicity but cannot figure out what'...
2
votes
1answer
171 views

What do the OpenGL version strings from glxinfo actually mean?

Note: I wasn't 100% certain if this question belonged here or in Ask Ubuntu. I figured since it was about OpenGL programming I'd put it here, but if I should move it to Ask Ubuntu, please let me know. ...
1
vote
1answer
79 views

Difference between isnan and comparison to self

In GLSL, what is the difference between isnan(x) and !(x == x)?
0
votes
1answer
139 views

Mimic shadertoy in WebGL

I was following this guide for drawing circles using shadertoy. Now I am trying to mimic the examples behaviour in WebGL. Here is a working shadertoy example I try to mimic. The code is not mine, see ...
2
votes
1answer
176 views

Clarifying vulkan glsl std140

So I have a uniform block that looks something lile this { mat4; mat4[128]; uint[16] } The block should total up to 8320 bytes. After aligning by 256 bytes for nvidia, that brings the total ...
1
vote
0answers
60 views

How to hide a part of a geometry dynamically using a shader in three.js

I have a very big geometry in three.js and I want to hide a section of that geometry along an axis (for example every vertex with a Z>N must be hidden). My idea is to create a custom shader in GLSL ...
1
vote
0answers
71 views

Convey screenspace bounding box of rendering result

Imagine I render to an FBO some arbitrary geometry. Geometry can be rendered via single or multiple draw calls. For the sake of the question, assume I know nothing about geometry or transformation ...
2
votes
0answers
61 views

Show the edges between the clipping plane and clipped objects [closed]

I want to utilize shaders to not only discard fragments if they are on one side of a predefined plane but also render a contour along the intersection. My fragment shader currently does something ...
1
vote
1answer
273 views

How does a GLSL Sampler2D read a Vec2 UV coordinate to determine UV range

I am working with an atlas shader that steps through various sprite tiles within a single png atlas page to playback an animation with sampler2D. Looking at the shader code, I would expect to have to ...
0
votes
1answer
145 views

Convert shader from GLsl 1.50 to 1.30

I'm a newbie with OpenGl and I'm stuck in following the tutorial. I found this tutorial with these shaders ...
2
votes
1answer
53 views

Alpha component in color buffer affects RGB components?

I'm looking for a way to make my surface semitransparent, and for now i ended up using this configuration: ...
0
votes
2answers
65 views

Why is precalculating a distortion different from calculating it in the shader?

I have an application where I simulate a camera distortion. There are two ways to go about it: calculate the distortion per pixel in the shader or precalculate the distortion and store the distortion ...
4
votes
1answer
269 views

How does GLSL code get “loaded” and “compiled”?

I just wanted to find out for sure how GLSL code gets loaded and compiled. Does the g++ compiler do it?
1
vote
1answer
151 views

Is it possible to access adjacent vertex data in tessellation evaluation shader?

I'm trying to render thick cubic Bezier curves using the whole OpenGL 4.5 pipeline: I render a patch with 4 control points. Vertex shader is simply pass-through to tessellation control shader. ...
1
vote
1answer
106 views

Using depth texture to mask local pixels

I have a scene with camera facing billboards drawn with depth write off so they appear on top of other objects. I would like to draw each sprite so that any obscured pixels are drawn with a very low ...
0
votes
1answer
300 views

GLSL Debugging Volumetric light

I'm implementing basic volumetric lighting using deferred shading (gbuffer + render to screen quad) and basic shadow mapping. So, I am sending the position texture and shadow map to a separate shader,...
1
vote
0answers
217 views

Understanding bad shadows with voxel ray tracing

I have a voxel raytracer that is generating some weird shadows and I want to understand what is the source of the problem. The image is voxelized, resulting in: I then generate Hard shadows from the ...
0
votes
1answer
152 views

SSAO random noise vector generation

I am currently trying to implement SSAO on my graphics engine. I am following John Chapman's tutorial here. This is a pretty popular article that is used as reference in many SSAO articles. The part ...
1
vote
0answers
80 views

glTexSubImage3D throws GL_INVALID_ENUMERATION on NVIDIA

I'm having problems when using the following statement on different GPUs: glTexSubImage3D(target, 0, 0, 0, 0, width, height, layers, format, type, NULL); on ...
1
vote
0answers
425 views

How Skia uses OpenGL backend?

Skia 2D's one notable backend in OpenGL, but how does it work under the hood to render? Say, we need to draw an anti-aliased circle. Does Skia: make a quad (using 2 triangles) and paint the circle ...
3
votes
0answers
216 views

Circular pattern aliasing in voxel ray tracer

I am doing a voxel based raytracer. In other words, I first voxelize the scene using rasterization and I proceed to raytrace the volume in a 3D image to generate a final frame. Currently I noticed ...
0
votes
0answers
188 views

How to properly modify a ray in a raytracer to achieve camera rotation

I am trying to make a particular kind of raytracer, but there is some strange bug occurring when I attempt to rotate the camera. As you can see, there is some important distortion ocurring when the ...
4
votes
1answer
525 views

Is a branched discard to be avoided

When a simulating a camera, I may run into the situation that a black elliptic border is needed (rather than a rectangular image). In this case I have the option to discard the fragment in the ...
4
votes
1answer
3k views

How to use GLSL texelFetch?

I have read the OpenGl documentation of texelFetch, which is: gvec4 texelFetch(gsampler2D sampler, ivec2 P, int lod). I know the first argument "sampler" is just a texture. But I am very confused ...
4
votes
1answer
548 views

How to align Ray Marching on top of traditional 3D rasterization?

I'm trying to apply raymarching on top of 3D rasterization, ordering what 3D object gets displayed based on the depth of a rasterization pass and the raymarch depth. After getting the transform ...
1
vote
1answer
363 views

Curve rotation in GLSL fragment shader

I'm trying to figure out the correct math to rotate and translate a curve displayed in a fragment shader. What I try to accomplish is to define a curve, for example a sine curve, in a local ...
5
votes
1answer
576 views

Manually fetching 8 neighboring texels from 3D texture greatly decreases performance

I'm implementing manual interpolation between texels in a 3D texture to be able to discard some of them when needed. Compared to hardware interpolation, this process takes a lot of time. If I simply ...
3
votes
4answers
260 views

How to access several textures from huge amount of textures in a shader?

I'm developing a light probe based GI solution and currently dealing with light leaks due to interpolation between probes located on opposite sides of the walls. I want to tackle the problem by ...
2
votes
1answer
729 views

How to get assembly code from GLSL Shader

I am new to optimizing shader code. Now that I have written an "optimzation", I want to make sure that it really speeds things up and is not just an unreadable version of what I intend to do. For this,...
1
vote
0answers
113 views

GLSL can't calculate texture and reflection

I'm working on a universal shader, and have a function for calculating reflections and a function for textures. When I run the shader, it seems to give up and discard all fragments. The texture and ...
1
vote
1answer
57 views

Non-point lights

Is there a technique for implementing non-point lights (i.e. light that has actual physical dimensions)? I can't think of anything except than making a light source out of multiple point lights, but ...
1
vote
1answer
176 views

Gravitational calculation of a particle via GLSL / WebGL

I have a running particle system which emits particles in a given radius. Now I want to add some gravity to it. The particles and velocities of each particle is saved in a 2D Texture, now I want ...
7
votes
2answers
2k views

How can I convert signed distance field to a mesh?

I can easily make models by Modeling with Distance Functions but I need make mesh from It so I decide to use voxelizing and make triangles for my signed distance field torus like this video.but I ...
3
votes
1answer
422 views

GLSL shapes signed distance field implementation explanation?

I'm trying to understand all primitives In this article.After hard work I just learn Sphere and Cube , I wrote description here. I could draw 2D shapes but I have trouble understanding 3D below codes:...
3
votes
1answer
228 views

Is sub-texel shading possible?

I suspect the answer is no, but thought I'd ask anyway. It seems that other than using nearest neighbour and bilinear interpolations, there is nothing you can do to determine how two adjacent pixels ...
1
vote
1answer
173 views

What's wrong with my computation of the intersection of a ray with a sphere

I am learning GLSL and trying to raytrace a sphere. Here is a fragment shader. It correctly discards fragments which are not on the sphere, but when I try to calculate the point of intersection (and ...
1
vote
1answer
336 views

How to scale and offset a cubemap using sphere mapping

I am trying to scale and repeat a Cubemap with Latitude-Longitude mapping layout just as you would do with classical UV mapping but without any interesting result. This should be used as a skybox. ...