buildaworldnet / IrrlichtBAW

Build A World fork of Irrlicht
http://www.buildaworld.net
Apache License 2.0
122 stars 28 forks source link

Add a texture mipmap clipper to convert2baw #118

Open devshgraphicsprogramming opened 6 years ago

devshgraphicsprogramming commented 6 years ago

As a command line option -compMaxLoD A T where A is an integer E_VERTEX_ATTRIBUTE_ID and T an integer corresponding to a TextureLayer slot with a valid texture.

What this should do, is go over the final mesh triangles and find the largest UV space diff, what that actually means can be understood in different ways:

  1. Finding the 2D UV space triangle Axis Aligned Bounding Box with the longest X or Y side (L_inf-norm == chebyshev)
  2. Finding the longest UV space edge amongst all triangles (L2-norm)
  3. The square root of the biggest UV space triangle area (weird, probably best not to use)

Could add a suffix to compMaxLoD to indicate which method we want to use.

From this largest UV space diff we can compute a maxLod parameter equal to log2(largestUVdiff)

STextureSamplingParams or its future replacement needs to have an fp32 maxLod parameter which will essentially dictate the GL_TEXTURE_MAX_LOD value on the HW sampler objects.

Purpose This should alleviate texture bleeding on UV-unwrapped meshes.

devshgraphicsprogramming commented 5 years ago

If #280 needs triangle curvature data, then this is a good time to fix this.

devshgraphicsprogramming commented 3 years ago

Assign @AnastaZIuk