Need Help Understanding Shaders/Textures

Questions & AnswersCategory: GeneralNeed Help Understanding Shaders/Textures
JasonBricco asked 4 years ago

Hey there,

So I figured I’m supposed to post the support related questions here rather than on the forum topic.

I need some serious help understanding how textures work in uTerrains. Can’t seem to wrap my mind around it, since I’m used to doing it the atlas and UV way.

I see the triplanar shader has a top texture slot, a sides texture slot, and a red/blue/green/alpha slot. I have little familiarity with triplanar shaders. I have no idea what the red/blue/green and alpha slots are for. You mentioned something about using vertex color to determine the side, but I don’t understand. The block has a single vertex color, how does that create a different result depending on the side?

Basically, I just want to know how to put a different texture on each block face. For example, grass texture on top and dirt texture on the sides and bottom. Note that I’m using cubic terrain here. Would I put the grass texture in top, and the dirt in sides? But what would I put in the red/green/blue/alpha?

And what if I wanted a block (example: Minecraft’s pumpkin) where it has a pumpkin face on front, no face on the other sides, a specific top face, and the bottom. In this case, the block would require three textures. Can I not do this?

Thanks in advance.

0 Answers
uTerrains Staff answered 4 years ago

Red/green/blue/alpha channels refer to the vertex color.
The shader determines which texture must be applied on a vertex depending on its colors. If the vertex color is red, the texture on red channel will be used.
When the vertex color is neither red, green, blue, or alpha (ie. it’s (0,0,0,0), all dark) then the top & sides textures are used depending on the vertex normal.
I hope this is more clear for you.

JasonBricco replied 4 years ago

I (think) I understand now. I’ll play around with it. Thanks.