Assigning different materials to different parts of a Mesh cause them to be transparent. #70466

Closed
opened 2019-10-03 00:30:36 +02:00 by Zino Guerr · 23 comments

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: aabd8701e9
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.
mat.png

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

**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: `aabd8701e9` 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. ![mat.png](https://archive.blender.org/developer/F7786533/mat.png) [Based on the default startup or an attached .blend file (as simple as possible)] [Mat.blend](https://archive.blender.org/developer/F7786530/Mat.blend)
Author

Added subscriber: @Znio.G

Added subscriber: @Znio.G

#78224 was marked as duplicate of this issue

#78224 was marked as duplicate of this issue

#70492 was marked as duplicate of this issue

#70492 was marked as duplicate of this issue

#70472 was marked as duplicate of this issue

#70472 was marked as duplicate of this issue

#70477 was marked as duplicate of this issue

#70477 was marked as duplicate of this issue

#70469 was marked as duplicate of this issue

#70469 was marked as duplicate of this issue
Clément Foucault was assigned by Brecht Van Lommel 2019-10-03 03:07:53 +02:00

Added subscriber: @rimpotche

Added subscriber: @rimpotche

Added subscriber: @dgsantana

Added subscriber: @dgsantana

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

Just another example on the latest nVidia driver (GeForce RTX 2080 SUPER, 4.5.0 NVIDIA 436.48) ![image.png](https://archive.blender.org/developer/F7787278/image.png)

Added subscriber: @JulienKaspar

Added subscriber: @JulienKaspar

Another test.
image.png
Fig 1. Missing "grass" material

Switching the order of the materials
image.png
Fig 2. Missing polys but both materials appear

Another test. ![image.png](https://archive.blender.org/developer/F7787326/image.png) Fig 1. Missing "grass" material Switching the order of the materials ![image.png](https://archive.blender.org/developer/F7787329/image.png) Fig 2. Missing polys but both materials appear

Added subscriber: @brecht

Added subscriber: @brecht

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.

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(
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( ```

Added subscriber: @Phigon

Added subscriber: @Phigon

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @Tyler-Foo

Added subscriber: @Tyler-Foo

This issue was referenced by 11768d1c9f

This issue was referenced by 11768d1c9f4374ffa512a0d90cfde776d3e9babe
Added subscribers: @starnokia9310, @alausic, @WybrenvanKeulen

Added subscriber: @YanDaik

Added subscriber: @YanDaik

Added subscriber: @cadtofu

Added subscriber: @cadtofu

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

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

Added subscribers: @BhaveshVishwakarma, @iss

Added subscribers: @BhaveshVishwakarma, @iss
Thomas Dinges added this to the 2.81 milestone 2023-02-08 16:46:56 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
9 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#70466
No description provided.