- Home /
Sprites consisting of two packed textures
Hi,
I'm creating a simple shader for an in progress painting. The base texture is treated as an alpha mask, and the secondary texture is the full painting.
I am referencing some pretty big png files, and using Unity to pack the opaque areas into one atlas. Using unpacked files I can simply share the UVs in the shader, but once the sprites have been packed, the UVs are no longer shared.
The question: How do I access the UV coordinates for the second (also packed) texture from a custom sprite shader. I can only seem to access the first set of UVs (pointing correctly to the packed base texture)
Below is my current input to the vertex shader.
struct vertin {
float4 vertex : POSITION;
float4 uv_MainTex : TEXCOORD0;
float4 uv2_Unmasked : TEXCOORD1;
fixed4 color : COLOR;
};
The rest is just regular vertex and fragment shaders, using the alpha from base and color from second texture.
Edit: Realized that I'm not targeting the secondary sprite, but rather the texture containing it. Is there a way to target two sprites? Or would I need to create my own sprite renderer?
Your answer
Follow this Question
Related Questions
Accessing a second texture's offset in a modified sprite shader 0 Answers
Efficient way to keep a fixed rotation for sprite? 0 Answers
Sprite shader relative UV's 0 Answers
How to do a sprite shader with masking for individual sprites ? 1 Answer
Shader and Texture Scrolling depending on Direction 1 Answer