Giter VIP home page Giter VIP logo

Comments (10)

darksylinc avatar darksylinc commented on August 21, 2024 1

I'm uploading U8V8 & U16V16 samples for reference. Both are set to +1.0; +1.0 which should show yellow (if B <= 0) or white (if B = 1)

http://www.mediafire.com/download/18b4dx8cgdfhhvq/texconv_UV8V8_U16V16.7z

from directxtex.

AllianceDarkSylinc avatar AllianceDarkSylinc commented on August 21, 2024 1

Sure, here is a better real world test:
https://www.mediafire.com/?cgu0auubfcdtvge
It's a normal map in U8V8 format, and for comparison its reference in RGB.

It was somewhat popular back then in DX9 days for normal mapping when BC5 was not around and DXT5 hack provided too many artifacts or was too cumbersome; and certain GPU HW could save you the unsigned to signed conversion in the shader.

from directxtex.

walbourn avatar walbourn commented on August 21, 2024 1

I can see the following mappings working, but I only have test content for one case. If you can dig up more, that would be a great help:

  • D3DFMT_V8U8 -> DXGI_FORMAT_R8G8_SNORM (have your test for this)
  • D3DFMT_Q8W8V8U8 -> DXGI_FORMAT_R8G8B8A8_SNORM
  • D3DFMT_V16U16 -> DXGI_FORMAT_R16G16_SNORM (I have your test for this, but a real-world one would be better)

Note I handle D3DFMT_Q16W16V16U16 (which was stored as a FourCC of 110) as DXGI_FORMAT_R16G16B16A16_SNORM

I don't think there's a sensible general conversion for the old DDPF_BUMPLUMINANCE formats, and there's no DXGI equivalent for a mixed format like D3DFMT_A2W10V10U10. Xbox One does have DXGI_FORMAT_R10G10B10_SNORM_A2_UNORM which would work for D3DFMT_A2W10V10U10 but again I don't have a test DDS for this one lying around either.

from directxtex.

walbourn avatar walbourn commented on August 21, 2024

Can you please attach some example DDS files here? Also, do you have any 'real-world' examples rather than just test ones with a single value?

from directxtex.

walbourn avatar walbourn commented on August 21, 2024

Note that the DDPF_BUMPDUDV (0x00080000 ) and DDPF_BUMPLUMINANCE (0x00040000 ) are for old specialized bump-mapped formats which don't really apply to modern Direct3D .

DDPF_BUMPDUDV  D3DFMT_V8U8, D3DFMT_Q8W8V8U8, D3DFMT_V16U16, D3DFMT_A2W10V10U10
DDPF_BUMPLUMINANCE  D3DFMT_L6V5U5, D3DFMT_X8L8V8U8

I'm curious to your usage case for DDS files in these legacy formats. Are there tools that still generate these old DDS formats or are you trying to reuse old content?

from directxtex.

AllianceDarkSylinc avatar AllianceDarkSylinc commented on August 21, 2024

Interesting. They were likely associated with normal mapping since that was the primary use for U8V8 format.

But these formats were still useful for tangent space normal mapping (since they were signed formats) and not just the old fixed function bump mapping. These formats map 1:1 to R8G8_SNORM & R16G16_SNORM

There was even a CxU8V8 format that would automatically calculate B = 1 - sqrt( R_R + G_G ) for you. However it was discouraged by vendors because they said they just used a 32-bit texture instead of doing the calculation on the fly; so it was better to do it manually in the shader with a U8V8.

They're quite convenient even today since they can work interchangeable with BC5 (both are signed, both map to RG channels); though admittedly this feature is most useful in texconv for converting old uncompressed assets into BC5.

from directxtex.

AllianceDarkSylinc avatar AllianceDarkSylinc commented on August 21, 2024

Indeed to all of that. There are no more signed formats as far as I know, except for CxU8V8 which is a little more annoying to support because it needs to map to DXGI_FORMAT_R8G8B8A8_SNORM and then manually fill the blue channel with 1 - sqrt( r_r + g_g )
Also it was barely used to be bothered.

I don't see where DDPF_BUMPLUMINANCE in being used, and those mixed formats don't really have a DXGI equivalent (except the Xbox One case you mention).

If you want/need more DDS test cases let me know, I have more.

from directxtex.

walbourn avatar walbourn commented on August 21, 2024

D3DFMT_V8U8 is covered with your test case. A real world case for D3DFMT_V16U16 would be great, as would one for D3DFMT_Q8W8V8U8.

If you happen to have a real-world test of D3DFMT_CxV8U8, I can look at that conversion but as you note, it was not used much.

D3DFMT_A2W10V10U10 I think is even more problematic because it suffers the same problem as D3DFMT_A2B10G10R10 and D3DFMT_A2R10G10B10 for which D3DX used the wrong pixel format masks. I think it's safe to ignore this one.

I initially ignored all these as legacy, but they are all easy enough to implement as long as I have a way to validate it. D3DX9 would load these formats, but D3DX10 and D3DX11 would not load DDS files that were DDS_DDPF_BUMPDUDV or DDS_DDPF_BUMPLUMINANCE which is where I originally took the list from.

from directxtex.

walbourn avatar walbourn commented on August 21, 2024

Fixed with commit a121bc5

from directxtex.

darksylinc avatar darksylinc commented on August 21, 2024

Whoa!!! That was fast!!! Thank you!

from directxtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.