0 votes

Alright, so I'm trying to make an object that you can pick up and carry and becomes partially transparent when carried (think OG Deus Ex)

I've got a shader material in slot 0 with a float defined that sets alpha to it, and I'm passing through a value with

mat = $MeshInstance.get_surface_material(0)
mat.set_shader_param("alpha_set",_al)

_al is the alpha value set earlier in code.

But when I run, I get a weird duplication thing happening
weird thing

I'm assuming I'm setting the materials wrong, but I don't really get what I'm doing here, this is my first foray into 3d dev.

The displacement is because the one at the bottom is falling according to code, whereas the top one is stuck at origin and doesn't seem to be affected by the attached script. Collision only applies to the bottom one, but only the top one renders shadows. The alpha that gets defined only applies to the bottom one (the top one seems fixed at full opacity). There's also a strange issue on the bottom one where certain faces will render over others (visible in image on bottom one)

There is only one mesh instance in the scene.

Godot version 3.2.3
in Engine by (19 points)

1 Answer

0 votes
Best answer

I've solved this problem. The duplicate mesh was a result of it being inherited from a glb file that the scene was inherited from. I moved the mesh in the scene to be a child of a kinematic body, but it would just regenerate the mesh in the original location. This was fixed by right clicking on the parent node and clearing the inheritance.

The alpha issue was a bit more in depth, but basically instead of using the built-in alpha value for the mesh, I created a shader that would discard pixels using a standard bayer dithering algorithm using a value passed to the shader. I then had to make sure both the material and shader were local to the scene, and now it works like a charm!

by (19 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.