Search Unity

Feedback 3D Antialised Pixel Art Shader Graph for URP/HDRP/VR/Mobile

Discussion in 'Universal Render Pipeline' started by hippocoder, May 18, 2020.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It does custom filtering and was based on an example by @bgolus !

    It works great in VR, very stable and lovely. I probably screwed the normals but I don't have time. Looks fine I think, probably not.

    Due to my decision to use a custom function node in this, the sampler state must be set per shader, in the shader. This is a shadergraph limitation.

    Inside the package is a Pixel material, it has inputs for albedo, normal and mask map. The mask map is all ready to go in the graph but has no meaning attached to the channels so you can just wire it up with your own fancy how you like.

    I figured I'd share since it was just a fun experiment. Feel free to own it and do what you want, no license.

    Oh, there's no support from me for this, hehe.
     

    Attached Files:

    Ony and bgolus like this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Why do your Shader Graph & Sub Graph default to Wrap Clamp instead of Repeat?

    Also:
    Code (csharp):
    1.     float pdx = ddx(vertuv);
    2.     float pdy = ddy(vertuv);
    Should be:
    Code (csharp):
    1.     float2 pdx = ddx(vertuv);
    2.     float2 pdy = ddy(vertuv);
    You're getting the screen space partial derivatives of
    vertuv
    , which is a
    float2
    , so the output (and the input into
    SAMPLE_TEXTURE2D_GRAD
    ) should also be a
    float2
    and not a
    float
    .

    This will end up looking blurrier, but that's because mip mapping will finally be working again where as it was only being applied on one axis before that. Anisotropic filtering makes a big difference in how this effect ends up looking since the extra sharp foreground makes the usual deficiencies of bilinear/trilinear mip mapping more apparent, more so than having the usual "blurry" foreground you get without this.

    It should also be noted that the graph assumes all textures are the same size as the albedo texture. Generally with this kind of effect you will want all of the textures to match, but in the case where you don't you may need to use multiple PixelSampler nodes.
     
    hippocoder likes this.