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 shader support Iridescence #2425

Merged
merged 44 commits into from
Nov 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5a26f3d
fix(shader-lab): compatible with empty macro
Sway007 Sep 20, 2023
5ecc318
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Sep 20, 2023
cafc24f
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Sep 20, 2023
dc69489
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Sep 21, 2023
221b7b6
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Sep 21, 2023
0d45d9c
fix(shader-lab): add break and continue syntax
Sway007 Sep 21, 2023
0f14c3f
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Sep 27, 2023
8871d9b
fix: typo
Sway007 Oct 11, 2023
3b4ffd7
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Nov 1, 2023
f649a58
fix(shader-lab): Make usepass compatible with buitin shader
Sway007 Nov 1, 2023
598fc56
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Nov 2, 2023
e33a66f
fix(shader-lab): compatible with no varying variable
Sway007 Nov 2, 2023
41ef06f
feat(shader-lab): detect mismatch return type
Sway007 Nov 6, 2023
b5214fc
fix(shader-lab): renderState assignment
Sway007 Nov 7, 2023
f36ce02
feat: extend material loader data type
Sway007 Nov 13, 2023
ff8b7c2
Merge branch 'main' of https://github.com/galacean/engine
Sway007 Nov 13, 2023
634236f
fix(shader-lab): glsl type pattern
Sway007 Nov 13, 2023
91e6fa4
fix(shader-lab): glsl type pattern
Sway007 Nov 13, 2023
3932448
fix: switch case break
Sway007 Nov 15, 2023
671cace
fix: array index loss
Sway007 Jun 11, 2024
92b972e
feat: merge
Sway007 Jun 11, 2024
9226d38
fix: test-case
Sway007 Jun 11, 2024
ff6a69a
fix: test-case
Sway007 Jun 12, 2024
0838968
feat: support GLTF_Iridescence
hhhhkrx Nov 6, 2024
82d5a8f
Merge branch 'main' of github.com:galacean/engine into gltf_iridescence
hhhhkrx Nov 6, 2024
39043a2
fix: merge
hhhhkrx Nov 6, 2024
ad61eed
Merge branch 'dev/1.4' of github.com:galacean/engine into gltf_irides…
hhhhkrx Nov 6, 2024
2b308ec
fix: vector3
hhhhkrx Nov 6, 2024
2c1604f
fix: vector3
hhhhkrx Nov 6, 2024
0be9f2a
fix: texture name
hhhhkrx Nov 6, 2024
88f89f2
Merge branch 'dev/1.4' into gltf_iridescence
hhhhkrx Nov 6, 2024
b5b9a0a
fix: material uniform
hhhhkrx Nov 7, 2024
d7a82de
fix: enable iridescence
hhhhkrx Nov 7, 2024
d1547d4
Merge branch 'dev/1.4' of github.com:galacean/engine into gltf_irides…
hhhhkrx Nov 11, 2024
76c5423
fix: iridescence name
hhhhkrx Nov 11, 2024
aa41aaf
fix: add }
hhhhkrx Nov 11, 2024
f4b16fd
ci: prettier code
hhhhkrx Nov 12, 2024
9fb543f
fix: iridescence name
hhhhkrx Nov 18, 2024
647b8a9
fix: irisdescence value
hhhhkrx Nov 19, 2024
e70ee42
fix: iridescenceRange value
hhhhkrx Nov 19, 2024
8f41f62
fix: iridescenceRange value
hhhhkrx Nov 19, 2024
499bd70
fix: issue
hhhhkrx Nov 19, 2024
e644dff
fix: iridescence
hhhhkrx Nov 19, 2024
6f418fa
Merge branch 'dev/1.4' of github.com:galacean/engine into gltf_irides…
hhhhkrx Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: vector3
  • Loading branch information
hhhhkrx committed Nov 6, 2024
commit 2c1604f2c22133ead5eff962f2fc18718f0ce94a
6 changes: 3 additions & 3 deletions packages/core/src/material/PBRMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,118 +137,118 @@
}

/**
* The iridescence intensity factor.

Check failure on line 140 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `↹`
* @defaultValue `1.0`
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved
*/
get iridescenceFactor(): number {
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved
return this.shaderData.getVector4(PBRMaterial._iridescenceProp).x;
}

Check warning on line 145 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L144-L145

Added lines #L144 - L145 were not covered by tests

set iridescenceFactor(value: number) {
const IridescenceInfo = this.shaderData.getVector3(PBRMaterial._iridescenceProp);
const IridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceProp);
if (!!IridescenceInfo.x !== !!value) {
if (value === 0) {
this.shaderData.disableMacro("MATERIAL_ENABLE_IRIDESCENCE");
} else {
this.shaderData.enableMacro("MATERIAL_ENABLE_IRIDESCENCE");
}
}
IridescenceInfo.x = value;
}

Check warning on line 157 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L148-L157

Added lines #L148 - L157 were not covered by tests

