Questions tagged [shader]

A shader is a program to perform calculations on geometry or pixel data in computer graphics.

A shader is a program to perform calculations on geometry or pixel data in computer graphics. With the rapid progress and availability of consumer GPUs during the last decade, an initially software-only solution for high-end RenderMan workstations became widely available. Today, the term is mostly associated with , , , or , which allow convenient, hardware agnostic high-level programmability on consumer GPUs.

6931 questions
2
votes
1 answer

Push particles away from mouseposition in glsl and three js

I have the following setup for my THREE.Points Object: this.particleGeometry = new THREE.BufferGeometry() this.particleMaterial = new THREE.ShaderMaterial( { vertexShader: vshader, …
marks
  • 1,501
  • 9
  • 24
2
votes
1 answer

Texture coordinates for dynamic terrain - OpenGL

Can someone please describe a common technique used to calculate texture coordinates for a terrain that dynamically changes every frame? I have a perlin noise function implemented in a vertex shader and the terrain is animated frame by frame. The…
Nitrex88
  • 2,158
  • 2
  • 21
  • 23
2
votes
1 answer

fix artifacts in screen space reflections

I am trying to implement SSR (screen space reflections). I managed to get a basic effect, but there are some artifacts as you can see from the images and the video below. First of all I would like to solve these visual problems and then I would like…
Arctic Pi
  • 669
  • 5
  • 19
2
votes
1 answer

HLSL geometry shader texture look up

I'm trying to implement marching cube algorythm in my geometry shader. So i place my datagrid into a Texture3D. Now i want to look up the data in the geometry shader and this trows an error "cannot map expression to gs_4_0 instruction set" This is…
Sneezy
  • 21
  • 3
2
votes
1 answer

How to update shadows in modified MeshPhysicalMaterial shader

I am having trouble getting my model with a custom shader to cast correct shadows. I have made a slightly modified vertex shader chunk for the THREE.MeshPhysicalMaterial that allows me to tweak the behavior of the morph targets. Specifically, I am…
Mr Bell
  • 9,228
  • 18
  • 84
  • 134
2
votes
1 answer

GLSL Fit Fragment Shader Mask Into Vertex Coordinates

I have this smiley face mask in my fragment shader that takes up the entire window (1). I passed in smaller coordinates to the vertex shader in an attempt to shrink the smiley face into a smaller box (2) (desired result). However, the result is…
Ian
  • 98
  • 6
2
votes
1 answer

How do I solve the Visual studio 2019 'invalid profile ms_6_5' error when building a solution?

Specs are Window 10 Pro, VS 2019.16.8.3, MS DX12 shader samples. I installed VS2019 just for this project to migrate my shader efforts into. 1>D3D12MeshletGenerator.cpp 3>dxc failed : Unknown argument: '-Qembed_debug' 2>FXC : error : invalid profile…
2
votes
2 answers

Fragment shaders on ATI cards versus NVIDIA ones

I use this fragent shader (inspired from some tutorial found on the NVIDIA site some time ago). It basically compute bi-linear interpolation of a 2D texture. uniform sampler2D myTexture; uniform vec2 textureDimension; #define texel_size_x 1.0 /…
Thomas Vincent
  • 2,214
  • 4
  • 17
  • 25
2
votes
1 answer

OpenGL 2DTexture from c++ unsigned byte array

I'm trying to process a 2D array in a fragment shader - so to learn that, I started building my array: int const _s = 512; std::array hitmap; for(unsigned j = 0; j < _s; j++) { for(unsigned i = 0; i < _s; i+=4) { hitmap[i+j*_s]…
2
votes
1 answer

opengl : loading array types to uniform buffer objects

Here is my uniform block in the fragment shader layout (std140) uniform Material { float array[2]; }; Here is the Uniform Block Object . I am using LWJGL 2.9.3 private UBO(int programID,String blockName) { …
Sync it
  • 1,180
  • 2
  • 11
  • 29
2
votes
1 answer

GLSL translation in fragment shader not working as expected

I wrote a simple GLSL shader that creates a pattern similar to the colored squares pattern shown on this page. Then I added code to move the pattern across the screen by following this example. This is my code: st = vec3(TexCoord.x , TexCoord.y ,…
Koos
  • 91
  • 9
2
votes
0 answers

CIImage crop and render to CVPixelBuffer

I have the following code to crop CIImage and render to CVPixelBuffer which unfortunately isn't working. Some portion of the image on the left side is black or green. What am I doing wrong I wonder? _ciContext = CIContext(mtlDevice: metalDevice,…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
2
votes
1 answer

Calculating 2D Gaussian filter in Fragment Shader

I would like to calculated the 2D Gaussian function and the input is X,Y texture UV coordinate and get the corresponding gaussian value. I'm facing difficulties on how to get the corresponding Texel's uv gaussian value. float Gaussian2D(float x,…
andre_lamothe
  • 2,171
  • 2
  • 41
  • 74
2
votes
1 answer

Metal Shader mix fragment receiving wrong color value

I have 2 passes in Metal: 1 - node_pass 2 - mix_pass debugged it with xCode: fragment half4 node_fragment (NodeColorInOut vert [[stage_in]]) { float4 color = float4((vert.center.x + 1.0) * 0.5 , (vert.center.y + 1.0) * -0.5, 0.0, 0.0); …
Alan Cruz
  • 83
  • 1
  • 11
2
votes
3 answers

Avoiding String properties in Unity Shaders

When creating a Shader in Unity, you can add a Property to it that can be called from inside of a different script. To do this, one could use the following line to call on and set a Vector3 Property names _vector3: materialName.SetVector("_vector3",…
Jee
  • 969
  • 1
  • 7
  • 26
1 2 3
99
100