Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

For all questions related to shaders, i.e. the programmable part of the GPU pipeline. For language-specific shader questions, see also the [glsl] and [hlsl] tags.

0
votes
0answers
30 views

What is the use of effect files?

I am reading Real Time Rendering and getting confused by something called effect files. From what I understand, it is like a library of pre-written shaders so instead of writing my own shaders for a ...
1
vote
0answers
41 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 ...
0
votes
0answers
67 views

Changing coordinate system from texelFetch to textureLod is breaking the algebra

I have a scene rendered using texelFetch() and I am trying to modify the shader to use textureLod() instead. This is the image generated with texelFetch: When I try to change the shader to use ...
2
votes
1answer
60 views

Importance Sampling in Unreal Engine Formula Derivation (Irradiance term)

I am currently trying to understand IBL in Unreal Engine, and there are so much things that I don't understand about the formula. Unreal approximate the specular term of shading equation by doing ...
1
vote
1answer
39 views

Controling order of execution of a (compute) shader on an array of vertices (data) in Vulkan

Is it possible to force Vulkan to execute a shader on vertices (data) in a semi-consecutive manner? For example, if the data passed to the shaders as a binary tree, shader would process it one layer ...
1
vote
1answer
47 views

Can you avoid querying for a texture location in OpenGL?

The way I learnt to send a texture to a shader is more or less ...
0
votes
0answers
44 views

How do modern GPUs handle branching instructions in shader code?

It has often been recommended to avoid branching conditions in shaders. Why? What happens exactly in modern GPUs in that case? Is it still recommended to avoid branching?
5
votes
1answer
88 views

Radiative Transfer Equation for Photorealistic Rendering

I've recently become interested in photorealistic rendering, and I've been looking at the different rendering philosophies. I read this Disney Research bachelor's thesis, which states both the ...
0
votes
0answers
37 views

Performance drop caused by vertex shader

I'm rendering the Sponza scene and performance drops based on how many objects are located in camera frustum. Worst case scenario takes up to 25ms per frame, but when looking close at a flat wall ...
0
votes
1answer
24 views

Dynamically allocating morph targets in shaders

So with the idea that I want to load in an object with morph targets and for simplicity sake I know it will have between 1-8 position morph targets. Ultimately I want to do ...
3
votes
4answers
122 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 ...
1
vote
1answer
36 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 ...
2
votes
2answers
84 views

Shader cannot move texture x, y location

Crossposted https://forum.openframeworks.cc/t/shader-cannot-move-texture-x-y-location/29395 Hello I am trying to move the x y location of the texture using this code but it doest not work. ...
1
vote
1answer
65 views

Where can I find those visual effect demonstration?

I'm studying Unreal Engine, this chapter is talk about visual effects: Rendering Overview Some of them has obvious picture I can see whats the differences. But not all of them. Is there a site can ...
2
votes
0answers
77 views

Not understanding the lighting equation for volumetric cloud rendering

I've been looking The Real-time Volumetric Cloudscapes of Horizon-Zero Dawn, but I'm very confused by a few terms. The presentation mentions "The Henyey-Greenstein phase function" on page 54, ...
2
votes
2answers
132 views

Shader Prototyping Frameworks

I wonder if there exists any shader prototyping framework where I can debug (on cpu) my shaders, experiment with them and instantly see results and even write unit tests. The framework does not have ...
-1
votes
1answer
41 views

How to merge two vec4s and display side by side?

I don't know how to do this. I need help. My code looks like the following: ...
5
votes
1answer
69 views

What actually happens in frame buffer when an image or document is scrolled?

What actually happens inside computer when the text, pdf, jpeg, ms-word or any other document(file) is scrolled? Does it generate a new bitmap image sufficient for the screen to display even for tiny ...
4
votes
1answer
94 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 ...
2
votes
1answer
82 views

Dealing with GL reflection

I'm planning the port of our DX based renderer to OpenGL. The target will be Desktop OpenGL 4.x. For DX we use shader reflection but as far as I know OpenGL just has glGetProgramInterfaceiv , ...
3
votes
1answer
84 views

Parallax/relief mapping with gl_FragDepth and conservative depth

New to writing shaders, please forgive any naivety in the question! Parallax mapping in any of its ray-marchy variants (e.g. steep parallax, cone step mapping, POM) generates fake geometry on a ...
6
votes
1answer
74 views

Jagged texture's edge on perfectly straight UV of sphere mesh

I unwrap UV from sphere mesh to grid and put texture to align with UV grid too. When white and black border of texture fall between UV columns, I get jagged edge like in the picture. This only happens ...
1
vote
1answer
83 views

Writing OpenCL Shaders

I want to write (fragment) shaders in OpenCL rather than GLSL. Is there a standard mechanism for this (from OpenGL, and ideally also from DirectX)? Are there any drawbacks to doing this? I also want ...
2
votes
2answers
85 views

What blend mode is this?

I asked this on Graphic Design but was unable to get any relevant help from them. I'm trying to reverse engineer a blending mode I've seen on a picture: This image was created by someone else ...
1
vote
0answers
29 views

How to voxelize geometry using textures and shaders?

I am trying to fetch a given geotery and through (potentially multiple) render passes create a 3D texture that stores the color value of said geometry into an associated texel. In other words there ...
2
votes
0answers
38 views

How to pass *struct*ured data from libGDX to openGL shader?

I know about the standard methods to pass floats, ints, or vectors. However, I'm curious whether there is an elegant way to pass data from libGDX Java code directly into a shader struct. I'm looking ...
1
vote
0answers
68 views

