microsoft/DirectXTex

texassemble can not make v-cross layout images properly.

matyalatte opened this issue · 4 comments

Hi, I used texassemble to make cross layout images from cubemaps.
(As an example, I'll use this cubemap from another git repository.)

h-cross command worked fine for my cubemaps like this.
Screenshot (770)

But I noticed v-cross will put some faces with wrong rotations.
Screenshot (771)

Is it a bug? (I mean, texassemble should use FlipRotate function for v-cross?)
Or there are some dds textures for v-cross layout and others are for h-cross?

I intended to use the layouts as shown here.

//      posy
// negx posz posx
//      negy
//      negz

Instead I ended up using:

//      posy
// posz posx negz
//      negy
//      negx

I can fix it. That said, the actual layout is of course arbitrary.

Thanks for your reply.
So, your plan is to change offsets?
Will you add a way to rotate negz by 180 degrees?
Or any chance I can contribute?

I think there should be an option for negz like this.

if (index == 5 && dwOptions & (uint64_t(1) << OPT_ROTATE_NEGZ)) {
    std::unique_ptr<ScratchImage> timage(new (std::nothrow) ScratchImage);
    hr = FlipRotate(*img, TEX_FR_ROTATE180, *timage);
    if (FAILED(hr))
    {
        wprintf(L" FAILED Rotating negz image (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
        return 1;
    }
    hr = CopyRectangle(*timage->GetImage(0, 0, 0), rect, *dest, dwFilter | dwFilterOpts, offsetx, offsety);
}
else {
    hr = CopyRectangle(*img, rect, *dest, dwFilter | dwFilterOpts, offsetx, offsety);
}

The new v-cross-fnz command in the attached PR should do what you want:

t

Thanks for the fix!
Yeah, it worked with my cubemaps.