Problems with transparency [SOLVED]

I have this scene:

Note how theres pitch black parts of the mesh. These are supposed to be fully transparent. Im going for a PS1/N64 look, but im getting this problem with transparency. Im using the standard rendercam render script, and the shaders can be found in the project, but it just calculates some light. Ive tried to just discard the pixels if the texture is fully transparent (alpha == 0) but then i get this result:

this is the texture:
tileset

Any help is greatly appreciated.

Could this be premultiplied alpha related?
We use premultplied alpha in our pipeline, and our shaders do that as well.

I looked in your shaders and you don’t seem to use the alpha at all? The smooth_shading.fp returns gl_FragColor = vec4(result, 1);

1 Like

Ye, on that it happens bc of lighting calculation. Although, ppl told me that i could just verify the alpha value of the texture at a fragment and discard; which is what i did but didnt seem to work. When i have time, i will update the light library to use the alpha.

the thing that stuck to me the most, is that discarding a pixel just didnt work, instead i got that odd thing where some pixel were still being shown.

Is discard guaranteed to be per pixel?
Iirc it’s for discarding blocks of pixels as an optimization.
The rest of the shader must still work as desired.
@jhonny.goransson do you recall?

1 Like

well thats one thing i didnt know about. Anywway, i will update the materials like jhonny suggested, it will be better for future use as well.

Well you can use discard based on if alpha is lower than some value, but I doubt that’s what you want in this case. Discard is per pixel, but it’s discreet so not sure how you would use it for alpha blending