2D Texture Array with Triplanar Projection

Hello!

I am stuck on an issue with using a 2D texture array with triplanar projection. The issue comes in with the inputs that a texture 2D needs versus a texture 2d array. Traditional triplanar relies on using 2D textures for each axis (X, Y, and Z) separately, and with our 2D texture array we use Z to index the sample. Is there anyway I can get this to work?

According to research, I need to use the index of the array texture to retrieve the appropriate texture data for each axis during the projection calculation.

Here is what I have so far:

Perhaps I should state the intention of this conversion. I am setting up a master material with multiple layers. If I am not mistaken, we can use 2d texture arrays to store textures more efficiently as opposed to simply using the textures (Albedo, Normal, etc.) per layer. I have managed to convert Cellbombing to use the 2D Texture Array, though it seems odd numbered samples have an offset for some reason.

Hi Hipshootah,

There’s a more efficent way to do tri-planar with only one texture sample per texture - that may actually just fix your issue, check out:

So I am over thinking it an just remake the dang material :rofl: I remember watching this video a few weeks ago, but I am returning to landscapes this week and going over what I have done so far. I think I get it now haha

1 Like

You could well be onto something with the TextureArrays though - I haven’t played with them at all…

Okay, I see what you are saying for sure. Had to keep watching the video to digest everything haha. We can use a single sample for the whole thing. You say “sample a runtime virtual texture” as opposed to using just a scalar parameter to set the index?

1 Like

Okay so I updated the material to use the single sample method you provided. Now I am having trouble with the output of texture 2d array parameter, which is translating to the same issue of missing Z data I believe :smiling_face_with_tear:

Going to keep playing with it and researching, I will post anymore updates I find.

Hi Hipshootah,

It looks like your axis to vector part is not quite right:

image

I tried opening the image you posted in a separate tab with no luck, it is super blurry :rofl: I will go back and rewatch the video now that my head is clear. I did manage to figure it out a solution to my issue though, which I will post below!

Have to make 3 edits because my grammar is wack sometimes.

I just want to say thanks again for your work, you really helped me work through this. Cheers!

1 Like

No problem!

Yeah I snapped that from the video so double the amount of blur… I couldn’t really see your one in detail either, but was going by the colors of the nodes. It looks like you’ve put the first inputs in the correct places for the Additions (also, it looks like your 3rd channel is an add rather than a multiply, could just be the blur though) but wiring them into the make float3 the wrong way around:

My version is a bit of a mess, but at least it’s not blurry:

1 Like

You are awesome, thank you for your time and explanations! I will check it out.

1 Like

I have no idea what is going on now lmao

Try swapping these:

1 Like

Okay after some review, I discovered my TransformVector was inverted. Correct solution:

Fixed the weird shadow produced from the normal map. Cheers!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.