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

Questions tagged [shader]

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.

1
vote
1answer
35 views

What is shader warming, and why does Direct3D seem to avoid it?

I am involved in a project that had been modified to run on Apple and Linux computers, when it was originally Windows only. Specifically, Metal and Vulkan renderers have been written alongside the ...
1
vote
1answer
54 views

Can i compile my shaders to SPIR-V without using glslangValidator?

I'm making a cross-platform application, and i need my shaders to be compiled to SPIR-V for both Opengl and Vulkan. It seems that the only way to do so is to call a separate program, called "...
0
votes
0answers
29 views

Problem with simple realtime SSS shader - Combining light depth map distance with traditional lighting models

The article Chapter 16. Real-Time Approximations to Subsurface Scattering explains on point 16.3 how you can simulate the absorption of translucent materials from a depth map created from a point ...
1
vote
0answers
41 views

Evenly distributed point cloud for a grass renderer on a sphere

I'm trying to add some details like grass, rocks, trees, etc. to my little procedurally-generated planet. The meshes for the terrain are created from a spherified cube which is split in chunks (...
2
votes
1answer
89 views

Why are depth buffer values clamped to (0, 1)?

This is a simple question. I know that in OpenGL or other graphics API, the values stored in the depth buffer are automatically clamped to (0,1). I just want to know why people do this instead of ...
6
votes
2answers
2k views

Why normal map is blue and purple in color?

I am learning about normal mapping I understood that RGB values converted into XYZ,but my question is how it is converted, and why the normal map is blue and purple in color ?
1
vote
1answer
27 views

Difference between using + and * operator after tex2D to add albedo color?

I have a two different codes with a little difference Case 1. I used a + operator before _myColor. ...
1
vote
0answers
34 views

Simulating vanishing points shader

How do I create a vertex shader that allows to choose 3 non aligned direction vectors and then allows to morph all vectors positions such that every vertex is remapped so that two vertices that are ...
6
votes
1answer
482 views

Why are tessellation shaders disliked?

I often hear that tessellation shaders aren't great for performance reasons. Something along the lines that if you try to use a tessellation shader, you'll find that the data you get out isn't ...
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
152 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
68 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
82 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
44 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
48 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
95 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
44 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
27 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
134 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
39 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
85 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
66 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
89 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
145 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
74 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
119 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
92 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
113 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
84 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
102 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
86 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
30 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
69 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
151 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
80 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
133 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
1k 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
145 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
185 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
471 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
80 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
94 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
111 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
74 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
230 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
47 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
3k 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 ...