Jump to content

DDS Texture Issue?


Recommended Posts

See below. I've attached the texture too. For whatever reason, 3DS sees the texture fine, but paint.net and babylon show it as a transparency so my models are invisible in the scene.


Does anyone know what's going on with this? Is it something that babylon can account for in the DDS reader?



MAX File:







In 3DS Max:




In Paint.net



Link to comment
Share on other sites

So I looked at it in the AMD's The Compressonator utility. It says the image has no alpha channel but it also says it's encoded as DXT3 - which does store alpha (seems odd to use DXT3 if your texture is meant to be opaque/not use the alpha channel). So I enabled the alpha channel in the utility and mousing over the image the colour sampler indeed shows alpha values that look like those shown in your 2nd screenshot.

TLDR: image has alpha data which looks like the 2nd screenshot but may have meta data some tools are using to ignore/not display the alpha channel data. Recommendation (from non-Babylon person) don't use DXT3 if you don't have need of an alpha channel, use DXT1 instead

Link to comment
Share on other sites

Problem is that these are from a dead game that never made it out of beta, so they are what they are. I think the alpha channel was used for pallet dyes to customize the color of the armors.


Is there any way for babylon to support the DXT3 and DXT5 *.DDS file formats? I would think that textures with alpha channels would be pretty common. This would save me the time of redoing all the textures on a thousand plus models...

Link to comment
Share on other sites

Problem is that these are from a dead game that never made it out of beta, so they are what they are. I think the alpha channel was used for pallet dyes to customize the color of the armors.

Sure or it was a gloss map or something.


Is there any way for babylon to support the DXT3 and DXT5 *.DDS file formats?

I thought we'd established it was working the way it should, just not the way you want (ie. Babylon.js seems to be displaying the alpha channel as opacity, that seems to me to be a reasonable default(?) behaviour for an engine to do)


I would think that textures with alpha channels would be pretty common.

I suspect that's actually an understatement :P


This would save me the time of redoing all the textures on a thousand plus models...

Sounds like a poor excuse to me, do you expect to use thousand of files optimised for a different game / game engine / hardware generation (I'm guessing the game the assets came from was well over 10 years ago?) without any modification/adaptation?

You'll have to re-encode the textures anyway if you want mobile support as mobile GPUs by and large don't support S3 texture compression (it's a patent licensing thing between GPU manufacturers if I recall correctly)

I also seem to recall the texture looking not to have a mipmap when I looked at it, you can't generate mipmaps for compressed textures on the fly and you will probably want mipmaps for texture minification unless you are counting on the textures being pretty much always displayed magnified.

Anyway the advice that you had the wrong compression was based upon your earlier assertion that the textures shouldn't have opacity, if you want / will use the channel there's no reason not to keep it (the data is 50% of the texture size, so it just seems illogical to me to go to the trouble of using compressed textures but then spend half the data on a channel if your game won't use)

It seems to me that what you actually wanted to ask has nothing at all to do with compressed textures nor support for the DDS file format.

Instead you want to know how to tell Babylon.js to use the RGB data from your texture as the diffuse colour but ignore the alpha data present and just draw pixels opaquely (you'd probably be better off posting your code / a playground example than your texture file/s)

You also possible want to know how to use the same texture as a gloss map or some other kind of map, but only use the alpha channel.

Link to comment
Share on other sites

Yes, it's a 10 year old game, and yes I agree that it would be logical for the alpha layer to be the root problem with why my objects are showing up transparent. We have spent many years building tools to extract these models in their entirety from the original client. We even cracked the thermidia obfuscated and vendor modified *.unr file format to extract map object coordinate locations for all the maps. The character model is just our next step. Our intent is to render everything as it was and get everything working. Then we will optimize as needed.


However, the reason why I brought all this up in the first place is because the models renders perfectly fine in 3DS Max and UE Viewer, and therefor the information as to how to handle the transparency already exists within the model itself / Max environment. With this reasoning, I would have to assume that something in the export script is not translating that information properly, or babylon cannot currently handle these particular models the way 2k4 and 3DS Max would expect them to be handled. This is the first time that I have seen this happen, but that makes since as they would have spent more time making the player character "pretty" than using complex textures on the environment. The only exception to this is the terrain textures that we have not been able to find a clean way to implement. That may well be another discussion to have / ask for guidance with though. I will attach the max file to the first post.

Link to comment
Share on other sites

  • 2 weeks later...

In fact, for more efficiency, if you bake the opacity inside the diffuse channel, Babylonjs turns the opacity process into a 1bit story (visible/not visible). If you want to be more accurate (with a nice 8 bit treatment) you should add a real opacity channel (in 256 shades of grey).

By the way, DDS is efficient, support a lot of things, but real editing tools are outdated (especially plugins for Photoshop), and it is not a native web format. My 2 cents...

Link to comment
Share on other sites

  • 3 weeks later...

I think I found the issue, but it's not currently solvable by simply changing the texture format.
 Simply put, Unreal Engine and several other engines use a "Layered Materials" system to build complex textures that would otherwise be very complicated to implement in a standard texturing application.



I'm hoping that you have some insight as to how this could and should work in Babylon. I would imagine that some changes would have to be made to the *.babylon file format spec to account for these kind of textures, or maybe something needs to change in the 3DS exporter to have them accounted for in an already existing format spec? This is where I'm at a loss. My project is essentially dead in the water (and anyone else wanting to export some things from Unreal Engine files) if there's no way for Babylon to support these kind of textures.

Unreal appears to use the same kind of texturing for their terrains. They use a height map for the structure, and then a layered material for breaking out texture types with layers of fixed alpha maps then tiled textures piled up to make all the pieces of the map. More like a controlled and defined version of the worldmonger demo that's not based on elevation. So they could define a road in one alpha map and combine it with the road texture, then rocks alpha and a rock texture, etc and it covers all uses of that texture across the whole map that the fixed alpha map is assigned to.

I'll help in any way I can with files or examples to whomever needs them. If this is something that just isn't ever going to be done, then that's ok too, but just let me know. No reason to keep trying to convert this project from Unreal to Babylon if it's physically impossible to do so.

Link to comment
Share on other sites

That's pretty cool! kind of a different, but more effective version of the same thing. You can assign a lot of colors instead of tons of layers.

I guess the question then would be, can this be done to objects other than just terrain? I wonder if maybe there could also be a version that doesn't blend the materials, but just defines the up to 16,777,216 different possibilities? I don't think the armor on my models blends things so much as layers all the pieces, and I'm sure that some may have more than 4 parts. I'll have to see just how complex they get...

Link to comment
Share on other sites

Thanks Luaacro, but no need to do that right now. My current issue is more needing to be able to layer all the texture materials and not blend them together. Your solution proves that it's possible to account for, but it doesn't allow for 3DS to export the types of layered textures into something that Babylon can utilize. I'm pretty confident that we have some models with more than 4 layers of textures.

We would either have to hope that someone would add in support for this, or rebuild every character model asset by hand before it's usable. This is honestly not feasible with 1,000+ models to modify and re-texture, so we will do 1 complete set of equipment to test with for now until a better solution may come along later.

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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...