Skip to content

Commit

Permalink
DiffuseTransmission adjusted to latest shader code
Browse files Browse the repository at this point in the history
The plant material has been adjusted to work better with the current glTF Sample Viewer shader, primarily to reduce diffuse transmission, but also to fix an erroneous diffuseTransmissionTexture (which didn't contain an alpha channel).
  • Loading branch information
echadwick-artist committed Feb 14, 2025
1 parent fbcb702 commit 0a0b54e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
10 changes: 6 additions & 4 deletions Models/DiffuseTransmissionPlant/README.body.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@

## Description

This asset demonstrates the use of KHR_materials_diffuse_transmission to represent thin-surface light transmission of green plant leaves with red backscatter.
This asset demonstrates the use of [KHR_materials_diffuse_transmission](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_diffuse_transmission) to represent thin-surface light transmission of green plant leaves with red backscatter.

The original model is available from [Polyhaven](https://polyhaven.com/a/potted_plant_02). The model was edited with 3ds Max. The leaf textures were edited to show red veins, to help communicate the idea that the leaves are red inside, and thus would show red-colored diffuse transmission.

Leaf backfaces were removed, and doubleSided:true used instead, to allow pathtracers to render this asset effectively. Previously the asset had explicit backfacing triangles with a red material, and was relying on backface culling to render properly, but this is not supported in most pathtracers which makes it impossible to check for ground truth.
Leaf backfaces were removed, and `doubleSided:true` used instead, to allow pathtracers to render this asset effectively. Previously the asset had explicit backfacing triangles with a red material, and was relying on backface culling to render properly, but this is not supported in most pathtracers which makes it impossible to check for ground truth.

The leaves are assigned the diffuse transmission extension with a red color, and use a diffuseTransmissionTexture to concentrate the transmission on the red veins, and on the stems.
The leaves are assigned the diffuse transmission extension with a red `diffuseTransmissionColorTexture` to control the transmission. The red veins are darker to emphasize the leaf textures, and the bases of the stem trunks are darker to help these parts blend into the rocks better.

![diffuseTransmissionTexture on the model](screenshot/diffuseTransmissionTexture.jpg)
<br/>_The diffuseTransmissionTexture isolated on the model._
<br/>_The diffuseTransmissionColorTexture isolated on the model._

Fireflies were added, with point lights, and animated to follow a looping path. Chase cameras were added behind the fireflies.

To emphasize the effect of the point lights on diffuse transmission, the `diffuseTransmissionFactor` for the plant material was set to a low value of 0.1; this prevents the transmission color from overwhelming the baseColor.

Stem intersections with obvious shading differences were adjusted so their vertices could be welded together.

For optimal texture quality, lossless versions of the textures were re-downloaded from Polyhaven, then the asset was optimized with RapidPipeline and an ambient occlusion texture was baked for the pot and the dirt.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@
1,
0.48776522278785706
],
"intensity": 0.02500000037252903,
"intensity": 0.05,
"name": "pointlight_firefly1",
"type": "point"
},
Expand All @@ -2080,7 +2080,7 @@
1,
0.48776522278785706
],
"intensity": 0.02500000037252903,
"intensity": 0.05,
"name": "pointlight_firefly2",
"type": "point"
}
Expand Down Expand Up @@ -2124,7 +2124,7 @@
"emissiveTexture": {
"index": 4
},
"name": "plant",
"name": "base",
"normalTexture": {
"index": 3
},
Expand All @@ -2136,7 +2136,7 @@
"index": 2
},
"metallicFactor": 0,
"roughnessFactor": 0.5
"roughnessFactor": 0.75
}
},
{
Expand All @@ -2146,11 +2146,11 @@
"KHR_materials_diffuse_transmission": {
"diffuseTransmissionColorFactor": [
1,
0,
0
1,
1
],
"diffuseTransmissionFactor": 0.4,
"diffuseTransmissionTexture": {
"diffuseTransmissionFactor": 0.1,
"diffuseTransmissionColorTexture": {
"index": 5
}
}
Expand Down
Binary file modified Models/DiffuseTransmissionPlant/glTF/img0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Models/DiffuseTransmissionPlant/glTF/img5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Models/DiffuseTransmissionPlant/screenshot/screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Models/DiffuseTransmissionPlant/screenshot/screenshot_Large.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0a0b54e

Please sign in to comment.