Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan Mobile: decal cull layers do not sync to changes on visual layers of meshes. #73706

Open
jcarlosrc opened this issue Feb 21, 2023 · 2 comments

Comments

@jcarlosrc
Copy link

Godot version

4.0 RC3

System information

Ubuntu 22.04

Issue description

If we set a cull layer to a decal, and update meshes to different layers, these changes are not updated to the decal. We need to "reset" the decal cull layer by clearing all its cull layers and assign it again in the editor for the changes to take effect. In the videos, a decal with a cull layer = 1 shows in a mesh instance at layer 3. We need to reset decal layers for the culling to work.

screen_recorder-2023-02-21_15.28.42.mp4
screen_recorder-2023-02-21_15.35.38.mp4

Steps to reproduce

Set a decal and some meshes. Change the meshes layers. This change will not show in the editor nor in the game. Now reset decal layer by empty its cull layer and then choosing a new one. Now changes are visible and decal will cull properly.

Minimal reproduction project

mobile_decal_cull_layer_bug.zip

@jcarlosrc jcarlosrc changed the title Vulkan Mobile: decal cull layers do not sync to visual layers of meshes automatically. Vulkan Mobile: decal cull layers do not sync to changes on visual layers of meshes. Feb 21, 2023
@Calinou Calinou added this to the 4.x milestone Feb 21, 2023
@clayjohn clayjohn modified the milestones: 4.x, 4.1 Feb 21, 2023
@clayjohn
Copy link
Member

clayjohn commented Feb 21, 2023

This should be a quick fix. When the VisualInstance3D layer is set we need to flag that the mesh needs to be paired again. We do something similar with lights already:

if ((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK && instance->base_data) {
InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data);
ERR_FAIL_NULL(geom->geometry_instance);
geom->geometry_instance->set_layer_mask(p_mask);
if (geom->can_cast_shadows) {
for (HashSet<RendererSceneCull::Instance *>::Iterator I = geom->lights.begin(); I != geom->lights.end(); ++I) {
InstanceLightData *light = static_cast<InstanceLightData *>((*I)->base_data);
light->shadow_dirty = true;
}
}
}
}

@clayjohn clayjohn modified the milestones: 4.1, 4.x Jun 13, 2023
@Calinou
Copy link
Member

Calinou commented Aug 29, 2023

Can anyone check if #80911 fixes this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants