#Where to learn how to write sprite shaders?

1 messages · Page 1 of 1 (latest)

jolly kindle
#

I've used shadergraph for a while, but it's feeling limiting to me now, so I'd like to start learning how to write shaders myself instead of relying on shadergraph to write the code for me. Though I've searched for a while I can't find a single tutorial for making these shaders that don't already assume you know how sprite shaders work, so I've come here looking for help with finding one.

limber arch
jolly kindle
#

I can't figure out how to get the textures to apply like at all

limber arch
# jolly kindle 1st is in game scene 2nd is material preview on a plane and 3rd is the shader it...

Assuming the first screenshot is sprite renderer, then it's either:

  • you assign the texture(sprite) in the renderer, but the shader doesn't use the same naming conventions for the albedo that the sprite renderer sets. So an empty white default texture is assigned to that property instead.
  • you do name it properly, but don't assign it via the sprite renderer(but via a material), at which point the sprite renderer overrides it with whatever is assigned to it(which is probably nothing, so a white empty default texture is assigned instead).

Basically, it seems like an issue with misunderstanding the sprite renderer, rather the shader.

#

Looking at the main texture name, it seems to be the second case.

jolly kindle
#

That was on an image but here it is on a square tinted red

limber arch
#

It's like you ignored my message entirely...

jolly kindle
#

you do name it properly, but don't assign it via the sprite renderer(but via a material), at which point the sprite renderer overrides it with whatever is assigned to it(which is probably nothing, so a white empty default texture is assigned instead).

#

it is assigned

#

I meant like in the material itself

limber arch
#

Take a screenshot of the sprite renderer

jolly kindle
limber arch
#

Take a screenshot of the Square sprite.

jolly kindle
limber arch
#

I mean the sprite asset, it's texture.

#

Because that's what your shader ends up sampling.

jolly kindle
#

built in unity

limber arch
#

Well that's the issue. As I said, you're misunderstanding how the sprite renderer works/supposed to work.

#

If you want to assign the texture in a material, don't use a sprite renderer.

#

Otherwise, the albedo has to be in the sprite.

jolly kindle
#

oh yeah that makes sense

#

forgot about that