zturtleman / mm3d

Maverick Model 3D is a 3D model editor and animator for games.
https://clover.moe/mm3d
GNU General Public License v2.0
110 stars 22 forks source link

Request to not antialias the Paint Texture image #182

Open Enjay001 opened 2 years ago

Enjay001 commented 2 years ago

When you save an image using the Paint Texture feature, the image produced is resized to whichever size you select and, when doing so, antialiasing is applied during the resize. This can result in the projected panels in the image having blurred edges.

A nice crisp image in the preview: PT01

I know that this output image is unusually small, but that's what the model demanded (and the effect happens to a greater or lesser extent at all resolutions). The white lines are blurred, but that is perhaps not as important as the fact that the edges of the panels are also blurred and semi-transparent. PT02

Given that the main point of the tool is to export an image that shows the location of the UV mapped panels exactly (and the preview in Maverick is nice and crisp), I feel that the antialiasing potentially limits the usefulness of the tool. I realise that outputting to small resolutions without antialiasing could cause blocky looking edges and broken white lines, but I feel that it could be useful - perhaps more useful than an antialiased image.

So, could there please be an option to not antialias the output image from Paint Texture Image?
An option to create an opaque background might also be useful.

Thank you.

zturtleman commented 2 years ago

Saving the image directly uses the preview image so if you manually shrink the paint texture window as small as possible it will be less blurry.

Exporting the default preview size without smoothing to 128x128 end up with dots instead of lines which seems too broken to be useful.

paint-tex-2

Ideally it should be rendered at the specified size. Either changing the displayed widget size or rendering offscreen. I haven't looked into these.

zturtleman commented 2 years ago

You can use Polygons: Filled to simply remove the lines.

Enjay001 commented 2 years ago

Thanks for looking in to this and the further info. I agree (and expected) that below a certain size the lines would start to become broken and not much use without anti-aliasing.

Personally I would still find the ability to only export the blue areas (without anti-aliasing) because, if I'm correct, that should give a pixel-perfect image of which bits of the skin are actually used by the model. Yes?

I'm interested in how you got the image that you posted because, apart from the white dots, that is basically what I was looking for. Is that something that is possible to export now, or was that from your testing?

I wasn't sure what you meant by "Saving the image directly". Do you just mean hitting this button? PaintPic1

Thanks again.

zturtleman commented 2 years ago

I acknowledge getting a clean image is an issue and should be fixed by adding code to rendering the texture at the specified size instead of scaling it. There would be no anti-aliasing or broken lines at any image resolution, just like the preview window.

"Saving the image directly uses the preview image" -> Saving the image (the Save Texture… button) uses the literal image displayed in the window and then scales it to the specified size. If you make the window smaller there is less scaling when exporting 128x128. It's still blurry though because I didn't get the preview to exactly 128x128.

Screenshot from 2022-06-17 19-34-11

paint-tex

(Result of Save Texture… This is unmodified Maverick 1.3.13.)

The image I previously posted changed this line https://github.com/zturtleman/mm3d/blob/53b0d1b33412bddacd65559f41d5511b9050a27a/src/implui/painttexturewin.cc#L238 from Qt::SmoothTransformation to Qt::FastTransformation. This changes the image scaling interpolation from (probably) Linear to None. No anti-aliasing but broken lines.

You can do the same thing by taking a screenshot of the Paint Texture window, cropping the image, and scaling it to 128x128 with no interpolation.

174412980-aa84354f-2308-4598-8afb-9db12448ef9d-128x128 (The image you posted + GIMP: Scale Image to 128x128 with Interpolation: None.)

Adding an option to "disable anti-aliasing" (use Qt::FastTransformation scaling mode) is a hacky workaround that doesn't work with lines enabled (users should resize the window to match the target size as best they can and/or disable lines). If the code is changed so that the image is rendered at the specified size, there would be no image scaling / anti-aliasing and so a "disable anti-aliasing" option would be entirely unnecessary.


When I was working on Maverick 1.3.13, I viewed it as possibly the final release. I plan to make one more Maverick release to fix a rendering issue and include macOS again but beyond that I'm not sure. I haven't been motivated to work on it in the past 5 months and in general I've lost interest in working on it. It remains to be seen if I decide to invest time to try to fix this issue.

Enjay001 commented 2 years ago

Thank you for the input once again. I had thought about simply resizing a screenshot without interpolation. So I can certainly do that if needs be.

It's a shame to hear that work/support for Maverick is drawing to a close, but also completely understandable.

m-7761 commented 1 year ago

Thank you for the input once again. I had thought about simply resizing a screenshot without interpolation. So I can certainly do that if needs be.

It's a shame to hear that work/support for Maverick is drawing to a close, but also completely understandable.

If you want to use it as an editor my fork (https://github.com/mick-p1982/mm3d) makes many improvements. But be warned it's MM3D files only work with itself.