Is it possible and if yes, how can I split a sprite like this ? I've tried offsetting the position and alpha, but either the image stretches or gets skewed. Thanks ^_^ Start https://prnt.sc/q5kpft End https://prnt.sc/q5kns1
Hi, Do you want to actually make that offset of pieces happen in the shader? Or just remove (hide) a triangular piece of a quad? What are you trying to accomplish, it would be helpful to know. But since you're not providing details, I'll guess - Why not duplicate that piece (whatever it is in your game/app/something else) and then create a shader that allows you to render alpha channel that has the triangular piece missing. But there might be better solutions if you told more about your use case, instead of just basically saying "can a shader /Shader Graph do this". And you can't actually split a sprite with shader graph. Anyway, if you can tell more, better suggestions can be made.
I literally want exactly that, to split an image and animate them splitting apart, that's it ^_^ I didn't want to duplicate the image since I will end up with 2 times as many objects than I actually need, but I guess I'll do exactly that, render half of each individually and then animate them.
As I don't know what you are exactly doing, I'd imagine you can have those pieces replaced when needed. You probably don't need (and shouldn't) have every piece pre-fractured? i.e. when an object fractures, you replace that with those two fragments.
@A132LW no need to start twisting my words; you can't generate two sprites is what I meant and you know that.
I also didn't mean splitting as in generating another 2 sprites. Just moving the position of pixels so it gives the impression of two sprites. This is why I mentioned that I didn't want to duplicate the sprite and render them separately so I won't have 2 times as many objects as I need. @A132LW I've eventually did something similar to your solution, except it still doesn't give me the results I need, i will need to keep improving it. Currently I'm offsetting the UVs two times on the same axis but in different directions and then combining the textures and also combining the alpha channels with a gap in between ( I just added a rectangle to the alpha channel ) so the middle part won't be displayed. Current problems : - some of the alpha from the left texture interferes with the right one - currently works only by splitting it on one axis, need to figure out a way to do this on any axis ( I need to rotate textures, no idea how to do that currently in shadergraph ) - limited to the size of the sprite ( I can make the sprite bigger, so no problem there )
Rotate the UVs (https://docs.unity3d.com/Packages/com.unity.shadergraph@7.1/manual/Rotate-Node.html) I think the masking should fix that. I don't have time right now though, so I can't really say. Do you mean when they overlap?