I just start to study shaders, and AmplifyShader Editor, and don’t know some basics in both, so may be there are simple solution, but I don’t know where is some checkbox…
I have outline shader, which is works on common principle: offset texture up-down-lef-right, add to main texture - and it’s done. Shader works perfectly, it can coloring, thickness, all that you need.
It works with spriteRenderers.
But I use Unity SpriteAtlases in project, its created automatically (so it is not prepared texture sheet), sprites in atlas has different sizes etc. I can’t remove atlases by list of reasons, so…
When atlas is builded (in runtime), shader starts to work with all atlas texture instead of single sprite. And there is a list of problems.
- Outline thickness calculates from atlas size, not single sprite. It is percents, so thick outline on single sprite converts to booold outline.
- If atlas is not square (and I have such atlases), outline is not steady (uniform?..) It has different thickness on with and height.
- And most important. Sprite in atlas is surrounded other sprites, and wher shader do its offsets, other ofsetted sprites is drawed on target sprite. I added some free space on target sprite, I setted padding in atlases on maximum - it doesn’t help.
First I tried to dig “how to render only part of all atlas texture”, but then I thought - SpriteRenderer already rendering part of texture. So I think in is not right direction. Though I can horribly mistake. (And I can get part of textture, I founded solution, and I will can develop this idea further if need).
Then I think about nodes in shader editor. I thought - may be I can manipulate offset of only part of texture? Such as: apply offset to some sample of texture (which looks like single sprite); cast this part somehow???
Or apply offset to UV, not texture; but in ASE offset node input takes only texture for offset. (Shader graph offset node, through, takes UV).
I’m stucked, and can’t understand basic principles; may be it is easy (though I think I would founded this in google, if it was simple…).
I need help with understanding in first place. Thank all who can clear this things