/**
* The index of refraction of the dielectric thin-film layer.

Check failure on line 160 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `↹`
* @defaultValue `1.3`
*/
get iridescenceIor(): number {
return this.shaderData.getVector4(PBRMaterial._iridescenceProp).y;
}

Check warning on line 165 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L164-L165

Added lines #L164 - L165 were not covered by tests

set iridescenceIor(value: number) {
const IridescenceInfo = this.shaderData.getVector3(PBRMaterial._iridescenceProp);
const IridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceProp);
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved
if (!!IridescenceInfo.y !== !!value) {
if (value === 0) {
this.shaderData.disableMacro("MATERIAL_ENABLE_IRIDESCENCE");
} else {
this.shaderData.enableMacro("MATERIAL_ENABLE_IRIDESCENCE");
}
}
IridescenceInfo.y = value;
}

Check warning on line 177 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L168-L177

Added lines #L168 - L177 were not covered by tests
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved

/**
* The minimum thickness of the thin-film layer given in nanometers.

Check failure on line 180 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `↹↹`
* @defaultValue `100`
*/
get iridescenceThicknessMin(): number {
return this.shaderData.getVector4(PBRMaterial._iridescenceProp).z;
}

Check warning on line 185 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L184-L185

Added lines #L184 - L185 were not covered by tests

set iridescenceThicknessMin(value: number) {
const IridescenceInfo = this.shaderData.getVector3(PBRMaterial._iridescenceProp);
const IridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceProp);
if (!!IridescenceInfo.z !== !!value) {
if (value === 0) {
this.shaderData.disableMacro("MATERIAL_ENABLE_IRIDESCENCE");
} else {
this.shaderData.enableMacro("MATERIAL_ENABLE_IRIDESCENCE");
}
}
IridescenceInfo.z = value;
}

Check warning on line 197 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L188-L197

Added lines #L188 - L197 were not covered by tests

/**
* The maximum thickness of the thin-film layer given in nanometers.

Check failure on line 200 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `↹`
* @defaultValue `400`
*/
get iridescenceThicknessMax(): number {
return this.shaderData.getVector4(PBRMaterial._iridescenceProp).w;
}

Check warning on line 205 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L204-L205

Added lines #L204 - L205 were not covered by tests

set iridescenceThicknessMax(value: number) {
const IridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceProp);
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved
if (!!IridescenceInfo.w !== !!value) {
if (value === 0) {
this.shaderData.disableMacro("MATERIAL_ENABLE_IRIDESCENCE");
} else {
this.shaderData.enableMacro("MATERIAL_ENABLE_IRIDESCENCE");
}
}
IridescenceInfo.w = value;
}

Check warning on line 217 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L208-L217

Added lines #L208 - L217 were not covered by tests
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved

Check failure on line 218 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
/**
* The thickness texture of the thin-film layer.

Check failure on line 220 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `↹`
*/
get irithicknessTexture(): Texture2D {
zhuxudong marked this conversation as resolved.
Show resolved Hide resolved
return <Texture2D>this.shaderData.getTexture(PBRMaterial._irithicknesstextureProp);
}

Check warning on line 224 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L223-L224

Added lines #L223 - L224 were not covered by tests

set irithicknessTexture(value: Texture2D) {
this.shaderData.setTexture(PBRMaterial._irithicknesstextureProp, value);

if (value) {
this.shaderData.enableMacro("MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE");
} else {
this.shaderData.disableMacro("MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE");
}
}

Check warning on line 234 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L227-L234

Added lines #L227 - L234 were not covered by tests

/**
* The iridescence intensity texture.

Check failure on line 237 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `↹`
*/
get iridescenceTexture(): Texture2D {
GuoLei1990 marked this conversation as resolved.
Show resolved Hide resolved
return <Texture2D>this.shaderData.getTexture(PBRMaterial._iridecencetextureProp);
}

Check warning on line 241 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L240-L241

Added lines #L240 - L241 were not covered by tests

set iridescenceTexture(value: Texture2D) {
this.shaderData.setTexture(PBRMaterial._iridecencetextureProp, value);

if (value) {
this.shaderData.enableMacro("MATERIAL_HAS_IRIDESCENCE_TEXTURE");
} else {
this.shaderData.disableMacro("MATERIAL_HAS_IRIDESCENCE_TEXTURE");
}
}

Check warning on line 251 in packages/core/src/material/PBRMaterial.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/material/PBRMaterial.ts#L244-L251

Added lines #L244 - L251 were not covered by tests

/**
* Create a pbr metallic-roughness workflow material instance.
Expand All @@ -262,7 +262,7 @@
shaderData.setFloat(PBRMaterial._roughnessProp, 1);
shaderData.setFloat(PBRMaterial._iorProp, 1.5);
shaderData.setVector3(PBRMaterial._anisotropyInfoProp, new Vector3(1, 0, 0));
shaderData.setVector4(PBRMaterial._iridescenceProp, new Vector4(0, 1.3, 100, 400));

Check failure on line 265 in packages/core/src/material/PBRMaterial.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `⏎`

}

Expand Down
Loading