Jump to content

PNG Transparency


Recommended Posts

I don't know if this is a bug but I think it is worth reporting.

 

I've made a simple decal image in Substance Designer and exported from there as PNG into Leadwerks and the result is a black background.

 

I have to take those exported PNG's into GIMP and export them out there as PNG's and then bring into Leadwerks and then change the compression type to uncompressed in each of the images for Leadwerks to be able to recognize the alpha.

 

If you want the original images straight from Substance Designer I can send them across.

 

Thanks!

Link to comment
Share on other sites

I have to take those exported PNG's into GIMP and export them out there as PNG's and then bring into Leadwerks and then change the compression type to uncompressed in each of the images for Leadwerks to be able to recognize the alpha.

 

Seems like this is a problem with how SD exports PNG's not how Leadwerks interprets it. By taking the same images you posted in the other forum topic and saving them as PNG with GIMP, the images work as expected with transparency in Leadwerks. Also, its not just the uncompressed that shows transparency in Leadwerks. Saving those images as DXT3 and above show the transparency. You should be posting this problem to Substance Designer.

 

As for as using DXT3 compression, that is only meant for full opacity or full transparency and may cause artifacts. DXT5 should be used for a transparency gradient or if the other compression methods cause artifacts. Uncompressed will work as well for full transparency gradients or removing artifacts caused by compression, just results in larger file. You need to review the Leadwerks Textures tutorial which explains this in the Compression section. Also changing the Filter Mode from Smooth to Pixel will help remove "bleeding" when using a compression.

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

This can't be a problem with SD since it works with other programs. There are multiple ways to encode PNG images, and it's possible that Leadwerks only decodes it in certain way(s). I'm thinking SD is exporting 32-bit palette color PNGs or something, and since it's not the most common format, Leadwerks doesn't directly support it. I don't really have the time or desire to investigate the actual encoding techniques used, but this sounds like the issue to me.

  • Upvote 1
Link to comment
Share on other sites

It's not the DXTn compression methods though that cause this. Those are specific texture compression schemes that are better for quick access texture lookups in VRAM. Once the PNG is decoded in the Leadwerks editor, it is encoded with the DXTn compression (except when you select uncompressed). The TEX file I think contains the new texture, which is why when you change the PNG source file, the TEX texture will also change. The problem is with the PNG being decoded.

Link to comment
Share on other sites

The problem is with the PNG being decoded.

Ive used PNGs with a transparency gradient close to a decade and almost as long with leadwerks and never had this problem. SD encodes to another format available for PNG and now its Leadwerks problem on how it decodes PNG? Josh may be able to resolve it but seems strange that SD is not being approached to provide an export to PNG with an alpha channel. If you do a quick google search about PNG with transparency and SD, you will see this is not an uncommon question/problem with any allegorithmic product. Seems the simplest solution for the OP if he is going to continue to use SD is just export to another format that supports transparency (or just use GIMP to save the SD exported textures to a PNG format that has an alpha channel).

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

If other programs can open it without errors, then it's an issue with Leadwerks. I don't know if Josh programmed the decoder (he may have used a library). But anyway, there are many different ways to represent the alpha channel in PNG images (see section 6.2):

https://www.w3.org/TR/PNG/#4Concepts.PNGImageTransformation

 

According to a StackOverflow post I saw, alpha channels are handled differently (they could not be placed in the tRNS chunk):

https://www.w3.org/TR/PNG-Decoders.html

https://www.w3.org/TR/PNG/#11tRNS

 

