Page MenuHome

layered alpha gradients in viewport not correct
Closed, ArchivedPublic


When using alpha-gradiented textures in objects, which are overlapping (laying on top of each other), the alpha-channel is not correctly drawn.
if an object is selected though, the alpha channel of this object is drawn correctly.

please see this forum entry:

a .blend file is attached.

Tested on:
CPU: Intel Core 2 Duo 2,5 GHz
GFX: GeForce 8600M GT, 512 MB
OS: Mac OS X 10.6.7 (10J869)
Blender: 2.58.0 (r37702)

blender 2.57 on ubuntu shows the same behaviour.

Event Timeline

I believe this is a known issue and there is an existing bug report.

It seems to be the result of the transform out of linear space somehow doubling up the transform on the alpha channel.

Please test with linear output and ingestion to confirm.

thanks for the reply.

Sorry, what i forgot to mention in my initial message was that this happens in the viewport (3D View Window). i am am not talking about final render.
(this is mentioned in the forum thread tough... also the screenshots provided there are made from the 3D View)

as far as i understood the colormanagement it is used in the rendering process and is not affecting the viewport. is this correct?

i can not see an effect in the 3D View by un/checking the Color Management button in the render-tab in the properties window.

when i render the scene provided in the .blend file, everything is fine. i use the game-renderer, also there the quality is very good.

but maybe i just do not know how to change to linear output for the viewport...
(looked through the preferences another time...)
sorry, i also do not understand what you mean with "test with ingestion".


Troy is a bit confused here with other alpha issues :) I also have still no idea what this ingestion stuff is...

Ingo: drawing multiple transparent objects correcly in the 3d viewport is very hard with openGL.
For correct and visible display, we also draw everything that's unselected first, then a selection on top of it. We also don't sort alpha faces on Z before drawing (speed reasons).
This means the viewport display for transparent objects isn't very accurate yet.

There's ways to solve it but that's really a special new project someone should work on one day... it's on our todo in wiki as well.

Ton Roosendaal (ton) changed the task status from Unknown Status to Archived.Jul 19 2011, 4:33 PM

I digged into the code a bit to solve this problem and want to propose an object-base solution:

in view3d_draw.c function view3d_main_area_draw:

when drawing the objects:
- calculate distance to viewpoint
- z-sort the objects
- draw the objects in z-order

in order for this working nicely, also the selected objects and objects in edit_mode are drawn z-ordered. no drawing afterwards, this would mess with the alphas again...
(me being a beginner with blender-coding wonder: whats the reason, to draw selected objects and obj in editmode afterwards?)

to try out, please find a patch here:

the patch solves this viewport bug. after a quick test with more complex sceneries it does not interfere.
before i submit this patch, i would love to get reactions from more advanced developers than me about this solution. there might be more efficient ways... ;)