godot
godot copied to clipboard
Setting the POSITION of a vertex in a conditional statement leads to weird behavior
Tested versions
- Reproducible in: 4.2.1.stable
System information
Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 Ti (NVIDIA; 31.0.15.5186) - AMD Ryzen 7 3800X 8-Core Processor (16 Threads)
Issue description
When setting the POSITION built-in variable in a conditional statement the vertex always seems to be affected. After some testing the behavior seems unpredictable. At first even when doing if (false) made the mesh appear in the center of my screen but after some testing it sometimes disappears. Only when commenting out the code that sets the POSITION variable does it not take affect.
Steps to reproduce
- Create a new project with the default settings.
- Create a new scene with a Node3D parent.
- Create a GPUParticles3D node.
- Set the ParticleProcessMaterial to a new ParticalProcessMateria, leave the settings the default.
- Set Draw Passes > Pass 1 to a QuadMesh.
- Set the QuadMesh's Material to a new ShaderMaterial.
- Set the ShaderMaterial's Shader to a new shader, name it anything.
- In vertex function add
if (false) { POSITION = vec4(-1,-1,-1,-1); }
.
When the code setting the position is not commented out it still affects the particle even when the conditional statement evaluates to false.