Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sampler filter wrap mipmap #969

Merged
merged 9 commits into from
May 24, 2021

Conversation

ousttrue
Copy link
Contributor

#947

  • SamplerParam.EnableMipMap
  • Import
    • SamplerParam.EnableMipMap を gltf から得る
    • new Textrue2D に投入
    • TextureImporter に設定
  • Export
    • mipmap を考慮して filterMode を決める

@ousttrue ousttrue requested a review from Santarh May 24, 2021 06:46
@ousttrue ousttrue requested a review from Santarh May 24, 2021 06:55
return glFilter.LINEAR;
case FilterMode.Bilinear:
case FilterMode.Trilinear:
return glFilter.LINEAR_MIPMAP_LINEAR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

よさそう!

case glFilter.NEAREST_MIPMAP_NEAREST:
return (FilterMode.Point, false);

case glFilter.NEAREST_MIPMAP_LINEAR:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NEAREST_MIPMAP_LINEAR は、ミップマップ間はリニアで補間、そして 2D テクスチャ内では NN で補間、を指す。

@ousttrue ousttrue requested a review from Santarh May 24, 2021 07:09
@Santarh
Copy link
Contributor

Santarh commented May 24, 2021

あと Unity の Trilinear はミップマップのリニア補間もする、の意味っぽいです
https://docs.unity3d.com/ScriptReference/FilterMode.Trilinear.html

@Santarh
Copy link
Contributor

Santarh commented May 24, 2021

GL の定義はこうかな?

\ No Mipmap Mipmap NN Mipmap Linear
2D NN NEAREST NEAREST_MIPMAP_NEAREST NEAREST_MIPMAP_LINEAR
2D Linear LINEAR LINEAR_MIPMAP_NEAREST LINEAR_MIPMAP_LINEAR

そして Unity の定義はこうなのか?

\ No Mipmap Mipmap NN Mipmap Linear
2D NN Point (w/o Mipmap) Point NoExists?
2D Linear Bilinear (w/o Mipmap) Bilinear Trilinear

参考:
OpenGLES3.0 Spec https://www.khronos.org/registry/OpenGL/specs/es/3.0/es_spec_3.0.pdf
Unity FilterMode https://docs.unity3d.com/ScriptReference/FilterMode.html

Copy link
Contributor

@Santarh Santarh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

よさそう

/// </summary>
/// <param name="texture"></param>
/// <returns></returns>
public static glFilter ExportMinFilter(Texture2D texture)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Export の対応あってそう!

/// <param name="FilterMode"></param>
/// <param name="filterMode"></param>
/// <returns></returns>
public static (FilterMode FilterMode, bool EnableMipMap) ImportFilterMode(glFilter filterMode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import の対応もあってそう!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
colorspace gamma(sRGB) / Linear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants