3Dc/BC5 support
by Timmy01 · in Torque 3D Professional · 07/12/2014 (5:33 am) · 12 replies
Hi guys,
I added very basic support for 3Dc/BC5 (en.wikipedia.org/wiki/3Dc) normal maps while i was writing this blog www.garagegames.com/community/blogs/view/22776. This is a default normal map format used in a lot of other AAA+ engines.
Source:
github.com/rextimmy/Torque3D/tree/bc5_support
Details:
These changes also contain the DXT5NM height in the red channel fix i made github.com/rextimmy/Torque3D/tree/dxtnm-parallax-fix. Don't stress, if you don't want to pack height data this way than simply ignore it, it will not have any effect at all. Also, BC5 does not support height.
Problems:
There is currently no fall-back options nor is there any checks if hardware even supports BC5. It is for this reason i have not made an official PR for it. I'll try and fix this up in the coming weeks, but if you have time it would certainly help if it was more thoroughly tested for problems.
Hardware support for BC5 in D3D9
All D3D10+ capable cards plus:
Geforce 6+
Radeon 9500+
Intel G45+
Photoshop NVidia DDS plugin 3Dc:

Gimp DDS plugin:

I added very basic support for 3Dc/BC5 (en.wikipedia.org/wiki/3Dc) normal maps while i was writing this blog www.garagegames.com/community/blogs/view/22776. This is a default normal map format used in a lot of other AAA+ engines.
Source:
github.com/rextimmy/Torque3D/tree/bc5_support
Details:
These changes also contain the DXT5NM height in the red channel fix i made github.com/rextimmy/Torque3D/tree/dxtnm-parallax-fix. Don't stress, if you don't want to pack height data this way than simply ignore it, it will not have any effect at all. Also, BC5 does not support height.
Problems:
There is currently no fall-back options nor is there any checks if hardware even supports BC5. It is for this reason i have not made an official PR for it. I'll try and fix this up in the coming weeks, but if you have time it would certainly help if it was more thoroughly tested for problems.
Hardware support for BC5 in D3D9
All D3D10+ capable cards plus:
Geforce 6+
Radeon 9500+
Intel G45+
Photoshop NVidia DDS plugin 3Dc:

Gimp DDS plugin:

