Questions tagged [shader]
A shader is a program to perform calculations on geometry or pixel data in computer graphics.
6,570
questions
0
votes
0
answers
100
views
rust-gpu how to use as a dependency?
I am trying to integrate rust-gpu into a project. The docs explain how to use it as a build dependency but the examples use it as a straight dependency, I have struggled with both but I would prefer ...
0
votes
0
answers
23
views
Why is my main preview of the shader graphs pink?
I recently learn the basics of shader graphs and am trying to explore some of the shader graphs.
But I encountered a problem, my main preview of the shader is pink:
FYI: I used URP Lit
And it does ...
0
votes
0
answers
17
views
3d object overlaping area transparent shader
I have two 3D objects, I want to move these objects while the game is running and I want to know how to write the shader that makes the overlapping region transparent.
I want this
0
votes
1
answer
30
views
Re-defining Shader variables draws them all?
I'm fairly new to shaders and came across the Book of Shaders website. Early on, this piece of code appears and surprisingly he didn't teach about how variables work yet so I can't get my head around ...
0
votes
0
answers
8
views
How to read/write data in HLSL (DirectX11) code?
I'm writing a Unity HLSL shader and I want to buffer the previous pixel to use it in the next iteration. I need this to implement TAA anti-aliasing.
I have a simple Raymarching shader. I create a ...
-1
votes
0
answers
20
views
Shader Effect looks like the picture
Any shader looks like this picture?
1
vote
1
answer
29
views
OpenGL vertex shader behaviour
I'm learning OpenGL. And I just learned about matching an output variable in a vertex shader to an input variable in a fragment shader by giving them the same name.
So I wrote this vertex shader:
#...
0
votes
0
answers
30
views
Can I modify this code to use only three.js without using shaders?
https://codepen.io/Mamboleoo/pen/zYEmGNw
This is the code in which shader and three.js are used together.
Can I write this using only three.js?
Are shaders absolutely necessary?
Can I modify this code ...
0
votes
0
answers
19
views
Redefinition Error In Unity Shader file. What needs to be done? Appropriate syntax please
So I'm trying to add a gameObject that accesses Shaders; I'm using Unity 2021.1
The shaders are all custom method and whenever I try to compile the scene; An error pops saying:
Shader error in '...
0
votes
0
answers
15
views
how can I draw line with fragment shader in threejs?
how can I draw line dash with webgl
0
votes
2
answers
60
views
Problem retrieving shaders stored inside std::map
So I've been learning OpenGL for sometimes now and today I come up with an idea to put multiple
shaders in one std::map, like this
std::map<std::string, Shader> Shaders;
the key holds the ...
0
votes
1
answer
38
views
How to implement radial gradient effect via Rust nannou
I implemented a "shadow-casting" algorithm which looks like this (the video below):
What I want to achive is to create radial gradient effect in the visible area (or rather say area not ...
0
votes
0
answers
22
views
ThreeJS: Use a ShaderMaterial as an alphaMap inside a MeshPhongMaterial
Let's say we have a black and white Shader on a sphere.
Is it possible to use it as an alphaMap on a MeshPhongMaterial for another sphere?
Can we use a ShaderMaterial as an alphaMap of a ...
0
votes
0
answers
49
views
Why Vertex and Fragment Shaders not compiling?
I'm working on Shaders with R3F. However, something was wrong with this project and I couldn't find it after hours of trying. I'm writing the codes of the GLSL files that I got an error with below.
I ...
0
votes
0
answers
18
views
How can I "dye" an image?
I'm trying to make a fragment shader that takes in a texture from a spritesheet and a color. I want the texture to be different shades of the color given. e.g. when I use yellow I want the image to be ...
0
votes
0
answers
34
views
Repeating radial gradient animation using Shader
I want to create an animation like this, in android, java.
I have achieve linear gradient animation and sweep gradient animation. but this is not working at all with scaling the matrix. any suggestion ...
1
vote
1
answer
26
views
How to link Uniform Buffer Object with Shader
I am creating a UBO.
glGenBuffers(1, &uboMatrices);
glBindBuffer(GL_UNIFORM_BUFFER, uboMatrices);
glBufferData(GL_UNIFORM_BUFFER, 2 * sizeof(glm::mat4), NULL, GL_STATIC_DRAW);
glBindBuffer(...
0
votes
1
answer
75
views
Using Hull shader and Domain shader breaks 2D shader
I'm following Rasterteks DirectX11 tutorial at https://www.rastertek.com/tutdx11.html and have been combining them to create and learn.
I just implemented tessellation for my 3D models and noticed ...
0
votes
0
answers
15
views
geometry unwrap shader unity shader
How do we unwrap a model in the shape of the uv using vertex displacement shader using shader graph? i.e. I have seen people making models animate into making them look like their UV map.
0
votes
0
answers
27
views
Jelly Shader using Unity Shader Graph
Hello I have started shader graph shortyl before. What I am trying to do make Jelly shader which interact other defines bodies and get wobblying and waving on the surface after interaction. I have ...
0
votes
1
answer
29
views
Vulkan Payload doesn't update some struct member (RayRracing)
I have a problem with updating some value in a Payload. I generate the payload inside the rgen shader like
struct HitPayload
{
vec3 hitValue;
uint32_t depth;
vec3 worldPos;
uint32_t ...
0
votes
1
answer
37
views
make webgl canvas transparent
I want to make my webgl canvas transparent but the thing is that I pick the code on codepen: here and saw the same on a forum and they were also debating on how to change the color, but there wasn't ...
1
vote
2
answers
37
views
Why component "Sample Texture 2D" in Unity Shaders distorts my sprite?
I have this texture and when I add it to the "Sample texture 2d" component, it is drawn where there is simply no sprite (transparent background). It looks like this. With the help of a ...
0
votes
1
answer
70
views
diffrence between std140 and std430 layout
I have trouble with differences between layout std140 and std430.
this is my code of struct in .Cpp
struct Particle {
glm::vec3 position = glm::vec3(0);
float density = 1;
};
for (int z = 0; ...
0
votes
1
answer
43
views
Shader Successfully Linked But Doesn't Show on Screen
I have implemented a system that, theoretically, iterates through a list of living entities and draw the shader associated with each entity (provided it has one). However, no matter what I've tried, ...
2
votes
1
answer
41
views
Texture doesn't get updated after applying a compute shader
I'm trying to apply a compute shader to a texture to update its values. I know it's not a very good question to just state something doesn't work, but I did spend a lot of hours trying to get this ...
2
votes
2
answers
60
views
OpenGL Shader Compilation and Linking Error
I have a method that creates and returns a shader program from two given strings (vertex and fragment shader filenames). Initially, it was working perfectly, with the compilation and linking being ...
2
votes
0
answers
48
views
Fade texture inner borders to transparent in LibGDX using openGL shaders (glsl)
I'm currently working on a tile game in LibGDX and I'm trying to get a "fog of war" effect by obscuring unexplored tiles. The result I get from this is a dynamically generated black texture ...
-1
votes
0
answers
26
views
Why does the GPU execution time increase after shielding a large number of operations with the if instruction? [duplicate]
Why the draw call cost increase from 1ms to 1.3ms after I add if instruction?
if(not_white_area)
{
half4 color = tex2D(...);
some other instructions...
half result = 1 - smoothstep(...);
}
...
0
votes
0
answers
43
views
Why does a vertex shader (Vulkan) work on linux, but not on Windows? [duplicate]
I am trying to cross compile a Vulkan project from windows to linux, this works, only the vertex shader causes a problem on windows though it works perfectly fine on Linux... (Note that the code and ...
0
votes
1
answer
19
views
What is the difference between 0. vs 0.0 in shaders?
When reading example code for a raymarching shader, I noticed that the author uses 0.. Later in the code, they also use 0.0. Are these the same thing, or is there a convention that I'm missing?
0
votes
0
answers
38
views
Unity 3D Pixelate individual 3D objects but retain resolution over distance
I've been doing research around how to create a pixilated effect in Unity for 3D objects. I came across the following tutorials that were useful to me:
https://www.youtube.com/watch?v=dpNhymnBDQw
...
0
votes
1
answer
63
views
How to render a smooth ellipse?
I'm trying to render an ellipse where I can decide how hard the edge is.
(It should also be tileable, i.e. I must be able to split the rendering into multiple textures with a given offset)
I came up ...
1
vote
1
answer
22
views
WebGLRenderingContext.createShader returning null
I have a webgl canvas on a page that's loaded into an iframe. On occasion, when navigating the iframe away then back to the webgl content, the call to WebGLRenderingContext.createShader() returns a ...
3
votes
1
answer
59
views
OpenGL data transfer to graphics card
Why do you need buffers in OpenGL, when you can just transfer all the data to the graphics card via uniform. As an example:
#version 330
layout (location = 0) in vec2 pos;
void main()
{
...
0
votes
1
answer
34
views
Declare struct outside layout block to allow reuse in multiple shaders
I'm using GLSL for shaders in my Vulkan application.
I'm refactoring some shader code to declare a struct in a common GLSL file. The struct is used in multiple uniforms across different shaders.
...
2
votes
1
answer
37
views
glsl VertexShader/FragmentShader refuse to compile in OpenTk c#
I have followed this tutorial to try and learn OpenTK (https://www.youtube.com/watch?v=elEyLoQQ67o&t=1182s) My code is pretty much identical to his but when the program is run, both the fragment-...
0
votes
1
answer
40
views
Python Kivy error: Unable to get a Window, abort
I'm tired trying to fix this error, can someone help me?
I fixed the kivy fatal error first with adding a variable in the variables environment in the user variable(the variable's name is: ...
0
votes
0
answers
39
views
How to write a 2D Tentacle Shader
I am trying to create a shader for a tentacle.
Below is how I'm constructing the tentacle:
Figure 1 shows the construction of the tentacle triangle of height h, with base width b and segment height ...
0
votes
0
answers
38
views
How to display interactive 3D heatmap in browsers?
I have a stl model which consists of a cube that was heated. I wrote a software which calculates the temperature distribution at every point/voxel in the cube, so it is essentially like a heat map ...
0
votes
1
answer
29
views
Mouse offset in threejs + fragment shader
Following up from this question, I'm trying to get my mouse cursor to update a Voronoi shader from the Book of Shaders.
However, I think I might be misunderstanding something with the offsets. As it ...
1
vote
1
answer
36
views
Mouse movement doesn't appear to be updating fragment shader
I'm trying to implement the Voronoi shader in the Book of Shaders in three.js and cannot seem to wrap my head around why the mouse position is not having any effect on my visible output. (This is for ...
0
votes
1
answer
32
views
Shader Tutorial Doesn't Render Normals
I am trying to learn about shaders by trying to do this tutorial. I finished the first part where I was able to draw the outlines using depth. But even though I copied everything accordingly during ...
0
votes
1
answer
39
views
Why is Shader Graph Transform node affected by UV mapping?
I've had an issue with normal maps not behaving correctly in my custom shader and finally managed to find the cause. It turns out it was the way UV of my objects were mapped. In UV0 I stored a mapping ...
0
votes
1
answer
58
views
Blobs shader GLSL
I want to create a similar background with a shader to these images:
:
These are just blurred blobs with colors, distributed across the whole page:
Here's my current progress: https://codesandbox.io/...
0
votes
0
answers
20
views
How control the limit range of water waves o shockwaves
Is there any node in Shade Graph that I can use to control the distance at which a wave dies. Just don't wait for it to break when it collides with another object (like a beach), but after x seconds ...
3
votes
0
answers
78
views
2D space organic projection
I'm currently working on a glsl shader (EDIT : I'm starting to think that a shader isn't necessarily the best solution and as I'm doing this in processing, I can consider a vectorial solution too) ...
1
vote
1
answer
50
views
In unity custom shader materials appear pink
I'm using Unity 2020.3.20f1.
I created a 3D object (sphere) and applied a material which has a custom shader.
Now the whole sphere appears pink.
I'm using URP, but I added it to an existing project. ...
0
votes
1
answer
45
views
Shader doesn't have a texture property '_MainTex'
The wacky thing is I ran my code once and it worked like a charm. The line of code I'm getting the error on is:
exampleTexture = (Texture2D)rend.material.mainTexture;
I know that the custom shader I'...
0
votes
1
answer
24
views
Change Material Range in only one object
I've created a dissolve Shader and wrote a script to run it.
The point is that it changes the materials of all the objects. How could I make the Materials values change only for one object?
Here is ...