AlexanderOcias / UnityPixelArtCamera

Easy pixel art camera rendering in Unity
120 stars 12 forks source link

Support for URP and Post-Processing? #7

Open RevengerWizard opened 3 years ago

RevengerWizard commented 3 years ago

Is this repository still alive?

I know that now you don't use Unity, but I got most of the feature work with URP, even if now the UI doesn't work, but maybe together we could fix it, idk.

AlexanderOcias commented 3 years ago

Hmm how is the UI failing in this 'URP' compared with normal? Any errors?

RevengerWizard commented 3 years ago

Hi! So, there aren't any errors, for some reason the UI doesn't scale well in the different resolutions and vibrates in the editor. Probably because of the BilinearShader, but I'm not sure. Also, since URP uses the Sprite-Lit shaders to make sprites react to light, probably all the materials should be updated.

I really love this package, I searched everywhere months and months for a solution like that, since even the Pixel Perfect Camera doesn't support UI Canvas. So yea.

AlexanderOcias commented 3 years ago

I see... If I remember right, I included a 'Pixel Art UI' shader/material to specifically for UI elements, does the behaviour change when that material is used/not used?

RevengerWizard commented 3 years ago

I see only a small difference with and without the material, but still vibrates in the editor and doesn't scale well in the different resolutions. In the Pixel Art Script I've just modified 2 functions to make it work with the render pipeline, so don't know the reason of this behaviour.

AlexanderOcias commented 3 years ago

I installed unity and took a look, in regular 2D projects it works completely fine. In URP, my example scene the canvas/ui works ok for me, it all configures correctly when play is pressed, if you're running into issues changing the resolution after pressing play, you'll probably need to update the canvas scaling settings to match at that point. I don't know why the bilinear-sharp isn't working, but I vaguely heard that URP changes the way screen rendertexture has to be done, so you'd have to look into how they want postprocessing to be done in URP.

RevengerWizard commented 3 years ago

So, I looked again at the scripts and the materials and found out there is this warning in the BilinearSharp Material, which doesn't set the Destination resolution:

image

I don't know what it does mean, if you could check. The shader is the same, without any change, so I think it's probably because of that, since it doesn't update the values in the material.

RevengerWizard commented 3 years ago

This warning appears also in the other shaders.

RevengerWizard commented 3 years ago

Small Update.

Somehow I figured out how to fix the log error relative to the compatibility with the SRP Batcher, but still it doesn't update the values in the material. Maybe I'm missing something. Should I make a Repository for this "URP version" of the package?

Also, now the UI doesn't jitter in the editor and scales.

Note: nevermind about materials values not updating, now it works.