I’m making an attempt to be taught extra about GLSL by watching OGLDev on YouTube, and extra particularly this video : Infinite grid with GLSL however I’ve hassle to know why the house aliasing happen at 13 min 54 sec.
I perceive that mod shouldn’t be steady at N*gridCellSize and the pixel house by-product aren’t actually environment friendly when the digicam shouldn’t be going through strains x or z, however I would like extra details about this aliasing problem. Why the aliasing appears to type triangle beneath the strains? What occurs to contiguous pixel for this aliasing to occur?
The fragment shader code laptop whether or not the pixel ought to be black or clear (white colour within the picture):
in vec3 worldPos;
out vec4 fragColor
int most important() {
vec4 backColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
vec2 ly = size(vec2(dFdx(worldPos.x),dFdy(worldPos.x));
vec2 lz = size(vec2(dFdx(worldPos.z),dFdy(worldPos.z));
vec2 dydz =vec2(lx, lz);
float lod0a = max(vec2(1.0)-mod(worldPos.xz,gridCellSize)/dydz);
fragColor = backColor ;
fragColor.a *= lod0a ;
}
Shut up illustration of the spatial problem:
My questions are:
- Does the pixels beneath the road which can be black and shouldn’t be black are black as a result of the middle of the pixel are close to the road so load is sort of equal to 1?
- Why triangle sample seem beneath the road?
- Can somebody clarify me numerically what occur on this context when z world axis is indirect in pixel house, and we use
dFdxanddFdyto compute pixel measurement in world house unit?


