Stochastic Texture Sampling

For people working on the C++ code.
Post Reply
User avatar
Hybrid Dog
Posts: 2840
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Stochastic Texture Sampling

by Hybrid Dog » Post

Currently textures in Minetest are repeating, for example here all cobblestone nodes are visually made up of the same small stones positioned in the same way everywhere:
stochastic_texture_sampling_off.jpg (114.41 KiB) Viewed 655 times
With stochastic texture sampling, it is possible to re-use only high frequency details of textures, which makes nodes look more natural, adds visual variety, and prevents artifacts which are visible when a wall of the same node is watched from far away.
Here is the same image with stochastic texture sampling used for all nodes:
stochastic_texture_sampling_on.jpg (117.86 KiB) Viewed 655 times
Whether stochastic texture sampling looks good depends on the texture, some parameters and opinion. In this case, it looks bad for the mese lamp (in my opinion) because the mese lamp texture should repeat.

I partly implemented stochastic texture sampling in Minetest some time ago and didn't continue because I don't know if it's worth the code complexity.

More screenshots: viewtopic.php?p=423224#p423224

The code can be found on this branch in my Minetest fork: ... Fem_rebase
I tried to rebase it (m_stochastic_texture_sampling_broken_after_rebase branch) but made some mistake somewhere.

In addition to stochastic texture sampling in Minetest, I have implemented a demonstration program in a single HTML page: ... ling_demo/
(source: ... ling_demo/)
It allows testing the algorithm with any SDR texture, for example default_stone.png:
stonet.png (63.04 KiB) Viewed 655 times


Posts: 16
Joined: Sat Apr 13, 2024 23:06
GitHub: Kazooo100
In-game: Kazooo

Re: Stochastic Texture Sampling

by Kazooo » Post

Looks cool! I know there is also seed related textures, called global textures, but MTG doesn't use them.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests