Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits)

Looking into this! Looks like the clamp arithmetic might be somewhat off somehow, or the incoming coordinates are being handled wrong. How are you generating your UV texture? It might be handling the UV coordinates differently, such as by having the 0,0 pivot being the top-left rather than the bottom-left. Causing the Y axis to be flipped.

You say that if the UV texture is smaller than the sampled texture, that it gets cropped. Can you explain this a bit? Is this still in relation to the `clamp` arithmetic?

(1 edit)

I would say that B.Map (beta) works as expected regarding this issue. I'm generating my UV texture using Shadron app and GLSL shaders, they are in RGBAF32LE pixel format TIFF file. Also regarding cropping, the B.Map (beta) works flawlessly, here in PixMap it seems that base resolution from which the texture normalized coordinates are calculated is taken from the STMap rather than from the sampled texture.

Only issue not solved in B.Map (beta) is that it crashes when the layer with applied effect is pre-composed, while the effect is enabled.

I pushed a new build of PixMap with some fixes addressed!

It should now be in better parity with B.Map with these fixes too. Lemme know how it goes!

(1 edit)

Thank you, seems to be more stable, but the tiling is pinned to corner which messes up scaling of STMaps, compared to B.Map where it is pinned to center and works OK. Also it flips the texture vertically.

(+1)

I think the vertical flip you are experiencing is due to the (0,0) pivot of your UV map being at the bottom left corner rather than the top-left. The darkness of the pixels at the bottom-left here indicate this is where your origin is and is why your image is flipped vertically due to it using OpenGL conventions(Y is Up rather than Y is Down):

OpenGL is the only graphics API that defines its texture-space like this. While DirectX/Vulkan/Metal/After-Effects/etc define the top-left corner of their texture-space as the 0,0-origin.

My unit tests have PixMap and B.Map behaving the same, except for how their scale operation works(B.Map scales about the center (0.5,0.5) while PixMap scales about the origin (0.0, 0.0). In my next update I'll can tweak the texture scaling-operation so that they both scale about the center!

(+1)

The changes have been made! See:

https://wunkolo.itch.io/pixmap/devlog/844001/bmap-compatibility

Fantastic! Works very great. Thank you ☺

(1 edit)

Great work, anyway there's one last thing wrong with PixMap compared to B.Map, it's the coordinate mapping. The B.Map correctly maps UV coordinates to pixel position, while PixMap does not take account for the half-pixel offset in the UV space, as the center of first pixel is 0.5/Dimensions.

The correct formula for mapping pixel index coordinates XY starting from [0, 0] to UV is [U, V] = [(X+0.5)/Width, (Y+0.5)/Height]
And for mapping of UV to XY is [X, Y] = [U*Width-0.5, V*Height-0.5]. Width and Height are the dimensions of sampled texture as 1920x1080.

Basically the UV coordinates start from edge to edge, that's why first pixel center has a value of 0.5/dimensions and pixel coordinates start from the center of first pixel.

(2 edits) (+1)

Yep! I get ya. I haven't gotten to it just yet due to some other priorities right now for this time of the year but I'll get to it! In this case, After Effect's built in sampler function considers the origin of the pixel at the top-left of the Texel. And it just needs a (0.5, 0.5) texel-offset (0.5/width,  0.5/height).

https://ae-plugins.docsforadobe.dev/effect-details/tips-tricks.html?where-s-the-center-of-a-pixel#where-s-the-center-of-a-pixel

https://ae-plugins.docsforadobe.dev/effect-details/graphics-utility-suites.html#...

Deleted 32 days ago