Page MenuHome

Assigning different materials to different parts of a Mesh cause them to be transparent.
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows-10-10.0.1709 64 Bits
Graphics card: GeForce GTX 1050 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.30

Blender Version
Broken: version: 2.81 (sub 13), branch: master, commit date: 2019-10-02 17:42, hash: rBaabd8701e985
Worked: (optional)

Short description of error
If i assign materials to different Faces of a single Mesh they become transparent and switching slots order or pushing anyone up makes it transparent.

Exact steps for others to reproduce the error
Assign different Materials to Suzanne second one becomes transparent.
Switching the order will switch the one who becomes transparent and the more you add the whole Mesh gets affected.

[Based on the default startup or an attached .blend file (as simple as possible)]

Event Timeline

Just another example on the latest nVidia driver (GeForce RTX 2080 SUPER, 4.5.0 NVIDIA 436.48)

Another test.


Fig 1. Missing "grass" material

Switching the order of the materials


Fig 2. Missing polys but both materials appear

I'm looking into this. It seems that if there are N faces with the first material, then the first N faces with the second material get hidden.

The result returned by elem_offset() in gpu_batch.c seems to be double what it needs to be.

This makes things work:

diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c
index c08680d..23f7780 100644
--- a/source/blender/gpu/intern/gpu_batch.c
+++ b/source/blender/gpu/intern/gpu_batch.c
@@ -670,7 +670,7 @@ void GPU_batch_draw_advanced(GPUBatch *batch, int v_first, int v_count, int i_fi
     const GPUIndexBuf *el = batch->elem;
     GLenum index_type = INDEX_TYPE(el);
     GLint base_index = BASE_INDEX(el);
-    void *v_first_ofs = elem_offset(el, v_first);
+    void *v_first_ofs = (void *)((int)elem_offset(el, v_first) / 2);
 
     if (GPU_arb_base_instance_is_supported()) {
       glDrawElementsInstancedBaseVertexBaseInstance(

same problem happend to me.
blender 2.81/2.81a win64 (both official release)
nvidia card driver version, both v341.74 and v342.01
affect eevee/workbench engine, not affect cycles engine.

System Information
Operating system: Windows-10-10.0.17763 64 Bits
Graphics card: GeForce 310M/PCIe/SSE2 NVIDIA Corporation 3.3.0