Lib SSS - API shader
lib-sss.glsl
Funzioni pubbliche: getSSSCoefficients
Importa da libreria
import lib-sampler.glsl
Texture del coefficiente SSS scalare
//: param auto channel_scattering
uniform SamplerSparse sss_tex;
//: param auto scene_original_radius
uniform float sssSceneScale;
//: param custom {
//: "label": "Enable",
//: "default": true,
//: "group": "Subsurface Scattering Parameters",
//: "description": "<html><head/><body><p>Enable the Subsurface Scattering. It needs to be activated in the Display Settings and a Scattering channel needs to be present for these parameters to have an effect.</p></body></html>"
//: }
uniform bool sssEnabled;
Selezionare se la luce penetra direttamente attraverso il materiale (traslucida) o viene diffusa prima di iniziare a dispersione (pelle).
//: param custom {
//: "default": 1,
//: "label": "Scattering Type",
//: "widget": "combobox",
//: "values": {
//: "Translucent": 0,
//: "Skin": 1
//: },
//: "group": "Subsurface Scattering Parameters",
//: "description": "<html><head/><body><p>Skin or Translucent/Generic. It needs to be activated in the Display Settings and a Scattering channel needs to be present for these parameters to have an effect.</p></body></html>"
//: }
uniform int sssType;
Scala globale per l’effetto di dispersione sotto la superficie
//: param custom {
//: "default": 0.5,
//: "label": "Scale",
//: "min": 0.01,
//: "max": 1.0,
//: "group": "Subsurface Scattering Parameters",
//: "description": "<html><head/><body><p>Controls the radius/depth of the light absorption in the material. It needs to be activated in the Display Settings and a Scattering channel needs to be present for these parameters to have an effect.</p></body></html>"
//: }
uniform float sssScale;
Dipendenza della lunghezza d’onda dell’SSS del materiale
//: param custom {
//: "default": [0.701, 0.301, 0.305],
//: "label": "Color",
//: "widget": "color",
//: "group": "Subsurface Scattering Parameters",
//: "description": "<html><head/><body><p>The color of light when absorbed by the material. It needs to be activated in the Display Settings and a Scattering channel needs to be present for these parameters to have an effect.</p></body></html>"
//: }
uniform vec3 sssColor;
Restituire i coefficienti SSS del materiale
vec4 getSSSCoefficients(float scattering) {
if (sssEnabled) {
vec3 sss = sssScale / sssSceneScale * scattering * sssColor;
return vec4(sss, sss == vec3(0.0) ? 0.0 : 1.0);
}
return vec4(0.0);
}
vec4 getSSSCoefficients(SparseCoord coord) {
if (sssEnabled) {
return getSSSCoefficients(getScattering(sss_tex, coord));
}
return vec4(0.0);
}
recommendation-more-help
substance-3d-painter-help-guide