Stochastic Texture Sampling

For people working on the C++ code.
Post Reply
User avatar
Hybrid Dog
Member
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
stochastic_texture_sampling_off.jpg (114.41 KiB) Viewed 444 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
stochastic_texture_sampling_on.jpg (117.86 KiB) Viewed 444 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: https://github.com/HybridDog/minetest/t ... 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: https://hybriddog.github.io/stochastic_ ... ling_demo/
(source: https://github.com/HybridDog/stochastic ... ling_demo/)
It allows testing the algorithm with any SDR texture, for example default_stone.png:
stonet.png
stonet.png (63.04 KiB) Viewed 444 times

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

Kazooo
Member
Posts: 10
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