gasiljourney.blogg.se

Sprite master
Sprite master






sprite master

So far, I fixed the issue just by adding 0.5 to all position nodes outputs. However, I have the same result in another scene, where I have multiple cylinders and sprite (some cylinders scaled-down, some scaled-up, and one at 1 scale). The cylinder I showed, is indeed scaled down. Scene (0,0,0) is actually off-screen a bit to the left/bottom. It is only when a second sprite (using the same material) is introduced in the scene that it stops working in object space.Īlso, in the images I showed, all objects are away from world origin. In other words, it will works as I would expect.

#Sprite master full#

In object space, it will lerp from top/bottom of the object and not the world, in the world, it will lerp considering the full world view. If I have a single sprite on the scene, not at world origin, switching the node position in the shader graph between wold and object space, will display different results. But I do see differences between object and world space, and none of the objects is at the origin. With an atlased sprite all bets are off as the UVs are where ever that sprite is in the atlas.Ĭlick to expand.Hi bgolus, thank you for your reply. UVs are generally going to be in a 0.0 to 1.0 range for a sprite renderer mesh using a non-atlased sprite. The short version is you don’t want to use position for this. Put two cylinders in there and that might change as Unity might batch them!

sprite master

It’s range is -1 to 1 since it does have an object space that’s not just the same as world space. It’s 2 units tall, and you’re scaling it down to 50% on its y axis so it’s the same height as your 1 unit tall sprite. So your center sprite, because it’s at the world origin, and is presumably 1 unit tall, has a y position range of -0.5 to 0.5, since the bottom vertices are 0.5 units below the world origin. If you flip the position node between Object and World you won’t see it change for sprites, but it will change for regular meshes (as long as they’re not being statically or dynamically batched, in which case they too are rendering meshes already in world space). The rendered mesh used by sprites is always generated in world space. The issue is sprites don’t have an “object space”. The tech level for me to be able to debug the shader and read/print the actual values the position node reports is far above my ability.Ĭan anyone tell me what I am doing wrong? and/or what are the expected values of the Position Node in object space? HOWEVER, if I manually set T to 1, pure green is correctly displayed in the sprite.Īfter banging my head on this for many hours, I am starting to suspect the position node is NOT returning values from 0 to 1 for sprites. Running a test scene, the colours I see on the sprite are like that. Using the 2D Unlit Sprite master, I take the Note Position, in Object space, split for G channel, and using that as T, I lerp from pure Red (1,0,0) to pure Green (0,1,0).Īs you can see the lerp never reaches Green. However, I am still stuck on the first basic step, a simple lerp from top to bottom, but I am starting to suspect is it not me, but it is Unity that is not working correctly. I am trying to make a gradient for sprites where the colour lerps from the centre colour to the adjacent sprite colours.








Sprite master