48 questions
0
votes
0
answers
78
views
Godot: “Attempt to call function 'start_shake' in base 'null instance'” when accessing CanvasLayer node in scene instance
I’m having a problem in Godot 4 with calling the start_shake function in my screen shake system.
In the scene 1_level.tscn, I have SceneRoot with a child node Map, which is an instance of Map.tscn.
I ...
0
votes
0
answers
34
views
Unwanted colored area while rendering Godot shader
I am writing a Godot shader that outlines edges based on normal buffer and depth buffer. Here's how it looks like:
Here's how it should look:
Here's the code:
} else {
float central_depth = ...
0
votes
1
answer
267
views
Read GDShader variable value from a GDScript
Im learning shaders in Godot, and I need to read the value of a variable from a shader. I currently have a similar setup to the following:
shader_type canvas_item;
varying float value;
void fragment(...
0
votes
0
answers
59
views
How can I make this shader made for Godot 4.2 work in 4.3
I've been trying to follow the shader made in this youtube video: https://youtu.be/4dfADUfyKTA?si=82ABjYR1zPsPueSr
However the shader was created with Godot 4.2 and I am working with 4.3 which as I ...
0
votes
0
answers
60
views
Shade a mesh uniformly by using the lighting at the center of the mesh
I am trying to accomplish what is discussed in this video (timestamp is at the part of interest)
Essentially, I have a mesh (a billboarded quadmesh with a texture) that may be fully lit, fully shaded ...
0
votes
0
answers
358
views
mapping screen space to world space in a Godot shader
I'm trying to build a shader that will perform some post processing based on some entities that exist in the world space...
I went through some theory and tried to apply the knowledge I gathered but ...
1
vote
0
answers
49
views
Sampling other pixels of a UI Control in a Godot Shader
From my understanding, in a Godot Canvas Item Shader (fragment):
COLOR contains the current pixel color of the Canvas Item (for example white if on a white text)
TEXTURE contains the texture if there ...
0
votes
0
answers
178
views
Animation is not displaying Godot 4 before queue free
I am trying to play the animation once the enemy enters the area 2d of my player. For some reason the queue free is activated and is not showing the dead animation. Any ideas?
func ...
1
vote
2
answers
262
views
How would one change the settings of a shader based on the value of a slider?
I want to have a slider that the player uses to change how a shader affects the color of a sprite.
Here is the shader:
shader_type canvas_item;
uniform vec4 color : source_color;
void fragment(){
...
0
votes
1
answer
253
views
Fix Incorrect Colors on Godot4 Shader
Inconsistent Results for Grass Shader Sampling Ground Texture Between Different Renderers
I'm currently developing a Grass Shader that samples the ground texture in Godot 4. However, I've encountered ...
0
votes
1
answer
483
views
Why is it that when I use set_shader_parameter, the sprite dissapears instead of changing to the state I set it to?
Godot 4.2
I have a shader that changes the hue of an AnimatedSprite2D. Here is the shader:
shader_type canvas_item;
uniform vec4 color : source_color;
void fragment(){
vec4 pixelColor = texture(...
2
votes
1
answer
147
views
Spatial vertex shader: what are the actual values?
I am trying to understand spatial shaders in Godot and have a simple vertex shader:
shader_type spatial;
void vertex(){
VERTEX.y -= VERTEX.x;
}
I applied it to a sphere with this result:
So it ...
0
votes
1
answer
105
views
Determine position of light relative to a tile in a Godot shader
I have a Godot CanvasItem shader that is assigned to the material of a specific tile in a TileMap. In the shader, I need to know the position of a light relative to the bottom of the tile.
I am ...
0
votes
1
answer
769
views
In Godot4 (3D), how to make objects close to the camera transparent for a camera but not for another?
I am working on a 2 player cooperative game. Both of them are on a ship together. One of them is the pilot and another shoots a turret on the ship. The problem is that I would like to make the ship ...
1
vote
1
answer
305
views
How do I get what a camera in a different layer is seeing?
I am making a portal system in godot 4. There are 2 worlds, everything in the normal world is on layer 1 or culling layer 1 (lights), and vice versa for altered world. The player model that moves ...
0
votes
0
answers
218
views
Godot VisualShaderNodeCustom C#
I'm relatively new to Godot (came from Unity after all the trouble) but got around pretty good. I'm currently doing alot of shaders and since I use some functionality at different spots I thought it ...
1
vote
1
answer
1k
views
Godot vertex shader to bend a mesh along a path (similar to the Blender's "Curve" modifier)
Similar question: Bend a mesh along spline
Related: How to bend geometry with geometry nodes
Related: Unity Curve Modifier
What I'm trying to do:
I want to create a Godot vertex shader that bends ...
3
votes
0
answers
250
views
Seams on noise WGSL shader, porting gdshader to wgsl (bevy)
left is wgsl, right is gdshader
Bevy MRE here
I am trying to port a water shader written in gdshader to WGSL (in Bevy).
However I noticed that there is some seaming going on. After some time I figured ...
1
vote
2
answers
2k
views
Why does my shader work fine in the Godot editor, but not in runtime?
I wrote a shader on a CanvasItem in Godot:
shader_type canvas_item;
void fragment() {
vec2 distortedUV = UV;
distortedUV.x += sin(distortedUV.y * 5.0 * TIME/100.0 + TIME) * 0.1;
COLOR = ...
1
vote
1
answer
1k
views
Godot render image with different shaders to a texture
I'm sorry, I can't explain it normally, but I hope you understand.
In general, there is an image from the camera and it is displayed in the game. Also in 3d, the camera creates a depth texture that is ...
1
vote
0
answers
542
views
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 ...
0
votes
1
answer
248
views
How to move an object through the scene tree in Godot?
I created an Area2D node and created an AnimatedSprite node in it.
I select a random sprite and create it with the Add_child function, I scroll with the script, but the scrollable background appears ...
0
votes
0
answers
1k
views
how do i fade out a texture in Godot shader?
Hello I was wondoring how can I fade out the edges of the rainbow shine
to create somewhat of a card foil effect
Using Godot 4.1 stable .
This is what I've done . . .
(I combined Two Shaders I found ...
0
votes
1
answer
829
views
light_mode shadow_only material in godot 4 for 2D light
I want to make a 2D object that becomes transparent when light hits it. This is completely opposite to the light_only light mode. To be honest light_only doesn't work in Godot 4.0, it's fixed in 4.1
...
0
votes
1
answer
527
views
Godot Particle Shader CUSTOM - storing more than 4 pieces of data?
I'm wondering if there is any way I can store more than 4 pieces of custom data between frames of a particle shader. In my shader, each particle is given a random xyz position and xyz rotation. I want ...
1
vote
1
answer
2k
views
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 ...
4
votes
1
answer
2k
views
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: ...
0
votes
1
answer
808
views
Godot 2D Outline shader is duplicating edge pixels (bleeding pixels)
I have this original png file:
And I am applying this shader from the GDQuest shader tutorial in the Sprite Node:
https://github.com/GDQuest/godot-shaders/blob/master/godot/Shaders/outline2D_outer....
1
vote
0
answers
151
views
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 ...
0
votes
1
answer
573
views
cropping and expanding using shader?
I'm trying to create a shader which can crop or expand a texture (along the x axis)
so far this is what I've come up with on the cropping part:
shader_type canvas_item;
uniform float start_x:...
0
votes
0
answers
281
views
How can I hide part of a Sprite2D which is out of TileMap's tiles? Godot 4 beta 16
I am making a blood traces, but sometimes traces can spawn in the way like this, so I have a part of my trace which is out of wall.enter image description here
So how can I cut out or hide this part?
...
1
vote
1
answer
500
views
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 ...
0
votes
1
answer
947
views
Clipping outside texture shader
I'm trying to create a shader which decides the silhouette of the sprite by giving a texture (sampler2D) as input in shader parameter and clips anything outside it's bound
And so far this is what I've ...
0
votes
0
answers
275
views
Place sprites at certain positions using a shader
What I achieved:
I created a shader (based on this code with this plant asset) that takes a black and white reference image (like a height map) and places plants on a grid determined by the darkness/...
2
votes
1
answer
301
views
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 ...
0
votes
1
answer
573
views
How to combine world environment post processing with custom post processing shader in a 3D world, Godot 4.0
I am trying to use the in-built post processing effects attached to a Camera3D while also applying a custom post processing effect to run in combination with the other effects.
I have read tutorials ...
0
votes
1
answer
4k
views
How to write values to depth buffer in godot fragment shader?
How do you specify the depth value in the fragment shader, if you would like to for example render a texture of a sphere that also affect depht buffer in the cameras z-direction?
In OpenGL you can use ...
2
votes
0
answers
1k
views
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 ...
4
votes
1
answer
3k
views
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 [...
1
vote
1
answer
977
views
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 ...
2
votes
1
answer
202
views
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 ...
3
votes
1
answer
486
views
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-...
0
votes
1
answer
332
views
How to crop sprite in a non-rectangular form?
I'm trying to cut sprites in non-rectangular forms, I found this for angled cutting but is there a way to crop if an equation is given?
for example the equation of an oval (x−h)^2/a^2 + (y−k)^2/b^2=1 ...
3
votes
1
answer
2k
views
How to apply shaders and generate images only once?
I'm trying to apply a pixelation shader to my textures and I need it to be applied only once, after that I can reuse my shader generated images as textures over and over without having to calculate ...
0
votes
1
answer
412
views
how to view pixelation through camera2D?
I'm trying to create a pixelation shader which I can view through the camera2D node
something like this but instead of black and white I need pixelation
using this answer I got a pixelation shader but ...
1
vote
1
answer
728
views
How can i use the visual shader on the Enviroment Sky Godot [closed]
how can i use the visual shader in the enviroment sky godot 3.4 any idea?
I dont have nothing else to put..
1
vote
0
answers
1k
views
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),
...
3
votes
1
answer
1k
views
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 ...