Ombarus/pcg_planet_yt

Shader Glitches

Closed this issue · 2 comments

Hello I really like the tutorial on how to make planet, but after messing around with code rewritten from videos and creating multiple planets I found that there is some kind of shader problem. I mean the planets tend to get shader texture/colour/biome of last created planet.

Example - snow planet got desert planet skin
obraz

Additionally: Shader is saved on disk.

I sort of found fix for people who have saved shader on disk

At PlanetMeshFace _update_mesh function.
var shad_mat = ShaderMaterial.new()
shad_mat.shader=load("shader_load_path")
self.material_override=shad_mat

obraz

Materials and Shader are resources in Godot and they are shared (that's how we can set a single material to all the faces) But that means they are also shared between planets. If you want multiple planets with different material you're going to have to duplicate the shader. What you're doing might work. You might also want to take a look at the duplicate() method.