Skip to content

Commit

Permalink
Add refraction_strength to PBS' JSON material
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Mar 17, 2024
1 parent caaaed3 commit fb27a18
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Components/Hlms/Pbs/src/OgreHlmsJsonPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ namespace Ogre
changeBlendblock );
}

itor = json.FindMember( "refraction_strength" );
if( itor != json.MemberEnd() && itor->value.IsNumber() )
pbsDatablock->setRefractionStrength( static_cast<float>( itor->value.GetDouble() ) );

itor = json.FindMember( "clear_coat" );
if( itor != json.MemberEnd() && itor->value.IsObject() )
{
Expand Down Expand Up @@ -837,6 +841,9 @@ namespace Ogre
outString += "\n\t\t\t}";
}

outString += ",\n\t\t\t\"refraction_strength\" : ";
outString += StringConverter::toString( pbsDatablock->getRefractionStrength() );

if( pbsDatablock->getClearCoat() != 0.0f )
{
outString += ",\n\t\t\t\"clear_coat\" :\n\t\t\t{";
Expand Down
1 change: 1 addition & 0 deletions Docs/2.0/JSON/PbsAllSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ including invalid combinations (i.e. having a Metallic texture and a Specular te
"shadow_const_bias" : 0.01,
"two_sided" : false,
"receive_shadows" : true,
"refraction_strength" : 0.2,

"workflow" : "specular_ogre" "specular_fresnel" "metallic",

Expand Down
8 changes: 8 additions & 0 deletions Docs/src/manual/HlmsPBSDatablockReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ Reference Guide: HLMS PBS Datablock {#hlmspbsdatablockref}
- If switching from the 'default' BRDF implementation, the scene will be too bright. If so, divide light power by PI.
- **DEFAULT="default"**

## Parameter: refraction_strength

- Value of type float
- See Ogre::HlmsPbsDatablock::setRefractionStrength
- **DEFAULT=0.075**

## Parameter: detail_diffuse[X] {#dbParamDetailDiffuse}
- Name of the detail map to be used on top of the diffuse colour
- Can contain up to 4 detail_diffuse blocks (`detail_diffuse0` to `detail_diffuse3`)
Expand Down Expand Up @@ -263,6 +269,8 @@ Reference Guide: HLMS PBS Datablock {#hlmspbsdatablockref}
"macroblock" : "macroblock_name",
"macroblock" : ["macroblock_name", "macroblock_name_for_shadows"],
"shadow_const_bias" : 0.01,
"refraction_strength" : 0.2,
"brdf" : "default",
"detail_diffuse0" :
Expand Down

0 comments on commit fb27a18

Please sign in to comment.