Sketchfab Forum

Issue with Opacity / Transparency Blending

(Taber Noble) #1

Hi, I'm having some trouble with the blending / opacity values on my transparent glass model today in Sketchfab. After texturing this asset in Substance Painter I have the opacity values looking the way I prefer, yet upon viewing the object in Sketchfab they seem to be way off and present some sort of flicking effect.

Here are some images of what I am seeing in Substance Painter:

And here is the model in Sketchfab:

I have multiple planes of geo with different opacity values blending over top of one another, and in the viewport they seem to be making some sort of 0-1 opacity masking effect. As well as flickering as I go around the object :cry: Is this an issue I can fix somehow? When I switch the blending mode to dithering within Sketchfab it eliminates the problem, but then erodes the quality of said transparency with tiny specks. Would love to have some help with getting around this somehow. Thanks :slight_smile:

(Stephomi) #2

Transparency is indeed tricky, especially with intricate geometries.

To work well with traditional blending, we need to sort the geometries and hope that we can render the faces in the correct order.
The issue here is that you have one geometry inside one another, so depending of the viewpoint, the sorting tends to be inconsistent.
One time the outer bottle will be drawn first and one another time the inner bottle will be considered first.

Although a bit technical, we do split front/back faces in 2 separate passes, so if you render a simple sphere we'll correctly draw the back faces first and then the front ones. It helps a lot in some cases, but not every cases.

Substance is probably handling the sorting a bit differently.

Some engine (like UE4) proposes to have a manual sorting list (where you manually sort your geometries), we don't have that.

There's a few things that could help (although like allego, I can't guarantee you that our sorting algorithm will always be the same):
- Merge transparency geometries : it will definitely fix the "flickering" bug. However, you'll probably have some artefacts due to wrong ordering of faces, but at least it will be consistent.
Usually it's a bad idea to merge transparent geometries because the engine can't sort them correctly. However if the geometries are colliding (or here one inside the another), it'll definitely help
- Dithering transparency
- Split transparent geometries into many pieces : The more pieces there are the easier it will be for the engine to sort them correctly. (note: don't split it into too many pieces, otherwise the viewer will merge them back starting from a certain threshold, 100 at the moment).

(Taber Noble) #3

Thanks for the reply, I think for now what I'll do for this particular object is just remove the opacity and move on. Having a manual sort order for the transparency geo would probably be most ideal solution moving down the line, or perhaps having some way to adjust the dithering values. Anyways thanks again for the help!