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.

Shaders are programs which are written to customise a programmable GPU pipeline.

The most common shader languages are GLSL and HLSL.

267 questions
9
votes
1 answer

There are many shading languages built on top of GLSL or HLSL - what problems do they typically solve, and what worthwhile advancements do they make?

Whew, that was a long title. Either way, I'm asking this question, since I like to think about various things, and it occurred to me that there isn't really any simple, open source layers on top of GLSL, even if only to add simple things such as…
Llamageddon
  • 931
  • 2
  • 7
  • 13
7
votes
1 answer

How does this small fractal shader work?

I would like to know the magic behind this tiny fractal shader; I didn't really understand the code and the mentioned thread... Is there an accessible explaination? https://www.shadertoy.com/view/4ttBWM
arthur.sw
  • 377
  • 2
  • 14
4
votes
1 answer

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, with start & end positions light sources, with position and range I have written a…
Jonathan
  • 141
  • 1
4
votes
1 answer

What are the fConstX in Spherical Harmonics?

At page (slide in reality) 12/20 of this tutorial it is shown a function used to project lights into SH coefficients, however the value of those coefficients is not given, what are their values and what they are for? Do I have to clamp colors to max…
4
votes
0 answers

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 passing to the pixel shader these…
enigma
  • 141
  • 1
3
votes
2 answers

Coloring arbitrary closed regions

I'm trying to implement the following paper in modern OpenGL http://web.media.mit.edu/~lieber/Publications/Coloring-Book.pdf The issue is that the algorithm described requires you to consider interior points in an orderly fashion -- horizontally…
root
  • 33
  • 4
3
votes
1 answer

Fastest shader compilation strategy on windows dx9 and dx11?

To compile shaders, I currently spin up a thread per core where each thread pulls a shader from a list and calls D3DX11CompileFromFile for dx11 and D3DXCompileShaderFromFile for dx9. I've heard it mentioned that spinning up multiple processes…
Alan Wolfe
  • 7,801
  • 3
  • 30
  • 76
1
vote
0 answers

How to pack 3 floats into one?

I am doing some animation jobs. I need to pack some pivots into UV and then my shader can read them. I need to pack 4 float3 into a float4. Therefore, I need to pack each float3 into a float. These 4 float3 are (model space position1, direction1,…
TIANLUN ZHU
  • 187
  • 5
1
vote
2 answers

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 to emulate rendering pipeline, compute only will…
ref2401
  • 11
  • 2
0
votes
1 answer

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 renderedPrimitive.POSITION = primitive.POSITION + weights[0] *…
FrickeFresh
  • 213
  • 2
  • 6
0
votes
0 answers

Rotating shader UV around camera position in world space

I have a tiled XZ world comprised of separate meshes. Additionally, I've implemented a water shader that draws patterns based on world space coordinates. Furthermore, I have a camera that can both move and rotate. The issue I'm encountering is that…
-1
votes
1 answer

Where should I learn shaders as a vulkan user?

I have no prior experience with any other graphics low level libraries and I have barely any clue how shaders work, any book related to shadings is bloated with opengl code and is demoralizing.
oren revenge
  • 109
  • 2
-1
votes
1 answer

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: #version 120 uniform sampler2D sampler; varying vec2 tex_coords; void main() { vec2 p = tex_coords; vec4 red = vec4(1.0,0.0,0.0,1.0); vec4 green =…