Home Technical Talk

Is tri-planar related to 45 degrees or something?

polycounter lvl 3
Offline / Send Message
Dks13632725 polycounter lvl 3
I know triplanar is XYZ-axis projected which is basically using vertex normal I guess, but I cant really its realtionship between 45 degrees angle because it's more visible at 45 angle degrees? 

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    The blends occur around those angles. It might help you to see at a step-by-step breakdown of how triplanar works.

  • RN
    Options
    Offline / Send Message
    RN sublime tool
    You sample the texture on three axes, and then blend these 3 samples based on the surface normal at that pixel. 

    Sampling the texture once on each X, Y, Z axis and blending these 3 samples with the same weight (AKA an average):

    The normals of the mesh:

    Using the (world-space) XYZ components of the normal at each surface point as the weights to blend between the 3 samples (plus a sharpness parameter to "make the difference between each sample more distinct"):


    At 45 degrees all samples have the same weight, so any surface points facing 45º angles (diagonals) have the simple average of the 3 samples and this usually looks messy with textures that aren't noisy enough. 
    A surface point with a normal perfectly facing a certain axis will just use 100% of the sample for that axis and nothing from the other axes.

    PS: The image you quoted seems to be from this article here and from what I can tell it explains it wrong: the surface isn't "being rendered 3 times", it's the texture that's being sampled 3 times inside the pixel shader. The object is rendered once and the pixel shader works on every visible pixel of that object. 
    This does not make triplanar much more expensive than a regular shader that samples the texture a single time. You try to keep it as low as possible, but a shader can sample a texture lots of times -- say, ten or more times for a Gaussian blur effect.



Sign In or Register to comment.