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.

28 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
185 views

Avoiding Mach band effect when using multiple lights

I wrote a simple Phong shader with two directional lights for a project, and noticed an unpleasant artifact in the lighting. Where both lights are illuminating the same region, dark bands appear at ...
6
votes
0answers
172 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 ...
5
votes
0answers
255 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 ...
5
votes
0answers
551 views

Percentage-closer Soft Shadows implementation

I am trying to implement the Percentage-closer Soft Shadows (PCSS) from NVidia inside Unity but I am facing some issue and I don't know where they come from and then, I do not know how to solve them......
4
votes
0answers
169 views

selectively setting stencil value based on vertex property in vertex shader

Just like the question says. Is it possible to selectively set the value of the stencil buffer based on a property of a vertex, like the value of its normal, during its vertex processing phase? ...
4
votes
0answers
121 views

Strange behaviour of glDisableVertexAttribArray() on devices

In my graphics engine, based on OpenGL ES 2.0 I am using standardized name for shader attributes like it is done in libGDX (such as a_position, a_normal, etc.). When 'activating' my vertex buffer for ...
4
votes
0answers
272 views

How to make double working in OpenGL 4.1 on OS X ( Intel HD Graphics 5000 )?

I've recently rebuild shaders for my program and it stopped "working" ( black screen ) on OS X ( El Capitan ), but it's ok on Linux on GTX 660. I've tested it on another Apple hardware and it worked ...
4
votes
0answers
205 views

Indexing gl_TessLevelOuter[] with gl_InvocationID on a tessellation control shader

I'm using hardware tessellation to render a terrain mesh with variable LOD. I have this snippet on my tessellation control shader: ...
3
votes
0answers
214 views

How to output a 32 floating value in a render buffer with fragment shader

I would like to downsample my depth buffer and my normals. For that, I take in input of my shader, the corresponding textures (depth, normal), and I write my new values in a multi render target. I ...
3
votes
0answers
183 views

Linear gradient shader ( Photoshop-like)

I'm searching a way to implement a linear gradient shader that behaves as the linear gradient in Photoshop (only the vertical case is necessary). It will be applied to 2D sprites. Currently I'm ...
2
votes
0answers
43 views

Screen space reflections become warped when looking up or down

I have been experiencing issues over the past few days with implementing SSR on water into my engine. Looking straight forward, it appears to be alright. However, when I look up or down, the ...
2
votes
1answer
85 views

2D Line of Sight + Visibility Calculations

I am currently working on an algorithm to calculate visibility in a 2D top-down level. The level contains actors, with position and "sight" information walls, ...
2
votes
1answer
216 views

How to match Blenders polynomial lens distortion model with GLSL?

I'm trying to re-implement Blenders (libmv) polynomial lens distortion model using shadertoy, in order to apply the lens distortion in another application ideally by generating a STMap for that. I ...
2
votes
0answers
140 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
1answer
132 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
49 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 ...
2
votes
0answers
131 views

Shadow Mapping Errors

I recently started to create a shadow mapping system in OpenTK. I ran into a problem: The depthtexture is always completly white -> no depth. Even if the color from the shader is changed (I know it ...
1
vote
1answer
140 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 ...
1
vote
0answers
54 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 (...
1
vote
0answers
41 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 ...
1
vote
0answers
382 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 ...
1
vote
0answers
73 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?
1
vote
0answers
77 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
0answers
288 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 ...
1
vote
0answers
81 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 ...
1
vote
0answers
57 views

Specular Highlight Gray When Behind Model

What would cause this grayscaled backside? When my camera is behind my model I see a grayscale specular highlight. However, in front of it is perfectly fine. Here's my shading code. (Software ...
1
vote
0answers
50 views

Rounding rules for mip level with point sampling

In shaders, when using SampleLevel intrinsic, if we pass 0.5 in the mip level parameter, and the sampler is a ...
0
votes
0answers
122 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 ...