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

PBR Material interface redesign #195

Open
GuoLei1990 opened this issue Apr 13, 2021 · 1 comment · Fixed by #418 or #669 · May be fixed by #697 or #704
Open

PBR Material interface redesign #195

GuoLei1990 opened this issue Apr 13, 2021 · 1 comment · Fixed by #418 or #669 · May be fixed by #697 or #704
Assignees
Labels
Iteration plan Rendering Rendering related functions
Milestone

Comments

@GuoLei1990
Copy link
Member

GuoLei1990 commented Apr 13, 2021

Actually I want to use occlusionRoughnessMetallicTexture insteadof roughnessMetallicTexture + occlusionTexture in metallic workflow, but consider the current stage glTF compatibility and API consistency, we made some compromises:
Metallic workflow: OcclusionTexture + MetallicRoughnessTexture
Specular workflow: OcclusionTexture + specularGlossinessTexture

Consider optimization in the future:
Metallic workflow: OcclusionRoughnessMetallicTexture
Specular workflow: OcclusionTexture + specularGlossinessTexture

API Design(WIP):

/**
 * PBR base material.
 */
export declare abstract class PBRBaseMaterial extends BaseMaterial {
    private _baseColor;
    private _baseTexture;
    private _normalTexture;
    private _emissiveColor;
    private _emissiveTexture;
    private _tilingOffset;
    private _occlusionTexture;
    private _occlusionIntensity;
    private _detailTilingOffset;
    /**
     * Base color.
     */
    get baseColor(): Color;
    set baseColor(value: Color);
    /**
     * Base texture.
     */
    get baseTexture(): Texture2D;
    set baseTexture(value: Texture2D);
    /**
     * Normal texture.
     */
    get normalTexture(): Texture2D;
    set normalTexture(value: Texture2D);
    /**
     * Normal texture intensity.
     */
    get normalTextureIntensity(): number;
    set normalTextureIntensity(value: number);
    /**
     * Emissive color.
     */
    get emissiveColor(): Color;
    set emissiveColor(value: Color);
    /**
     * Emissive texture.
     */
    get emissiveTexture(): Texture2D;
    set emissiveTexture(value: Texture2D);
    /**
     * Occlusion texture.
     */
    get occlusionTexture(): Texture2D;
    set occlusionTexture(v: Texture2D);
    /**
     * Occlusion texture intensity.
     */
    get occlusionTextureIntensity(): number;
    set occlusionTextureIntensity(v: number);
    /**
     * Parallax texture.
     */
    get parallaxTexture(): Texture2D;
    set parallaxTexture(value: Texture2D);
    /**
     * Parallax texture intensity.
     */
    get parallaxTextureIntensity(): number;
    set parallaxTextureIntensity(value: number);
    /**
     * Tiling and offset of main textures.
     */
    get tilingOffset(): Vector4;
    set tilingOffset(value: Vector4);
    /**
     * Detail mask.
     */
    get detailMask(): Texture2D;
    set detailMask(value: Texture2D);
    /**
     * Detail texture.
     */
    get detailTexture(): Texture2D;
    set detailTexture(value: Texture2D);
    /**
     * Detail nromal texture.
     */
    get detailNormalTexture(): Texture2D;
    set detailNormalTexture(value: Texture2D);
    /**
     * Tiling and offset of detail texture.
     */
    get detailTilingOffset(): Vector4;
    set detailTilingOffset(value: Vector4);
    /**
     * Clear coat texture.
     */
    get clearCoatTexture(): Texture2D;
    set clearCoatTexture(value: Texture2D);
    /**
     * Clear coat texture intensity.
     */
    get clearCoatTextureIntensity(): number;
    set clearCoatTextureIntensity(value: number);
    /**
     * Clear coat roughness.
     */
    get clearCoatRoughness(): number;
    set clearCoatRoughness(value: number);
    /**
     * Clear coat roughness texture.
     */
    get clearCoatRoughnessTexture(): Texture2D;
    set clearCoatRoughnessTexture(value: Texture2D);
    /**
     * Clear coat normal texture.
     */
    get clearCoatNormalTexture(): Texture2D;
    set clearCoatNormalTexture(value: Texture2D);
    /**
     * Clear coat normal texture intensity.
     */
    get clearCoatNormalTextureIntensity(): Texture2D;
    set clearCoatNormalTextureIntensity(value: Texture2D);
}
/**
 * PBR metallic-roughness workflow material.
 */
