Is it possible to stop WorldAlignedTexture from tiling?

Hello.

A few words about what I’m trying to do. I was experimenting with making a project for Oculus Quest 2, and stumbled across an issue, which is - decals don’t work properly with forward rendering.

My idea of a solution was to make similar functionality with materials. I should clarify, that I don’t need to spawn these decals during gameplay, I only want to set them up initially for various objects, from their respective material instances, by providing world coordinates.

At first I tried doing it with just adding values to AbsoluteWorldPosition, feeding it to the UV input of the decal texture sample, and multiplying it by the actual object’s material, which worked fine, until I tried to rotate the mesh, and realised that the decal texture stretches vertically.

While trying to solve that, I found this material function, WorldAlignedTexture, and it seemed to do everything I wanted it to do… Until I realized that it tiles the texture, even though the texture’s tiling is set to clamp.

Hence the question, is it possible to modify this function, so that it would stop tiling the texture?

There is already a material function designed to do this job called Static Mesh Decal Function.

You are a savior. I have never seen even a single mention of this function before this. I am honestly quite confused by that, since it actually does work, and from what I have seen so far, does so quite well even in VR.

Hard to say anything about perfomance impact, but for now at least, Quest 3 seems perfectly fine with 30 of these in a scene at once.

To anyone who might stumble across this, here’s the material that I ended up with:

To make it work, it has to be applied to 1x1x1_Box_Pivot_-XYZ cube, found in Engine/Content, and then it works just like a decal.

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