Stochastic Texture Sampling provides an advanced, highly-optimized solution to one of the most persistent issues in 3D rendering: texture tiling.
By drawing model UVs with an advanced stochastic-projection method, this shader entirely breaks up the noticeable, repeating grid patterns that plague large surfaces like terrain, grass, and architectural floors. Unlike traditional, computationally heavy stochastic methods, this implementation features the most simplified possible calculations, making it fully capable of running smoothly on mobile platforms (iOS/Android) and standalone VR/XR headsets.
Whether you are rendering massive landscapes or detailed environments, this technique makes texture repetition significantly less noticeable without sacrificing your framerate.
📦 Video Showcase & Portfolio: https://orlowski.works/ (Scroll to the bottom of the Showcase section to see the real-time video comparison!)
🔍 Anti-Tiling Magic: Completely breaks up the unnatural repetition of textures on large meshes using pseudo-random UV offsets and blending, ensuring organic and natural-looking surfaces.
⚡ Mobile & XR Optimized: Achieves the visual fidelity of high-end stochastic projection using stripped-down mathematical approximations. Built from the ground up to guarantee maximum performance on mobile GPUs and standalone headsets like Meta Quest.
🌍 Cross-Platform / Engine Agnostic: Written in clean HLSL/GLSL, making it fully compatible with Unity, Unreal Engine 5, or your own custom rendering pipelines.
💡 Preserves Visual Fidelity: Maintains the crispness and quality of your albedo and normal maps without introducing heavy blurring or artifacting common in cheaper anti-tiling workarounds.
Seeing is believing. Check out the real-time preview to see the dramatic difference stochastic sampling makes on a heavily repeating texture.
(Click the link above and scroll down to the **Stochastic Texture Sampling** section to watch the live demo!)
Integrating this technique into your existing shaders is extremely straightforward.
🎉 Enjoy! :)
⚡ Fast Way (Unity Shader Graph / UE5 Material Editor):
- Import the provided Sub-Graph / Material Function into your project.
- Connect your base Texture and UV node into the
StochasticSampleblock. - Route the output directly to your Base Color / Albedo.
- Done! Watch your tiling issues disappear.
🛠️ Perfect Way (Native HLSL/GLSL):
- Include the
StochasticSampling.cginc(or.glsl) in your custom shader file. - Replace your standard
tex2D()orSample()calls with theStochasticSample()function. - Pass your texture sampler, UV coordinates, and noise scaling factor.
- Compile and marvel at the seamless optimization! 🎊
For me, the best payment for a ton of hard work and optimization is seeing people use this in their awesome projects! I'm counting on the GameDev community to help test and expand this tool.
DEVELOPERS:
Above all, if you're a programmer or technical artist, you can help by porting this specific simplified stochastic math to other game engines or WebGL frameworks (like Three.js). My biggest goal is for these rendering techniques to be fully universal.
SUPPORTERS:
If you find edge cases where the blending could be optimized further, or if you create cool variations for specific material types (like water or procedural dirt), feel free to open a Pull Request!
I would be extremely grateful for any help and feedback!
You can reach me via email:
And since you're here, take a look at my portfolio for more high-performance rendering solutions, features, and other tools:
