Random / UV pixelations or artifacts

random / uv

I added the random / uv to generate randomized texture that don’t look like a grid for the a large terrain, and I find that there are large pixel squares when you view it from far.

Screenshot #1 - on close up the detailed texture is fine.

Screenshot #2 - As you zoom out you noticed that there is large square pixels.

Screenshoot #3 - Its even obvious when zoom far.

I copy exactly the sample above:

Screenshot #4 - On these sand and grass the random / uv is working perfectly but on the 2 kilo meter terrain, some square obvious square pixels are visible?

Screenshot #1 - its difficult to see, but if you are on a overview mode it becomes obvious.

`if (_pm.p.models[d.index].randomize && _pm.p.models[d.index].randomize.includes(child.material.name)) {
                        child.material.onBeforeCompile = (shader) => {
                            shader.uniforms["enableRandom"] = { value: 1 };
                            shader.uniforms["useNoiseMap"] = { value: 1 };
                            shader.uniforms["useSuslikMethod"] = { value: 1 };
                            shader.fragmentShader = shader.fragmentShader.replace("#include <alphamap_pars_fragment>", `
                                #ifdef USE_ALPHAMAP
                                    uniform sampler2D alphaMap;
                                    uniform float disolve;
                                    uniform float threshold;
                                #endif`);
                            shader.fragmentShader = shader.fragmentShader.replace("#include <alphamap_fragment>", `
                                #ifdef USE_ALPHAMAP
                                    float vv = texture2D( alphaMap, vAlphaMapUv ).g;
                                    float r = disolve * (1.0 + threshold * 2.0) - threshold;
                                    float mixf = clamp((vv - r)*(1.0/threshold), 0.0, 1.0);
                                    diffuseColor.a = mixf;
                                #endif`);
                        };
                    }`

Live

1 Like