Sketchfab Forum

Sketchfab transparency from PNG fails

(Bertil) #1

Transparency seems to be a hairy topic, and I have used a lot of time to come to grips with it, trying quite a few experiments in the excellent Sketchfab factory. Here is my last attempt.

The model is one mesh.
It has an albedo/diffuse texture map and a png greyscale (stripes) map for the transparency slot.

However the transparency map seems to have no influence on transparency.
The transparency slider gives me even transparency on the whole object with or without the png map. If I use the same png in the emission slot, the greyscale has effect though.

Diffuse map:

Transparency map:

I'm certainly missing something very basic here, that I could'n extract from otherwise really good tutorials (I thought there would be simpler solutions than the Coca Cola example).

I'd be happy to get some basic advice, as I'm new to this stuff.
Thanks in advance!

(Shaderbytes) #2

Im sure if you save the transparency map as a jpg and use that sketchfab will interpret the rbg values as alpha for you. I think with png files it will read the value from the alpha channel of the image and not the rgb channels.

(Stephomi) #3

What shaderbytes said. If you upload a PNG you can change the texture format from ALPHA to LUMINANCE in the editor.

(Bertil) #4

Thanks guys!
I'll try that. I thought that Sketchfab converted everything to PNG, and so...
I'll be back on this matter.

(Bertil) #5

Well, that worked, sort of.

Alpha or luminance didn't make any difference, but at least I got different transparencies.
Nearest, bilinear and Trilinear has no effect.
Making the jpg a truly greyscale instead of an RGB greyscale made transparency steps clearer.
I also discovered that exporting the greyscale material from Sculptris rendered one of the grey levels dithered, and fixing this in PaintShop for an even grey, made it better as well.

Thanks again for your input!
Now I can start fiddling a bit more with levels and more useful transparency.
Merry Christmas guys!

(Mica Chan) #6

Personally held decent results using a single PNG image as my diffuse and transparency within Sketchfab.

PNG Texture

Created a simple plane and added this png as it's texture to uploaded here. Within the site's 3D Settings I applied the same texture on both and achieved this result right away.

I used this method on my Vampire model & other than needing to change the Filtering for transparency to "Linear", it worked as I wanted it to. If your workflow works with or is more efficient by saving out only one image that has the alpha built in then I may suggest to try it. I don't know enough to know if there is a benefit to saving separate diffuse and transparency images.

Hope this helps and merry early Christmas Bertil.

PNG Transparency Fails During Upload
(Shaderbytes) #7

yes this is how I do it for stuff like floor shadows but the diffuse and transparency of a material are not always something that can be represented with one png , so it is not about benefit but more about complexity.

(Mica Chan) #8

There is more for me to explore. Am barely starting to utilizing transparency within my models as a way to save polygons & lower my work. Have yet to dwell into much complexity but it will be good to remember separating them is an option for when I do come across a complex material I wish to achieve.

(Bertil) #9

Thanks Mica! Interesting and beautiful indeed.
A Merry Chistmas to you!

(Bertil) #10

Now, after good advice, I have a follow up question.
I'm using a JPG greyscale transparency map, so no alpha channel. The transparency follows the grey scale level on the map, seemingly independent of other settings, which is fine.

The problem is, that I can't use the transparency slider to fine tune the transparency, which I expect.
Moving the slider to the right still affects even the opaque areas and makes them transparent as well. The JPG map is all white for opaque areas.

What do I do wrong?
Merry Christmas all!

(Stephomi) #11

The slider is simply multiplied against every pixels, we don't make any distinction between opaque and transparent pixels, so you do nothing wrong.
You have to edit the textures outside sketchfab if you need to fine tune it.

In sketchfab, it doesn't really matter as we are going to reprocess your textures anyway and probably separate the channels (jpg doesn't have alpha, so we need to create a new grey scale jpg in that case).
We are currently experimenting with packing, which means that once the texture is downloaded, we might repack several channels into single textures (for example diffuse/transparency, specular/ao, etc...).

(Bertil) #12

Ah, thanks Stephomi, that explains it transparently enough :slight_smile:

I would have thought it to be a good idea, that once you have grey scale or alpha map of what pixels should be more or less transparent, only those pixels should be targeted by the slide. Dragging the slider to the right would make för more transparens while keeping transparency differences as mapped. There's probably a good reason that the slider works the way it does.
I have no way of seeing the transparency locally, but on the other hand it's easy to upload new versions of any texture och map.