Page MenuHome

Can't sort Linked objects transparency in viewport
Closed, DuplicatePublic

Description

Blender Version
Broken: 2.76 f337fea and above

Short description of error
It seems that object transparency sorting is directly related to object creation order.
This behaviour makes impossible to correctly sort the objects transparency in linked dupligroups.
Even if a possible workaround is to manually delete in the source file all the meshes and recreate them in the desired order, this is not a handy way of dealing with very complex files with multiple dupligroups and links.

Exact steps for others to reproduce the error
Open the included scene.blend file and you'll see on the left a CubeMonkey geometry and on the right a MonkeyCube one.
They are both linked from the included source.blend file.
The CubeMonkey dupligroup has inside two meshes, a cube and a suzanne, with the cube, having a transparent material, created before the monkey.
The MonkeyCube dupligroup has inside a duplicate of those meshes, but the cube duplicate was created after the monkey one.
As you can see, transparency works only if the object with the transparent material is created first.

Details

Type
Bug

Event Timeline

Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.

Also depends on active object in source file…

Not sure, but would say this is limitation of OpenGL code in 2.7x series, especially for BI? Maybe some OGL guys around know better…

as most developers soon find out

transparency sorting is one of the hardest problems in computer graphics, so we cannot blame blender for not being able to visualize a bunch of semitrasparent monkeys dancing in a row.

The way blender resolves which objects are to be rendered in a different pass is "asking", i.e. the user is required to flag wether an object is transparent or not.

The "bug" with dupligroups is that such setting is ignored, and semitransparent objects are rendered in the same pass as the opaque ones, so it would be nice to fix at least that.

A temporary workaround is a script in scene.blend that sorts the objects inside a dupligroup

import bpy

for grp in bpy.data.groups:
    for ob in reversed(grp.objects[:-1]):
        if ob.show_transparent:
            # make it last object
            grp.objects.unlink(ob)
            grp.objects.link(ob)

different dupligroups will still overlap, but at least you will be able to animate characters with glasses or other common scenarios (need to check transparency on the cube in source.blend, otherwise it won't work)

@Paolo Acampora (pkrime), i remember you wrote for us a patch to fix that while we were rendering our animated feature GL previews. I think it's here https://developer.blender.org/T48983. @Bastien Montagne (mont29) We are stil using it in studio, even if rejected (and still unclear to me why) i think it could be at least a good starting point to address the issue, can you please consider it?

I think this should be tested against Eevee engine in Blender2.8 then, really not worth spending time on this for BI currently, since it's doomed to be removed.

Anyway, thanks for pointers to older reports, will merge that one then.

@Bastien Montagne (mont29) since 2.79 is going to be last stable build till the official 2.8 release, i thought it could be worth a look at this patch since, even if doomed, BI will stay as long as needed to make 2.8 stable. What benefit could come from not having a workaround for that issue in 2.79 as long as it doesn't break anything else?

while this report is indeed about a transparency issue, this one is different as it is not about having a better sorting in blender (not going to happen anytime soon), but about the "transparent" flag being ignored when dupligroups are visualized.

It's not blender lacking a feature, it's blender not honouring its own drawing settings