InkPainter icon indicating copy to clipboard operation
InkPainter copied to clipboard

Fill status

Open lilfighterr opened this issue 7 years ago • 6 comments

Hi,

Thanks for this wonderful asset. I'm trying to create a scenario where a texture needs to be painted over to complete a level. Is there a way to determine how much of the texture is painted? For example, I'm looking for something like a percentage that indicates if a texture has been 40% covered by paint.

Thanks.

lilfighterr avatar Dec 21 '18 19:12 lilfighterr

@lilfighterr Please let me know if you figured out how to know paint progress ?

activegear avatar Mar 11 '19 13:03 activegear

Any update on that? @activegear @lilfighterr ?

PatrickYns avatar Apr 18 '19 13:04 PatrickYns

@lilfighterr @activegear @PatrickYns Hi! I’m also trying to figure out how this would be possible? Did anyone of you come up with any solutions or ideas?

Jyri-K avatar Jan 21 '20 18:01 Jyri-K

@Jyri-K yes, I've managed to do this with quite some effort. My main inspiration was a Unity project based on Splatoon called Splatunity (or so I recall) The logic behind it was that we would take the original texture image, and constantly compare it to the newly rendered one. We would have to compare pixel by pixel if it matches, and that proved to be quite heavy performing - as a 2048x2048 image would require you to do 2048x2048 operations everytime you wanted to get a percentage colored.

To further optimize it, we saved the original texture image into a duplicate version that's 16x16, and on every compare function, we would first get the new texture, duplicate it into a downsized version that's also 16x16, and in that case we ended up with 256 operations, which was in theory around x16000 times faster.

We could smoothly do a texture comparison several times every second, all while having a stable 60 FPS on a mid-end mobile device.

PatrickYns avatar Jan 21 '20 19:01 PatrickYns

@Jyri-K yes, I've managed to do this with quite some effort. My main inspiration was a Unity project based on Splatoon called Splatunity (or so I recall) The logic behind it was that we would take the original texture image, and constantly compare it to the newly rendered one. We would have to compare pixel by pixel if it matches, and that proved to be quite heavy performing - as a 2048x2048 image would require you to do 2048x2048 operations everytime you wanted to get a percentage colored.

To further optimize it, we saved the original texture image into a duplicate version that's 16x16, and on every compare function, we would first get the new texture, duplicate it into a downsized version that's also 16x16, and in that case we ended up with 256 operations, which was in theory around x16000 times faster.

We could smoothly do a texture comparison several times every second, all while having a stable 60 FPS on a mid-end mobile device.

Thanks for the reply! Sounds like a promising solution, will have to give it a go :)

Jyri-K avatar Jan 21 '20 20:01 Jyri-K

Sorry for being a super necromancer but i am using this tool to paint 3D cube in my project. I am trying to check if painting is completed by comparing the "imageContentsHash" of textures. I saved painted texture and I'm comparing current texture (the texture is getting painted) with the texture i saved by using "imageContentHash". But i didn't manage to make it work. I was wondering if someone here can give me suggestions.

Here is the doc page of imageContentHash: https://docs.unity3d.com/ScriptReference/Texture-imageContentsHash.html

Thanks for any answer, again i am really sorry. Didn't wanted to open a new issue for this because it is already created before.

iozsaygi avatar Jul 30 '21 19:07 iozsaygi