About the author
#2
07/14/2014 (8:52 am)
This Dxt5_nm fix is awesome Timmy! Do you have any basic instruction on using it? CrazyBump allows us to save a normal map with displacement but it doesn't have a dds format option. I'd love to use the 3Dc option too if it had a fallback.
#3
I am not 100% sure how CrazBump is saving it's normal map with displacement, does it shove the displacement into the alpha channel or does it save it separately? Doesn't make a big difference actually, the procedure is the pretty much the same.
Using Photoshop (or Gimp) with a RGBA texture that has height in the Alpha channel:
To save the height with dxt5nm we have to swap the red channel with the alpha channel. Basically we want displacement put into the red channel and the data that was in the red channel into the alpha channel. Leave the green channel as is and paint the blue channel a solid color like black (this part is entirely optional but will result in slightly better results/quality). Now just save this image as a dxt5 file, no need to select dxt5nm format as we have made it ourselves. Now it's happy days :-)
If the displacement is coming from a second image file, instead of swapping the red and alpha channel like above just copy the red channel to alpha in the normal map image(add the alpha channel if none is present) and copy the displacement from the second image to the red channel of the normal map image.
It's a bit of a pain in the ass having to manually swap stuff around, i'm sure some of this could be automated by scripting.
07/14/2014 (3:56 pm)
@Scot:I am not 100% sure how CrazBump is saving it's normal map with displacement, does it shove the displacement into the alpha channel or does it save it separately? Doesn't make a big difference actually, the procedure is the pretty much the same.
Using Photoshop (or Gimp) with a RGBA texture that has height in the Alpha channel:
To save the height with dxt5nm we have to swap the red channel with the alpha channel. Basically we want displacement put into the red channel and the data that was in the red channel into the alpha channel. Leave the green channel as is and paint the blue channel a solid color like black (this part is entirely optional but will result in slightly better results/quality). Now just save this image as a dxt5 file, no need to select dxt5nm format as we have made it ourselves. Now it's happy days :-)
If the displacement is coming from a second image file, instead of swapping the red and alpha channel like above just copy the red channel to alpha in the normal map image(add the alpha channel if none is present) and copy the displacement from the second image to the red channel of the normal map image.
It's a bit of a pain in the ass having to manually swap stuff around, i'm sure some of this could be automated by scripting.
#4
Supply a RGBA normal map that has height/displacement in the alpha channel and convert it to the appropriate dxt5nm format. Than all you have to do is is save it using the nvidia plugin as dxt5 and it's done, no manually moving channels around.
07/15/2014 (5:06 am)
If anyone finds it useful, i'm happy to write a photoshop script that can automate the following:Supply a RGBA normal map that has height/displacement in the alpha channel and convert it to the appropriate dxt5nm format. Than all you have to do is is save it using the nvidia plugin as dxt5 and it's done, no manually moving channels around.
#5
Thanks so much for all of your work in this area man, we desperately need it! Look at what we have to compete with, if we can get to this point in the next few months we'll really have something!
07/15/2014 (7:29 am)
Yes, CrazyBump puts it in the alpha channel. We're using it for terrain mainly. I would definitely be interested in the script for PhotoShop. We could then create the normal/displacement in CrazyBump and convert it to dds in PhotoShop and reliably use it for all kinds of materials.Thanks so much for all of your work in this area man, we desperately need it! Look at what we have to compete with, if we can get to this point in the next few months we'll really have something!
#6
Usage is simple, run the script and it will do the conversions on the current image. When it's done just save it as a regular dxt5 texture (not dxt5nm). Only works if the current image has 4 channels and height/displacement is in the 4th channel (i.e alpha). Let me know any problems, it has no license so do as you please with it. I have only tested it on CS5
07/15/2014 (8:18 pm)
Script is here narivtech.com/downloads/dxt5nm_displacement.zipUsage is simple, run the script and it will do the conversions on the current image. When it's done just save it as a regular dxt5 texture (not dxt5nm). Only works if the current image has 4 channels and height/displacement is in the 4th channel (i.e alpha). Let me know any problems, it has no license so do as you please with it. I have only tested it on CS5
#7
07/16/2014 (7:40 am)
Thanks a lot Timmy. You're a gentleman and a scholar!
#8
07/17/2014 (6:01 pm)
@Timmy - Have you figured out how to make and use the detail map slot in the materials editor yet for models? I've tried 100 combinations and can't really get a good detail map.
#9
@Scot
The detail map is similar to the detail map on the terrain, it is for big surfaces.
A good solution I found is, you can create basic noise texture and add it as detail map, it will produce faked sharpness on your texture, works almost on everything.
07/17/2014 (6:15 pm)
A script is ideal, I hope someone will do a script for gimp also.@Scot
The detail map is similar to the detail map on the terrain, it is for big surfaces.
A good solution I found is, you can create basic noise texture and add it as detail map, it will produce faked sharpness on your texture, works almost on everything.
#10
07/17/2014 (6:16 pm)
@scot: What in particular are you trying to do with em? Know for myself, I've used things like .1 scaled detail maps to break up tiling for instance. (In theory of course, you're supposed to do that in reverse, with the bland general material and the higher rez detial map. In practice... rarely works out that way.)
#11
07/17/2014 (6:31 pm)
Thanks for the quick responses. I've just not found a reliable method to produce a good detail map from a diffuse every time. I've tried high pass filter in PS, I've tried various combo's of the red and green channels from a couple of tutorials on the net. I don't know if it's just a matter of tweaking and re-tweaking or if there's a way to produce one every time step by step. Should it be DXT1? Etc etc.
#12
07/17/2014 (7:06 pm)
I can't really talk about the methods of creating the details maps (not my area at all), the end format should be the minimum quality you are happy with. DXT1 will give the worst compression results but will use half as much memory as say a DXT5 texture would. If you are happy with DXT1 results than by all means use it and save that memory, if not step back and try DXT5 and if that is no good,than your only other option is uncompressed (nasty)
Torque Owner Nils Eikelenboom
Studio DimSum
Looking at the hardware support list I think it's pretty safe to use it.