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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
29 views

Pixilate/Quantize UV coordinates in world space?

The effect I'm trying to achieve is to have it so that the texture is pixilated/quantized, but the "grid," stays aligned to world coordinates even as the object with it's own UV coordinates ...
zachThePerson's user avatar
1 vote
0 answers
32 views

Why does my implementation of a sinusoidally time-varying color work so slowly?

I've been following TheCherno's OpenGL tutorials and I got to the point where I could render a square by using an index buffer. Now I wanted to vary the color of the square by using $$\frac{\sin(t) + ...
Doobius's user avatar
  • 111
0 votes
0 answers
66 views

What kind of code would it take to visualize just 1 3d gaussian in Godot?

I'm trying to create the simplest possible implementation of the gaussian visualization code from this paper in Godot, https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/ but I just don't even ...
Ethan's user avatar
  • 103
0 votes
1 answer
76 views

How do I tell what kind of shader an hlsl shader is by looking at the code?

How do I tell what kind of shader this is: https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Shaders/GaussianSplatting.hlsl Among these options: vs – vertex shader ps – pixel shader ...
Ethan's user avatar
  • 103
0 votes
1 answer
65 views

How to correctly handle rendering of ~600000, arbitrary colored 2D squares with WebGL?

Information I have to render a map, that is rendered as a 2d collection of squares of different color, separated by white lines horizontally and vertically. There may be ~600000 squares surrounded by ...
h4ckthepl4net's user avatar
1 vote
1 answer
56 views

How to avoid declaring sampler outside of statement?

How can I avoid having to declare the sampler outside of the if statement in this shader code sample? ...
junglie85's user avatar
  • 125
1 vote
1 answer
41 views

Need help understanding this simplification/optimization for a very basic GLSL shader

i'm currently following a tutorial on youtube to get started with computer graphics (shaders) and it contains the following GLSL code: ...
Seth's user avatar
  • 13
1 vote
1 answer
61 views

Conditionally sample from texture in shader

I'm building a little 2D graphics library in Rust/WGPU as a means to learn graphics programming. I want to draw an outline around a shape and specify the outline's color. All of my shapes have a ...
junglie85's user avatar
  • 125
1 vote
1 answer
200 views

How to calculate ray-origin and ray-direction in vertex shader working universally for any projection and using interpolators for performance

I have been reading and watching many raymarching tutorials, but almost all of them are only working in the perspective projection. Almost all assume, that to calculate the ray direction, you just ...
Tooster's user avatar
  • 111
0 votes
0 answers
28 views

How to interpolate alpha from CURRENT_ALPHA to TARGET_ALPHA for each pixel in shader language? (Godot/GLSL)

I want to make "trails" of objects on my shader that appear and disappear gradually. I am getting pixels (for fragment shader) where objects are from uniform texture. Basically, I have my ...
idchlife's user avatar
  • 373
1 vote
1 answer
126 views

is there an universal way to set a uniform?

so I'm working on a game engine. It's partially python and c++. One part that is currently a pain point is setting the uniforms for shaders. Currently I have to define a behavior for all 50+ methods ...
LemonJumps's user avatar
0 votes
1 answer
68 views

How to scale down noise frequency?

I'm making a space game and so far what I have is a system to generate spheres with noise on them, making them planets. I make a sphere, create noise data, write that data to an image file, and then ...
Chillzy's user avatar
  • 11
1 vote
1 answer
36 views

Curved world effect shader for heterogeneous mesh faces

I have a voxel based game, similar to Minecraft and want to apply the "curved world effect" like described here. As I was using a per 1x1 face quad renderer, applying the effect went well, ...
Aitch's user avatar
  • 113
0 votes
2 answers
174 views

Relative coordinates -- cumulative sum

I have a vertex shader happily producing all the vertices I want for a 2D plot. Now I want to also render a plot of the same data, but each point relative to the previous one, like SVG Paths using <...
Nick's user avatar
  • 11
1 vote
0 answers
47 views

BlinnPhong sphere edges look worse than Phong. Am I doing it wrong? (code and pictures included)

First of all, I am completely new to this so please excuse me if this is a dumb question. I am following the book Real-Time 3D Rendering with DirectX and HLSL, for now implementing shaders in Nvidia ...
egil87's user avatar
  • 11
0 votes
0 answers
48 views

Given 2d control points, how to write a vertex shader that evaluates a cubic bezier curve?

I need to write a program that evaluates a cubic bezier curve, using threejs and vertex shader. I tried to calculate the bezier curve based on the x axis and the control points using the cubic bezier ...
Jonas's user avatar
  • 111
1 vote
1 answer
191 views

Having trouble rendering entire sphere

I'm working on a program where I need to draw spheres. The method I'm using is creating an octahedron And using tessellation shaders to subdivide it into a sphere, however there is a patch of the ...
Chillzy's user avatar
  • 11
0 votes
1 answer
132 views

Rendering light balls: Where to do perspective calculations?

After rewatching Bisqwit's starfield renderer video, I've decided to try to rewrite the program in order to learn more about compute shaders and shader programming in general. My knowledge at this ...
mindoverflow's user avatar
0 votes
1 answer
299 views

Raytracing in OpenGL or Vulkan?

I was looking at this glass ball rendering with an image inside of it (zoom out to see the glass ball), and noticed that it looks like they simulate the refraction of light as it crosses from inside ...
HelloGoodbye's user avatar
0 votes
0 answers
22 views

models used for verifying standard PBR shaders

I know this collection of models: https://casual-effects.com/data/ I am looking for something similar, but with models with standard PBR materials (roughness + metallic). I want to verify that my ...
Tomas's user avatar
  • 41
1 vote
1 answer
37 views

Query the size of an array of non-basic types using interface query in OpenGL

Consider the following code in an OpenGL shader: ...
facetus's user avatar
  • 113
1 vote
1 answer
134 views

Best way for rendering Voronoi diagram from Delaunay graph mesh

I have a set of points, which I triangulate to a Delaunay graph to make a mesh. Every mesh vertex has a unique colour, and I can render it without any problem. But I want Voronoi rendering to be ...
Francesco Sollazzi's user avatar
1 vote
0 answers
23 views

How can I see the whole shader's text content, with all the prepended code by Three.js, when using ShaderMaterial or RawShaderMaterial (r148)?

I know that Three.js prepends the shader text you provide with some code that includes definitions etc. I am not a big fan of "magic" and I would like to be able to see the final text ...
Michael Kolesidis's user avatar
0 votes
1 answer
68 views

Output to more than one canvas texture in processing with shader OpenGL

as the question suggests im looking to output to more than one canvas element in processing to speed up the calculations and limit shader draw calls. It has to be as simple as possible to be ...
Paul Goux's user avatar
0 votes
1 answer
75 views

Is there a good rule of thumb for the optimal / maximum number of instances to draw in a single call?

So let's say I want to draw a lot of textured quads to the framebuffer. In each shader invocation, I will bind an array of indicies, an array of positions, and an array of textures to index into. ...
sak's user avatar
  • 159
1 vote
0 answers
154 views

What are the main concepts behind building the plasma effect with GSLS?

By the plasma effect I mean an animation that looks like this: I have seen some codes, like these https://www.shadertoy.com/view/Xst3zN https://www.shadertoy.com/view/4tdGWX and messed with the code ...
Jonas's user avatar
  • 31
1 vote
0 answers
35 views

How to make elevated parts of a steep plane seem darker than the lower surface? [GLSL]

I made a plane in THREEjs using Mesh, PlaneGeometry and ShaderMaterial. It's a very simple/basic form. I applied a simple phormula to make the plain more steep. Now I'm trying to make the lower ...
Jonas's user avatar
  • 111
1 vote
0 answers
80 views

What is the best way to display complex number "images"?

I may be getting some details wrong (e.g. colour space vs. colour model), so please bear with me: I want to represent "images" consisting of complex numbers i.e. for each "pixel" ...
Chillpadde's user avatar
1 vote
2 answers
203 views

Has general purpose GPU computing been used before compute shaders were available?

Today we have tools such as Nvidia's CUDA and OpenCL to perform general purpose computing on the GPU (GPGPU). Seeing that traditional shaders are specifically used for generating graphics by filling a ...
Entangled Superposition's user avatar
0 votes
1 answer
78 views

How does swizzling works in ARB shaders?

I am trying to understand some shader code written in ARB. I am mostly using this to understand it. However the doc doesn't explain (or I missed it) how vector operands are transformed into scalars, ...
Aulaulz's user avatar
  • 161
0 votes
0 answers
71 views

Alternate projections in shader

I have a projection calculation which maps points from 3D space to pixel (image) space, and I want to use it as instead of the standard MVP projections in a vertex shader. In the image below the lower ...
Roman's user avatar
  • 3
1 vote
1 answer
158 views

Rendering multiple camera transforms of the same geometry at once

Currently I have a basic (OpenGL 3.3) rendering scheme using a simple depth vertex shader to generate shadow maps for a scene. I don't care about having a large number of lights in the scene so it is ...
lurscher's user avatar
  • 111
0 votes
2 answers
323 views

Model matrix for batch renderer as uniform or vertex attribute?

Where should the model matrix be uploaded to the GPU in a batch renderer? All the tutorials I've ever seen use a uniform for this, but that's not with batch rendering. Since the uniform is only ...
junglie85's user avatar
  • 125
2 votes
0 answers
77 views

GLSL, Fragment Shader: How to separate functions (like noise, transform...) to reuse in different projects

I'm a total newbie to coding and recently got interested into generative art. This is my problem: I have to copy all of the functions I need (and there are a lot) in every single fragment file I'm ...
Noah Greenrock's user avatar
1 vote
1 answer
901 views

On modern GPUs, what hardware do vertex/pixel shaders have access to that compute shaders don't?

Suppose that someone implemented rendering for a video game using entirely GPGPU apis, like compute shaders or CUDA. Would it be possible to achieve the same performance as standard graphics pipelines ...
while1fork's user avatar
0 votes
1 answer
314 views

Unity - custom shadow from sun

due to some features in materials I need to create my own directional shadow map. Everything seems to work ok, until the moment where I compare depths. First I add camera component to directional ...
Derag's user avatar
  • 596
1 vote
1 answer
205 views

SSAO with reconstructed depths yields strip artifacts

I wrote an ssao algorithm with compute shaders and view-position-reconstruction from the depth buffer. It works great for objects near by but results in strip or banding artifacts for large planes ...
Sprinklerkopf's user avatar
0 votes
2 answers
248 views

Ambient occlusion depth buffer normalization

Been trying to follow a shader from A Comparative Study of Screen-Space Ambient Occlusion Methods http://frederikaalund.com/wp-content/uploads/2013/05/A-Comparative-Study-of-Screen-Space-Ambient-...
Boinking's user avatar
2 votes
1 answer
216 views

Painter's algorithm test 2 and test 3?

TEST #2: Surface S is completely behind the overlapping surface relative to the viewing position. S1 is completely behind/inside the overlapping surface S2 How to check these conditions? i) Set the ...
S. M.'s user avatar
  • 211
2 votes
1 answer
360 views

Having trouble implementing distance transform with jump flood

I'm attempting to use the jump flood algorithm to compute distance transforms of an arbitrary texture derived from a canvas2d context, roughly following the explanations detailed here/here. In the ...
Nico's user avatar
  • 23
0 votes
0 answers
109 views

How to interpolate between two MVP setups?

I am currently writing an AR experience. I have a Camera View Matrix, A Camera Perspective matrix and the Model Matrix of the content I display. The AR content should can be switched to "2D",...
user avatar
1 vote
0 answers
38 views

How khronos flame swing effect is done?

This demo: https://www.khronos.org/registry/webgl/sdk/demos/google/particles/ Contains multiple effects that can be done with WebGL. I've been able to recreate some of them, but for example I don't ...
hhaamm's user avatar
  • 111
0 votes
1 answer
465 views

Dynamic Loop Based on Uniform

My question is fairly simple but I guess it contains two questions, one is how to arrive at an answer (imagine a similar one and you want to deduce it using existing tools like a GLSL compiler or the ...
Felipe Gutierrez's user avatar
1 vote
1 answer
96 views

Stripping unnecessary data from C++ data structures before sending to GPU

I've recently been working on a particle system in my renderer and I've encountered a situation where my particle class on the C++ side has data I need to maintain my particle on that end, but that I ...
JHall's user avatar
  • 57
1 vote
1 answer
257 views

Mesh-Shader and layered rendering

In the usual pipeline (vertex, tessellation, geometry and fragment shaders) the geometry can be deformed and in the geometry shader it is possible to copy the generated and deformed geometry in order ...
Thomas's user avatar
  • 1,136
0 votes
2 answers
321 views

How to avoid curvature artifact in raytracer?

I have a pretty simple raytracer that is rendering some SDFs, but when my camera is close to the object I see curves: I am not entirely sure where they are coming from, as I am using nothing but ...
Makogan's user avatar
  • 1,696
1 vote
1 answer
57 views

Is fragment shader run on fragments that are outside of rasterized geometry?

In deferred rendering, I first write world position to G-Buffer, and then in shading part, I want to use that information to reproject in the previous frame and then write the final color. However, ...
Toothery's user avatar
0 votes
0 answers
46 views

Offsetting value in shader causes unexpected/wrong logic

Let me explain what I am doing. I am trying to reduce the memory footprint of a voxel based algorithm by storing the voxel data as a hash map in an SSBO, as opposed to a 3D image. I am visualizing the ...
Makogan's user avatar
  • 1,696
1 vote
0 answers
81 views

Passing variable through cbuffer vs. shader input in HLSL

Let's say I want to pass some kind of value to a pixel shader in HLSL. I can either make a cbuffer and pass the value directly to the pixel shader, or I can make a cbuffer in the vertex shader and ...
H3XXX's user avatar
  • 115
0 votes
1 answer
877 views

gl_ClipDistance vs gl_CullDistance

Why are there very similar yet distinct arrays: gl_ClipDistance[] vs gl_CullDistance[]? What would be some use cases where the ...
Vectorizer's user avatar

1
2 3 4 5 6