export declare class PBRMaterial extends PBRBaseMaterialX {
    private _metallic;
    private _roughness;
    private _roughnessMetallicTexture;
    /**
     * Metallic.
     */
    get metallic(): number;
    set metallic(value: number);
    /**
     * Roughness.
     */
    get roughness(): number;
    set roughness(value: number);
    /**
     * Roughness metallic texture.
     * @remarks G channel is roughness, B channel is metallic
     */
    get roughnessMetallicTexture(): Texture2D;
    set roughnessMetallicTexture(v: Texture2D);
}
/**
 * PBR specular-glossiness workflow material.
 */
export declare class PBRSpecularMaterial extends PBRBaseMaterialX {
    private _specularColor;
    private _specularGlossinessTexture;
    private _glossiness;
    /**
     * Specular color.
     */
    get specularColor(): Color;
    set specularColor(value: Color);
    /**
     * Glossiness.
     */
    get glossiness(): number;
    set glossiness(value: number);
    /**
     * Specular glossiness texture.
     * @remarks RGB is specular, A is glossiness
     */
    get specularGlossinessTexture(): Texture2D;
    set specularGlossinessTexture(value: Texture2D);
}

Design: @GuoLei1990 , @zhuxudong

PR: @zhuxudong

PR reviewers: @yangfengzzz , @gz65555 , @GuoLei1990

@GuoLei1990 GuoLei1990 added Rendering Rendering related functions enhancement labels Apr 13, 2021
@GuoLei1990 GuoLei1990 added this to the 0.5 milestone Apr 13, 2021
@zhuxudong zhuxudong changed the title PBR Material interfacte design PBR Material interface design Jun 24, 2021
@GuoLei1990 GuoLei1990 added the high priority High priority issue label Jun 28, 2021
@GuoLei1990 GuoLei1990 changed the title PBR Material interface design PBR Material interface redesign Aug 3, 2021
@zhuxudong
Copy link
Member

zhuxudong commented Aug 4, 2021

  • ior
  • baseColor
  • baseTexture
  • normalTexture
  • normalTextureIntensity
  • emissiveColor
  • emissiveTexture
  • occlusionTexture
  • occlusionTextureIntensity
  • parallaxTexture
  • parallaxTextureIntensity
  • tilingOffset
  • detailMask
  • detailTexture
  • detailNormalTexture
  • detailTilingOffset
  • clearCoat
  • clearCoatTexture
  • clearCoatRoughness
  • clearCoatRoughnessTexture
  • clearCoatNormalTexture
  • clearCoatNormalTextureIntensity
  • metallic
  • roughness
  • roughnessMetallicTexture
  • specularColor
  • glossiness
  • specularGlossinessTexture
  • sheenColor
  • sheenColorTexture
  • sheenRoughness
  • sheenRoughnessTexture
  • dielectricSpecularIntensity
  • dielectricSpecularIntensityTexture
  • dielectricF0Color
  • dielectricF0ColorTexture
  • refraction
  • refractionIntensityTexture

@GuoLei1990 GuoLei1990 modified the milestones: 0.5, 0.6 Aug 4, 2021
@GuoLei1990 GuoLei1990 linked a pull request Aug 4, 2021 that will close this issue
3 tasks
@GuoLei1990 GuoLei1990 added medium priority Medium priority issue and removed high priority High priority issue labels Sep 7, 2021
@GuoLei1990 GuoLei1990 modified the milestones: 0.6, 0.7 Nov 9, 2021
@zhuxudong zhuxudong modified the milestones: 0.7, 0.8 Feb 14, 2022
@zhuxudong zhuxudong linked a pull request Mar 1, 2022 that will close this issue
3 tasks
@zhuxudong zhuxudong linked a pull request Mar 24, 2022 that will close this issue
3 tasks
@GuoLei1990 GuoLei1990 modified the milestones: 0.7, 0.9 Aug 4, 2022
@GuoLei1990 GuoLei1990 modified the milestones: 0.9, 1.0 Nov 14, 2022
@GuoLei1990 GuoLei1990 added Iteration plan and removed enhancement medium priority Medium priority issue labels Nov 14, 2022
@GuoLei1990 GuoLei1990 modified the milestones: 1.0, 1.1 May 18, 2023
@GuoLei1990 GuoLei1990 modified the milestones: 1.1, 1.2 Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment