Questions tagged [godot-shader-language]
34 questions
3
votes
1 answer
Godot - Simple spartial shader results too bright (unshaded, custom)
:)
TL:DR
When writing a custom spatial shader the ALBEDO color isn't the output color, even if render_mode unshaded is set.
Long story
I created a new project in Godot v3.4.4.stable.official [419e713a2] and simply added two CSGBox.
For the left one…

Benjamin Schulte
- 863
- 1
- 6
- 16
3
votes
1 answer
HUD post-processing in Godot
I have a project in Godot that renders billboarded quads on top of enemies. The quads(meshinstances) are children nodes of the enemy nodes. I want to render just the quads to a viewport for post-processing, but the quads need to have the same…

Dave
- 93
- 2
- 9
2
votes
1 answer
Material.tres uses an old deprecated parameters names?
Problem:
I have a material which uses a shader in godot4(first stable release) and this is the code for the shader:
shader_type canvas_item;
uniform sampler2D custom_texture;
uniform float cutoff: hint_range(0, 1) = 1;
uniform float smoothness:…

Mahmood
- 403
- 2
- 10
2
votes
1 answer
Shader without loosing self background color?
Is it possible to apply a shader while preserving the self color?
so far this is what I've come up with
shader_type canvas_item;
void fragment(){
vec4 self_color = texture(TEXTURE, UV);
vec4 back_color = texture(SCREEN_TEXTURE, SCREEN_UV);
…

cak3_lover
- 1,440
- 5
- 26
2
votes
0 answers
How can I get overlapping translucent Godot sprites to keep the same opacity?
I have two simple translucent circle sprites that I'm using as fake shadows (shown below) under some characters (not shown below). When the characters get close enough, sometimes their shadow circles can overlap - which is fine - but thanks to the…

Sean Heber
- 98
- 6
2
votes
1 answer
Is it possible to add fragments outside of a 3D model's area?
In a 3D scene in Godot, I am attempting to create a pixel-perfect outline for a Spatial shader (applied after a pixelation effect to ensure the same resolution). To achieve this, I would like to modify pixels directly adjacent to the target…

Magikarp
- 171
- 1
- 11
2
votes
1 answer
Can't read a FORMAT_R8 uniform sampler2D texture correctly from within a shader in Godot
I need to pass an array of integers to a shader as a uniform. As uniform arrays are not yet supported, I'm using a FORMAT_R8 texture/isampler2D to achieve this.
If I'm correctly reading the bytes from the texture, they should be in the range [0..7]…

Petruza
- 11,744
- 25
- 84
- 136
1
vote
1 answer
Godot 4: Move canvas_item shader with camera
I am quite new to shaders at all and can't get this easy task running.
I created a ColorRect object and also a new shader material, to simulate a fog layer in my top down 2D game. Everything is working fine, the fog is drifting over the screen.
What…

Nuker
- 2,577
- 5
- 21
- 32
1
vote
0 answers
Issue with water shader in Godot
I'm trying to follow this video but in Godot 3: https://youtu.be/VSwVwIYEypY
attached is an image of my project tree and the ColorRect i want to render the texture to.
i have two shaders, one is attached to the material of the ColorRect (you can…

Andriy Sultanov
- 73
- 2
- 6
1
vote
1 answer
Distort shadow using normal map
I'm attempting to distort a "shadow" based on a normal map of the background, which I have access to in my shader.
Video
You can see here that I have a character hopping in front of a normal circle (while it looks off, this is just because of…

Tyo
- 11
- 2
1
vote
1 answer
Is it possible to test if an arbitrary pixel is modifiable by the shader?
I am writing a spatial shader in godot to pixelate an object.
Previously, I tried to write outside of an object, however that is only possible in CanvasItem shaders, and now I am going back to 3D shaders due rendering annoyances (I am unable to…

Magikarp
- 171
- 1
- 11
1
vote
1 answer
How can i use the visual shader on the Enviroment Sky Godot
how can i use the visual shader in the enviroment sky godot 3.4 any idea?
I dont have nothing else to put..

Rubén ramirez
- 99
- 1
- 8
1
vote
0 answers
Error `Expected initialization of constant` when initializing a const vec2[] in the shader global scope
I have this defined outside of any functions in a shader.
I get the error Expected initialization of constant
const vec2 rels[4] = {
vec2(-1.0, 0.0),
vec2(1.0, 0.0),
vec2(0.0, -1.0),
vec2(0.0, 1.0)
};
But in the godot…

Petruza
- 11,744
- 25
- 84
- 136
0
votes
0 answers
Pass TextureFilter as shader parameter
I wrote a shader to apply patterns to objects, for colorblind users.
The pattern is passed in as a shader parameter, currently with a linear filter:
uniform sampler2D pattern : filter_linear;
The same shader is applied to pixelated and smooth…

4444
- 3,541
- 10
- 32
- 43
0
votes
0 answers
Godot 4.1 Spatial Shaders : Possible to change projection direction of texture?
I am trying to apply a 2D texture to a 3D sphere. To do this, I create a Surface Material Override with a StandardMaterial3D, then plug the texture into the albedo.
The problem is that the projection only seems to come from the negative z…

GD Clone
- 83
- 6