I may have this backwards (I've never actually written a decoder for this), but the more common form of PNG images uses 24-bit (RGB) palettes with a tRNS chunk to map alpha values to those (which can save on memory since undefined alpha values will default to 255). However, you could also have 32-bit palettes (RGBA) to represent characters. This is apparently less common, but still valid. So, Substance Designer must be using this. The downside to something like this that you have a larger palette, but you could make texture accesses quicker since the palette is all in one spot in memory. I think that's why this method isn't as popular. With 4K textures though, maybe 32-bit palettes are better for decoding quicker.

Link to comment
Share on other sites

Yes, fully aware there are multiple formats with PNG - I posted a link that shows that in the original post concerning this problem. My point is SD is the texture creator, so why isn't SD being requested to provide multiple ways to store the alpha channel? Other FREE texture editors can do this easily already. Why should Leadwerks have to add what SD only exports PNGs to? But whatever, Josh may very well be able to resolve this fairly easy so it makes no difference to me. But adding a specific PNG format that only affects a handful of users that use SD seems silly when an SD user could use TGA or use a free texture editor like GIMP or PAINT.net to save in a PNG format that Leadwerks can read properly.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

But adding a specific PNG format that only affects a handful of users that use SD seems silly

And, how are you so sure there's only 'a handful' of SD users? It's perhaps because LE doesn't support it that you don't see much SD created content.

It's the same for PBR or IBL content. LE doesn't support them (yet), but that doesn't mean there's only 'a handful' that use those features, or would like to use them in LE.

  • Upvote 2

 

ZBrush 4R7 64-bit - 3DCoat 4.5 BETA 12 - Fl Studio 12 64Bit - LE 3.2 Indie version - Truespace 7 - Blender 2.71 - iClone 5.51 Pro - iClone 3DXChange 5.51 pipeline - Kontakt 5 - Bryce 7 - UU3D Pro - Substance Designer/Painter - Shadermap 3 - PaintShop Photo Pro X7 - Hexagon - Audacity - Gimp 2.8 - Vue 2015 - Reaktor 5 - Guitar Rig 5 - Bitmap2Material 3

Link to comment
Share on other sites

And, how are you so sure there's only 'a handful' of SD users? It's perhaps because LE doesn't support it that you don't see much SD created content.

It's the same for PBR or IBL content. LE doesn't support them (yet), but that doesn't mean there's only 'a handful' that use those features, or would like to use them in LE.

 

In agreement with this, multiple engines use substances now and other content exported from multiple tools, Leadwerks doesn't support a lot of the content created by those tools ..its rather annoying and causes extra work for the people that like using Leadwerks and those tools.

  • Upvote 2

Threadripper 2920X Gen2 CPU(AMD 12-core 24 thread) | 32Gigs DDR4 RAM | MSI Nvidia GeForce RTX 2070 Stock OCed | ASRock X399 Professional Gaming Motherboard | Triple M.2 500Gig SSD's in Raid0

Windows 10 Pro | Blender | Paint.NetWorld Machine | Shader Map 4 | Substance Designer | Substance Painter | Inkscape | Universal Sound FX | ProBuilder | 3D World Studio | Spacescape | OpenSky | CubeMapGen | Ecrett Music | Godot Engine | Krita | Kumoworks | GDScript | Lua | Python | C# | Leadworks Engine | Unity Engine

 

Link to comment
Share on other sites

And, how are you so sure there's only 'a handful' of SD users? It's perhaps because LE doesn't support it that you don't see much SD created content.

.

If it makes you happy to think that so then so be it. Makes not much difference to me. But I am willing to bet that it is a small percentage when comparing those that own SD versus those that do not when looking at the total leadwerks user group. Price alone will almost guarantee that when they can use a free or cheap texture editor to make textures that LE will inherently accept right now. But no matter - still seems strange to me that the request is not towards SD instead of Leadwerks since SD is the texture creator. In any case, Josh may be able to resolve it fairly easy.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

All Allegorithmic products are now on a rent to own plan. You spend around less than $20 a month and you can stop that plan any time you want and start again from where you left off, or pay for a few months then pay the remainder off.

 

https://www.allegorithmic.com/products/substance-live

 

I can guarantee with a plan like this in place a lot of people will start to move towards these tools as they are professional quality but at a really affordable price and very fair deal.

 

There is an SDK available that Allegorithmic offer to developers that are making content authoring systems which allow them to implement the benefits of their tools right into their applications and I'm sure that is free to all developers (I could be wrong).

 

I don't want to cause any animosity here, I love Leadwerks I plan on using it for my development of games and I am happy to wait and see if things like this get integrated and I hope they do as I can only see great things from it.

 

But that is my opinion and everyone has the right to express their own opinion smile.png

 

Anyway I found out that Substance Designer exports gray scale images in linear RGB space. I don't know if this is a normal thing or if this helps find the solution in anyway.

 

Whenever I export from Substance Designer I need to export from Photoshop or GIMP in order for Leadwerks to be able to read it otherwise when importing to Leadwerks straight from Substance Designer I get an access violation exception error from Leadwerks.

 

I hope that helps the problem, if not sorry for sharing useless information haha tongue.png

 

Just for the record, I am totally fine with the above workaround and understand if something like this is low priority to fix or even if it doesn't get fixed at all. I can still get my stuff into Leadwerks it's just two extra steps so no big deal. Just wanted to make Josh aware thats all smile.png

  • Upvote 2
Link to comment
Share on other sites

  • 2 months later...

Hi! Just a quick question here. What is the material you use with your decal? Normally we should be able to set a material to any object including decals. So if the material is set to opaque, then logically, it would have a black background.

 

Can you check if you can change the material of the decal to use a material that support transparency?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...