Ray Tracer Shadowing

So I'm working on an assignment where we have to design a simple ray tracer. The program has two objects that it can use, sphere and cube. It can render the cube and spheres, it also does shading on ...
1
vote
1answer
109 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. ...
1
vote
1answer
70 views

Changing sin frequency smoothly in shader

In my vertex shader I am using a sin function to offset vertices. But as I change the frequency of my sin function I notice some ...
4
votes
2answers
116 views

Relationship between roughness and BRDF

In a BRDF $f_r$, assume Cook-Torrance model, we have a microfacets distribution $D$. This distribution essentially models the rougheness of the material as far as I've understood. Given a direction $v$...
5
votes
1answer
977 views

Double precision in shader

for better accuracy, instead of GLfloat, I bound double data and tried to use the data in shader as follow: (I just tested to draw single triangle.) cpp. ...
2
votes
2answers
133 views

How to generate chaotic halftone pattern?

I'm trying to generate a random halftone like below image: this is a simple halftone that I tried, but I need a random halftone ...
1
vote
0answers
169 views

Depth aware blur - Kawase

I am using this Kawase Blur, to apply blur onto my buffer. But I would like to apply this blur in an uniform way, no matter the distance of the objects from the camera. I guess that I need to use the ...
3
votes
2answers
394 views

How to use the data manipulated in OpenGL Compute Shader

I'm working with OpenGL and facing some difficulties because I'm not familiar with OpenGL. I tried to search related example in Google, but I could not find some useful code. There are five arrays. ...
1
vote
1answer
74 views

Process of compute shader in OpenGL

I'am curious about compute shader in OpenGL. Let's assume the number of points (vec4) is 900 and the work group size(= the number of work items) is 256 Then, We would have four work groups because ...
1
vote
1answer
90 views

Questions about Blur effect

I am working on a specific blur effect that implies several behaviours. But before I would like to know what you think about those blurring algorithms according to performances and quality : Kawase ...
1
vote
3answers
102 views

Same specular lighting on both tris in a quad (for “low-poly” “flat shading” look)?

Here's an example of the flat shaded squares I want. But my squares are made of two triangles, and I'm getting flat shading of those triangles. In openGLES 3.1 (android), I'm turning off ...
1
vote
1answer
71 views

What's the difference between two code in shader?

I'm doing a project with assimp. I got confused with the weird situation for me. I think the both code are exactly same, but the result is different. Why the codes act differently? (vertex shader) ...
1
vote
1answer
186 views

Shader storage buffer indexing by 4 bytes instead of 3?

I am trying to send rendering information for an instancing rendering using shader buffer objects. My current problem is that I have 2 shader buffer objects, one which works just fine, and another ...
5
votes
1answer
46 views

Role of gl.vertexAttrib

I'm re-learning WebGL, and I stumbled upon gl.vertexAttribPointer and gl.vertexAttrib. To my knowledge, gl.vertexAttribPointer tells the GPU how the data in the currently binded buffer relates to the ...
2
votes
1answer
2k views

GLSL. Can someone explain why gl_FragCoord.xy / screenSize is performed and for what reason?

I'm new to shaders and now that you can color pixel with gl_FragColor but sometimes there is this thing ...
4
votes
1answer
95 views

Creating a vanishing point perspective shader

I have done my due hour of research before asking this question, it's a simple question, but I have found no hint at an answer online. I want the ability to extend an object infinitely in one ...
5
votes
0answers
115 views

In Metal, what performance advantages are there, if any, to using vertex descriptors and the [[stage_in]] qualifier?

Metal seems to provide two very different ways to access vertex data in your vertex shader. You can: Create an MTLVertexDescriptor object, which describes vertex ...
1
vote
0answers
56 views

Round Box SDF scaling issue

I am using the Inigo Quilez SDF function to generate a round box shape. The aim is to be able to control the shape scale, smoothness and roundness. I've achieved a pretty good result but I am facing ...
2
votes
1answer
71 views

DX9 Shadow map PCF issue

I am trying to do simple PCF with Unity but I am facing some issues and I don't know where they come from. If anybody has an idea... Here are two examples ...
7
votes
1answer
393 views

Constant screen-space-width rim shading

As of lately I've been studying a bit of shaders (in Unity), and am trying to recreate the "light-based inline" that can be observed in the latest Legend of Zelda. But maybe the task is a bit above my ...
5
votes
1answer
128 views

What is better to use for real-time computing Mesh - Plane intersection points, GPU or CPU?

I want to write plugin (library) for Unity3d (it doesn't matter which framework I will choose for this, question is ), for cutting arbitrary mesh with plane (for simplicity it will be plane for ...
6
votes
0answers
132 views

Dual paraboloid shadow texture edge seams

I implemented dual paraboloid shadows for point lights. The goal was to reduce the number of shadow passes. Also the target is GLES3.0 so no layered rendering is available. The shadows work, and ...
8
votes
1answer
409 views

How can I offset/shrink a triangular polygon in GLSL?

I need to offset all (blue) triangles, each independently of the others, using the vertex-shader. In order to manipulate the triangle as a whole, I've created custom (vec3) attributes for each vertex (...
4
votes
1answer
493 views

Phong shading in OpenGL: line of light from the center of the world

I implemented a Phong shader in GLSL, but there is a bug. What you are (supposed) to see down below: A point light source rotating around the center of the world, with a radiance of (0, 100, 0) A ...