@zephyr3d/scene 0.9.5 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation/joint_dynamics/controller.js +92 -32
- package/dist/animation/joint_dynamics/controller.js.map +1 -1
- package/dist/animation/joint_dynamics/convex_collider.js +320 -0
- package/dist/animation/joint_dynamics/convex_collider.js.map +1 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +57 -19
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
- package/dist/animation/joint_dynamics/solver.js +71 -27
- package/dist/animation/joint_dynamics/solver.js.map +1 -1
- package/dist/animation/joint_dynamics_modifier.js +21 -20
- package/dist/animation/joint_dynamics_modifier.js.map +1 -1
- package/dist/animation/skeleton.js +7 -10
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/app/engine.js +134 -140
- package/dist/app/engine.js.map +1 -1
- package/dist/app/scriptregistry.js +47 -16
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +3 -1
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/model.js +346 -7
- package/dist/asset/model.js.map +1 -1
- package/dist/avatar/wardrobe.js +20 -16
- package/dist/avatar/wardrobe.js.map +1 -1
- package/dist/camera/camera.js +416 -210
- package/dist/camera/camera.js.map +1 -1
- package/dist/index.d.ts +1350 -621
- package/dist/index.js +6 -11
- package/dist/index.js.map +1 -1
- package/dist/material/blinn.js +1 -1
- package/dist/material/blinn.js.map +1 -1
- package/dist/material/lambert.js +1 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +23 -1
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +178 -23
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/albedocolor.js +4 -4
- package/dist/material/mixins/albedocolor.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +2 -1
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +2 -1
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +63 -16
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +105 -32
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +16 -6
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +1 -1
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +276 -65
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/mixins/texture.js +3 -3
- package/dist/material/mixins/texture.js.map +1 -1
- package/dist/material/mixins/vertexcolor.js +2 -2
- package/dist/material/mixins/vertexcolor.js.map +1 -1
- package/dist/material/msdf_text.js +3 -3
- package/dist/material/msdf_text.js.map +1 -1
- package/dist/material/mtoon.js +574 -0
- package/dist/material/mtoon.js.map +1 -0
- package/dist/material/pbrblueprint.js +499 -336
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/material/pbrmr.js +118 -100
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/pbrsg.js +1 -1
- package/dist/material/pbrsg.js.map +1 -1
- package/dist/material/shader/helper.js +324 -294
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/subsurfaceprofile.js +812 -0
- package/dist/material/subsurfaceprofile.js.map +1 -0
- package/dist/material/unlit.js +1 -1
- package/dist/material/unlit.js.map +1 -1
- package/dist/posteffect/compositor.js +46 -11
- package/dist/posteffect/compositor.js.map +1 -1
- package/dist/posteffect/ssr.js +422 -96
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/posteffect/sss.js +1053 -0
- package/dist/posteffect/sss.js.map +1 -0
- package/dist/posteffect/taa.js +61 -60
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/render/abuffer_oit.js +63 -12
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/cluster_light.js +6 -5
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/drawable.js +1 -5
- package/dist/render/drawable.js.map +1 -1
- package/dist/render/drawable_mixin.js +2 -1
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/fbm_wavegenerator.js +2 -1
- package/dist/render/fbm_wavegenerator.js.map +1 -1
- package/dist/render/gerstner_wavegenerator.js +2 -1
- package/dist/render/gerstner_wavegenerator.js.map +1 -1
- package/dist/render/globalbindgroup_allocator.js +2 -1
- package/dist/render/globalbindgroup_allocator.js.map +1 -1
- package/dist/render/lightpass.js +110 -23
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/render_queue.js +51 -8
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderer.js +80 -66
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/rendergraph/device_pool_allocator.js +8 -0
- package/dist/render/rendergraph/device_pool_allocator.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +481 -95
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/history_resource_manager.js +55 -0
- package/dist/render/rendergraph/history_resource_manager.js.map +1 -1
- package/dist/render/rendergraph/history_resources.js +3 -1
- package/dist/render/rendergraph/history_resources.js.map +1 -1
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/renderpass.js +10 -4
- package/dist/render/renderpass.js.map +1 -1
- package/dist/render/sky.js +31 -1
- package/dist/render/sky.js.map +1 -1
- package/dist/render/weightedblended_oit.js +23 -5
- package/dist/render/weightedblended_oit.js.map +1 -1
- package/dist/scene/basesprite.js +4 -2
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +3 -1
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +11 -1
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/light.js +21 -3
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +29 -14
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/meshdrawable.js +6 -0
- package/dist/scene/meshdrawable.js.map +1 -1
- package/dist/scene/msdftext.js +5 -2
- package/dist/scene/msdftext.js.map +1 -1
- package/dist/scene/msdftextsprite.js +5 -3
- package/dist/scene/msdftextsprite.js.map +1 -1
- package/dist/scene/particlesys.js +3 -1
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/scene.js +6 -5
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/terrain-cm/grass.js +4 -2
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/grassmaterial.js +2 -1
- package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +4 -2
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/water.js +4 -2
- package/dist/scene/water.js.map +1 -1
- package/dist/shaders/shadow.js +26 -393
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shadow/esm.js +112 -12
- package/dist/shadow/esm.js.map +1 -1
- package/dist/shadow/pcf_opt.js +2 -2
- package/dist/shadow/pcf_opt.js.map +1 -1
- package/dist/shadow/pcf_pd.js +19 -10
- package/dist/shadow/pcf_pd.js.map +1 -1
- package/dist/shadow/shader.js +58 -7
- package/dist/shadow/shader.js.map +1 -1
- package/dist/shadow/shadow_impl.js +6 -0
- package/dist/shadow/shadow_impl.js.map +1 -1
- package/dist/shadow/shadow_region.js +229 -0
- package/dist/shadow/shadow_region.js.map +1 -0
- package/dist/shadow/shadowmapper.js +67 -59
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shadow/vsm.js +45 -19
- package/dist/shadow/vsm.js.map +1 -1
- package/dist/text/font/cff_font.js +890 -0
- package/dist/text/font/cff_font.js.map +1 -0
- package/dist/text/font/font_asset.js +17 -3
- package/dist/text/font/font_asset.js.map +1 -1
- package/dist/utility/blueprint/common/constants.js +8 -8
- package/dist/utility/blueprint/common/constants.js.map +1 -1
- package/dist/utility/blueprint/material/pbr.js +31 -4
- package/dist/utility/blueprint/material/pbr.js.map +1 -1
- package/dist/utility/blueprint/material/texture.js +1 -17
- package/dist/utility/blueprint/material/texture.js.map +1 -1
- package/dist/utility/serialization/manager.js +327 -359
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +5 -2
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +4 -1
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +249 -54
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/common.js +37 -1
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +42 -3
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +1112 -646
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +7 -4
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +31 -12
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +4 -1
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +3 -1
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/scene.js +18 -0
- package/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/utility/serialization/scene/sprite.js +6 -3
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +5 -2
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/text.js +3 -1
- package/dist/utility/serialization/scene/text.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +4 -1
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/textures/ltcdata.js +6 -0
- package/dist/utility/textures/ltcdata.js.map +1 -0
- package/dist/utility/textures/ltclut.js +61 -0
- package/dist/utility/textures/ltclut.js.map +1 -0
- package/dist/values.js +9 -1
- package/dist/values.js.map +1 -1
- package/package.json +3 -3
- package/dist/animation/ik/ik_chain_builder.js +0 -68
- package/dist/animation/ik/ik_chain_builder.js.map +0 -1
- package/dist/animation/ik/ik_pole_constraint.js +0 -123
- package/dist/animation/ik/ik_pole_constraint.js.map +0 -1
- package/dist/animation/ik/ik_track.js +0 -96
- package/dist/animation/ik/ik_track.js.map +0 -1
- package/dist/animation/ik_postprocessor.js +0 -71
- package/dist/animation/ik_postprocessor.js.map +0 -1
- package/dist/animation/joint_dynamics/math.js +0 -16
- package/dist/animation/joint_dynamics/math.js.map +0 -1
- package/dist/animation/manual_transform_processor.js +0 -156
- package/dist/animation/manual_transform_processor.js.map +0 -1
- package/dist/animation/skeleton_postprocessor.js +0 -50
- package/dist/animation/skeleton_postprocessor.js.map +0 -1
- package/dist/animation/spring2/collision.js +0 -469
- package/dist/animation/spring2/collision.js.map +0 -1
- package/dist/animation/spring2/constraints.js +0 -329
- package/dist/animation/spring2/constraints.js.map +0 -1
- package/dist/animation/spring2/controller.js +0 -434
- package/dist/animation/spring2/controller.js.map +0 -1
- package/dist/animation/spring2/math.js +0 -16
- package/dist/animation/spring2/math.js.map +0 -1
- package/dist/animation/spring2/solver.js +0 -624
- package/dist/animation/spring2/solver.js.map +0 -1
- package/dist/animation/spring2/spring_system.js +0 -118
- package/dist/animation/spring2/spring_system.js.map +0 -1
- package/dist/animation/spring2/types.js +0 -19
- package/dist/animation/spring2/types.js.map +0 -1
- package/dist/animation/spring_postprocessor.js +0 -54
- package/dist/animation/spring_postprocessor.js.map +0 -1
- package/dist/asset/loaders/gltf/gltf_loader.js +0 -1276
- package/dist/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/asset/loaders/gltf/helpers.js +0 -331
- package/dist/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/material/sprite3d.js +0 -301
- package/dist/material/sprite3d.js.map +0 -1
- package/dist/material/sprite3d_std.js +0 -116
- package/dist/material/sprite3d_std.js.map +0 -1
- package/dist/material/sprite3dblueprint.js +0 -235
- package/dist/material/sprite3dblueprint.js.map +0 -1
- package/dist/material/sprite_sdf.js +0 -106
- package/dist/material/sprite_sdf.js.map +0 -1
- package/dist/material/terrainmaterial.js +0 -368
- package/dist/material/terrainmaterial.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js +0 -38
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimemgr.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js +0 -10
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/runtimescript.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js +0 -127
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptingsystem.js.map +0 -1
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js +0 -263
- package/dist/node_modules/@zephyr3d/runtime/dist/runtime/scriptregistry.js.map +0 -1
- package/dist/render/deferredlightpass.js +0 -510
- package/dist/render/deferredlightpass.js.map +0 -1
- package/dist/render/deferredshadowlightpass.js +0 -428
- package/dist/render/deferredshadowlightpass.js.map +0 -1
- package/dist/render/gbufferpass.js +0 -50
- package/dist/render/gbufferpass.js.map +0 -1
- package/dist/scene/sdftextsprite.js +0 -322
- package/dist/scene/sdftextsprite.js.map +0 -1
- package/dist/scene/sprite3d.js +0 -18
- package/dist/scene/sprite3d.js.map +0 -1
- package/dist/scene/terrain/grass.js +0 -280
- package/dist/scene/terrain/grass.js.map +0 -1
- package/dist/scene/terrain/heightfield.js +0 -475
- package/dist/scene/terrain/heightfield.js.map +0 -1
- package/dist/scene/terrain/patch.js +0 -532
- package/dist/scene/terrain/patch.js.map +0 -1
- package/dist/scene/terrain/quadtree.js +0 -461
- package/dist/scene/terrain/quadtree.js.map +0 -1
- package/dist/scene/terrain/terrain.js +0 -231
- package/dist/scene/terrain/terrain.js.map +0 -1
- package/dist/src/animation/animation.js +0 -127
- package/dist/src/animation/animation.js.map +0 -1
- package/dist/src/animation/animationset.js +0 -255
- package/dist/src/animation/animationset.js.map +0 -1
- package/dist/src/animation/animationtrack.js +0 -34
- package/dist/src/animation/animationtrack.js.map +0 -1
- package/dist/src/animation/eulerrotationtrack.js +0 -52
- package/dist/src/animation/eulerrotationtrack.js.map +0 -1
- package/dist/src/animation/morphtarget.js +0 -93
- package/dist/src/animation/morphtarget.js.map +0 -1
- package/dist/src/animation/morphtrack.js +0 -70
- package/dist/src/animation/morphtrack.js.map +0 -1
- package/dist/src/animation/proptrack.js +0 -161
- package/dist/src/animation/proptrack.js.map +0 -1
- package/dist/src/animation/rotationtrack.js +0 -51
- package/dist/src/animation/rotationtrack.js.map +0 -1
- package/dist/src/animation/scaletrack.js +0 -50
- package/dist/src/animation/scaletrack.js.map +0 -1
- package/dist/src/animation/skeleton.js +0 -204
- package/dist/src/animation/skeleton.js.map +0 -1
- package/dist/src/animation/translationtrack.js +0 -50
- package/dist/src/animation/translationtrack.js.map +0 -1
- package/dist/src/app/app.js +0 -129
- package/dist/src/app/app.js.map +0 -1
- package/dist/src/app/inputmgr.js +0 -267
- package/dist/src/app/inputmgr.js.map +0 -1
- package/dist/src/asset/assetmanager.js +0 -404
- package/dist/src/asset/assetmanager.js.map +0 -1
- package/dist/src/asset/builtin.js +0 -337
- package/dist/src/asset/builtin.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds.js +0 -470
- package/dist/src/asset/loaders/dds/dds.js.map +0 -1
- package/dist/src/asset/loaders/dds/dds_loader.js +0 -28
- package/dist/src/asset/loaders/dds/dds_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/gltf_loader.js +0 -1265
- package/dist/src/asset/loaders/gltf/gltf_loader.js.map +0 -1
- package/dist/src/asset/loaders/gltf/helpers.js +0 -327
- package/dist/src/asset/loaders/gltf/helpers.js.map +0 -1
- package/dist/src/asset/loaders/hdr/hdr.js +0 -180
- package/dist/src/asset/loaders/hdr/hdr.js.map +0 -1
- package/dist/src/asset/loaders/image/tga_Loader.js +0 -116
- package/dist/src/asset/loaders/image/tga_Loader.js.map +0 -1
- package/dist/src/asset/loaders/image/webimage_loader.js +0 -63
- package/dist/src/asset/loaders/image/webimage_loader.js.map +0 -1
- package/dist/src/asset/loaders/loader.js +0 -45
- package/dist/src/asset/loaders/loader.js.map +0 -1
- package/dist/src/asset/model.js +0 -414
- package/dist/src/asset/model.js.map +0 -1
- package/dist/src/blitter/bilateralblur.js +0 -221
- package/dist/src/blitter/bilateralblur.js.map +0 -1
- package/dist/src/blitter/blitter.js +0 -390
- package/dist/src/blitter/blitter.js.map +0 -1
- package/dist/src/blitter/box.js +0 -118
- package/dist/src/blitter/box.js.map +0 -1
- package/dist/src/blitter/copy.js +0 -22
- package/dist/src/blitter/copy.js.map +0 -1
- package/dist/src/blitter/gaussianblur.js +0 -228
- package/dist/src/blitter/gaussianblur.js.map +0 -1
- package/dist/src/camera/base.js +0 -92
- package/dist/src/camera/base.js.map +0 -1
- package/dist/src/camera/camera.js +0 -1005
- package/dist/src/camera/camera.js.map +0 -1
- package/dist/src/camera/fps.js +0 -238
- package/dist/src/camera/fps.js.map +0 -1
- package/dist/src/camera/orbit.js +0 -245
- package/dist/src/camera/orbit.js.map +0 -1
- package/dist/src/camera/orthocamera.js +0 -167
- package/dist/src/camera/orthocamera.js.map +0 -1
- package/dist/src/camera/perspectivecamera.js +0 -141
- package/dist/src/camera/perspectivecamera.js.map +0 -1
- package/dist/src/index.js +0 -120
- package/dist/src/index.js.map +0 -1
- package/dist/src/material/blinn.js +0 -81
- package/dist/src/material/blinn.js.map +0 -1
- package/dist/src/material/grassmaterial.js +0 -113
- package/dist/src/material/grassmaterial.js.map +0 -1
- package/dist/src/material/lambert.js +0 -92
- package/dist/src/material/lambert.js.map +0 -1
- package/dist/src/material/material.js +0 -301
- package/dist/src/material/material.js.map +0 -1
- package/dist/src/material/meshmaterial.js +0 -704
- package/dist/src/material/meshmaterial.js.map +0 -1
- package/dist/src/material/mixins/albedocolor.js +0 -76
- package/dist/src/material/mixins/albedocolor.js.map +0 -1
- package/dist/src/material/mixins/foliage.js +0 -47
- package/dist/src/material/mixins/foliage.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/blinnphong.js +0 -112
- package/dist/src/material/mixins/lightmodel/blinnphong.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/lambert.js +0 -58
- package/dist/src/material/mixins/lightmodel/lambert.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js +0 -178
- package/dist/src/material/mixins/lightmodel/pbrmetallicroughness.js.map +0 -1
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js +0 -139
- package/dist/src/material/mixins/lightmodel/pbrspecularglossness.js.map +0 -1
- package/dist/src/material/mixins/lit.js +0 -476
- package/dist/src/material/mixins/lit.js.map +0 -1
- package/dist/src/material/mixins/pbr/common.js +0 -918
- package/dist/src/material/mixins/pbr/common.js.map +0 -1
- package/dist/src/material/mixins/texture.js +0 -172
- package/dist/src/material/mixins/texture.js.map +0 -1
- package/dist/src/material/mixins/vertexcolor.js +0 -56
- package/dist/src/material/mixins/vertexcolor.js.map +0 -1
- package/dist/src/material/particle.js +0 -178
- package/dist/src/material/particle.js.map +0 -1
- package/dist/src/material/pbrmr.js +0 -97
- package/dist/src/material/pbrmr.js.map +0 -1
- package/dist/src/material/pbrsg.js +0 -97
- package/dist/src/material/pbrsg.js.map +0 -1
- package/dist/src/material/shader/helper.js +0 -1209
- package/dist/src/material/shader/helper.js.map +0 -1
- package/dist/src/material/terrain-cm.js +0 -606
- package/dist/src/material/terrain-cm.js.map +0 -1
- package/dist/src/material/terrainmaterial.js +0 -375
- package/dist/src/material/terrainmaterial.js.map +0 -1
- package/dist/src/material/unlit.js +0 -41
- package/dist/src/material/unlit.js.map +0 -1
- package/dist/src/material/water.js +0 -417
- package/dist/src/material/water.js.map +0 -1
- package/dist/src/posteffect/bloom.js +0 -361
- package/dist/src/posteffect/bloom.js.map +0 -1
- package/dist/src/posteffect/compositor.js +0 -226
- package/dist/src/posteffect/compositor.js.map +0 -1
- package/dist/src/posteffect/fxaa.js +0 -273
- package/dist/src/posteffect/fxaa.js.map +0 -1
- package/dist/src/posteffect/grayscale.js +0 -69
- package/dist/src/posteffect/grayscale.js.map +0 -1
- package/dist/src/posteffect/motionblur.js +0 -96
- package/dist/src/posteffect/motionblur.js.map +0 -1
- package/dist/src/posteffect/posteffect.js +0 -126
- package/dist/src/posteffect/posteffect.js.map +0 -1
- package/dist/src/posteffect/sao.js +0 -324
- package/dist/src/posteffect/sao.js.map +0 -1
- package/dist/src/posteffect/ssr.js +0 -489
- package/dist/src/posteffect/ssr.js.map +0 -1
- package/dist/src/posteffect/taa.js +0 -172
- package/dist/src/posteffect/taa.js.map +0 -1
- package/dist/src/posteffect/tonemap.js +0 -94
- package/dist/src/posteffect/tonemap.js.map +0 -1
- package/dist/src/render/abuffer_oit.js +0 -361
- package/dist/src/render/abuffer_oit.js.map +0 -1
- package/dist/src/render/clipmap.js +0 -851
- package/dist/src/render/clipmap.js.map +0 -1
- package/dist/src/render/cluster_light.js +0 -333
- package/dist/src/render/cluster_light.js.map +0 -1
- package/dist/src/render/cull_visitor.js +0 -187
- package/dist/src/render/cull_visitor.js.map +0 -1
- package/dist/src/render/depthpass.js +0 -68
- package/dist/src/render/depthpass.js.map +0 -1
- package/dist/src/render/drawable_mixin.js +0 -227
- package/dist/src/render/drawable_mixin.js.map +0 -1
- package/dist/src/render/envlight.js +0 -463
- package/dist/src/render/envlight.js.map +0 -1
- package/dist/src/render/fbm_wavegenerator.js +0 -251
- package/dist/src/render/fbm_wavegenerator.js.map +0 -1
- package/dist/src/render/fft_wavegenerator.js +0 -1006
- package/dist/src/render/fft_wavegenerator.js.map +0 -1
- package/dist/src/render/fullscreenquad.js +0 -38
- package/dist/src/render/fullscreenquad.js.map +0 -1
- package/dist/src/render/gerstner_wavegenerator.js +0 -314
- package/dist/src/render/gerstner_wavegenerator.js.map +0 -1
- package/dist/src/render/globalbindgroup_allocator.js +0 -60
- package/dist/src/render/globalbindgroup_allocator.js.map +0 -1
- package/dist/src/render/hzb.js +0 -273
- package/dist/src/render/hzb.js.map +0 -1
- package/dist/src/render/lightpass.js +0 -172
- package/dist/src/render/lightpass.js.map +0 -1
- package/dist/src/render/objectcolorpass.js +0 -51
- package/dist/src/render/objectcolorpass.js.map +0 -1
- package/dist/src/render/primitive.js +0 -364
- package/dist/src/render/primitive.js.map +0 -1
- package/dist/src/render/render_queue.js +0 -467
- package/dist/src/render/render_queue.js.map +0 -1
- package/dist/src/render/renderbundle_wrapper.js +0 -152
- package/dist/src/render/renderbundle_wrapper.js.map +0 -1
- package/dist/src/render/renderer.js +0 -455
- package/dist/src/render/renderer.js.map +0 -1
- package/dist/src/render/renderpass.js +0 -200
- package/dist/src/render/renderpass.js.map +0 -1
- package/dist/src/render/shadowmap_pass.js +0 -56
- package/dist/src/render/shadowmap_pass.js.map +0 -1
- package/dist/src/render/sky.js +0 -1103
- package/dist/src/render/sky.js.map +0 -1
- package/dist/src/render/weightedblended_oit.js +0 -168
- package/dist/src/render/weightedblended_oit.js.map +0 -1
- package/dist/src/scene/batchgroup.js +0 -162
- package/dist/src/scene/batchgroup.js.map +0 -1
- package/dist/src/scene/environment.js +0 -209
- package/dist/src/scene/environment.js.map +0 -1
- package/dist/src/scene/graph_node.js +0 -72
- package/dist/src/scene/graph_node.js.map +0 -1
- package/dist/src/scene/light.js +0 -416
- package/dist/src/scene/light.js.map +0 -1
- package/dist/src/scene/mesh.js +0 -341
- package/dist/src/scene/mesh.js.map +0 -1
- package/dist/src/scene/octree.js +0 -649
- package/dist/src/scene/octree.js.map +0 -1
- package/dist/src/scene/particlesys.js +0 -738
- package/dist/src/scene/particlesys.js.map +0 -1
- package/dist/src/scene/raycast_visitor.js +0 -103
- package/dist/src/scene/raycast_visitor.js.map +0 -1
- package/dist/src/scene/scene.js +0 -284
- package/dist/src/scene/scene.js.map +0 -1
- package/dist/src/scene/scene_node.js +0 -732
- package/dist/src/scene/scene_node.js.map +0 -1
- package/dist/src/scene/terrain/grass.js +0 -278
- package/dist/src/scene/terrain/grass.js.map +0 -1
- package/dist/src/scene/terrain/heightfield.js +0 -475
- package/dist/src/scene/terrain/heightfield.js.map +0 -1
- package/dist/src/scene/terrain/patch.js +0 -530
- package/dist/src/scene/terrain/patch.js.map +0 -1
- package/dist/src/scene/terrain/quadtree.js +0 -461
- package/dist/src/scene/terrain/quadtree.js.map +0 -1
- package/dist/src/scene/terrain/terrain.js +0 -246
- package/dist/src/scene/terrain/terrain.js.map +0 -1
- package/dist/src/scene/terrain-cm/grass.js +0 -594
- package/dist/src/scene/terrain-cm/grass.js.map +0 -1
- package/dist/src/scene/terrain-cm/grassmaterial.js +0 -159
- package/dist/src/scene/terrain-cm/grassmaterial.js.map +0 -1
- package/dist/src/scene/terrain-cm/terrain-cm.js +0 -538
- package/dist/src/scene/terrain-cm/terrain-cm.js.map +0 -1
- package/dist/src/scene/water.js +0 -374
- package/dist/src/scene/water.js.map +0 -1
- package/dist/src/shaders/atmosphere.js +0 -957
- package/dist/src/shaders/atmosphere.js.map +0 -1
- package/dist/src/shaders/fog.js +0 -112
- package/dist/src/shaders/fog.js.map +0 -1
- package/dist/src/shaders/misc.js +0 -266
- package/dist/src/shaders/misc.js.map +0 -1
- package/dist/src/shaders/noise.js +0 -222
- package/dist/src/shaders/noise.js.map +0 -1
- package/dist/src/shaders/pbr.js +0 -51
- package/dist/src/shaders/pbr.js.map +0 -1
- package/dist/src/shaders/shadow.js +0 -636
- package/dist/src/shaders/shadow.js.map +0 -1
- package/dist/src/shaders/ssr.js +0 -490
- package/dist/src/shaders/ssr.js.map +0 -1
- package/dist/src/shaders/temporal.js +0 -215
- package/dist/src/shaders/temporal.js.map +0 -1
- package/dist/src/shaders/water.js +0 -756
- package/dist/src/shaders/water.js.map +0 -1
- package/dist/src/shadow/esm.js +0 -237
- package/dist/src/shadow/esm.js.map +0 -1
- package/dist/src/shadow/pcf_opt.js +0 -181
- package/dist/src/shadow/pcf_opt.js.map +0 -1
- package/dist/src/shadow/pcf_pd.js +0 -189
- package/dist/src/shadow/pcf_pd.js.map +0 -1
- package/dist/src/shadow/shader.js +0 -37
- package/dist/src/shadow/shader.js.map +0 -1
- package/dist/src/shadow/shadow_impl.js +0 -15
- package/dist/src/shadow/shadow_impl.js.map +0 -1
- package/dist/src/shadow/shadowmapper.js +0 -790
- package/dist/src/shadow/shadowmapper.js.map +0 -1
- package/dist/src/shadow/ssm.js +0 -159
- package/dist/src/shadow/ssm.js.map +0 -1
- package/dist/src/shadow/vsm.js +0 -297
- package/dist/src/shadow/vsm.js.map +0 -1
- package/dist/src/shapes/box.js +0 -386
- package/dist/src/shapes/box.js.map +0 -1
- package/dist/src/shapes/cylinder.js +0 -125
- package/dist/src/shapes/cylinder.js.map +0 -1
- package/dist/src/shapes/plane.js +0 -88
- package/dist/src/shapes/plane.js.map +0 -1
- package/dist/src/shapes/shape.js +0 -87
- package/dist/src/shapes/shape.js.map +0 -1
- package/dist/src/shapes/sphere.js +0 -114
- package/dist/src/shapes/sphere.js.map +0 -1
- package/dist/src/shapes/tetrahedron.js +0 -188
- package/dist/src/shapes/tetrahedron.js.map +0 -1
- package/dist/src/shapes/torus.js +0 -111
- package/dist/src/shapes/torus.js.map +0 -1
- package/dist/src/utility/aabbtree.js +0 -400
- package/dist/src/utility/aabbtree.js.map +0 -1
- package/dist/src/utility/bounding_volume.js +0 -29
- package/dist/src/utility/bounding_volume.js.map +0 -1
- package/dist/src/utility/debug.js +0 -28
- package/dist/src/utility/debug.js.map +0 -1
- package/dist/src/utility/draco/decoder.js +0 -116
- package/dist/src/utility/draco/decoder.js.map +0 -1
- package/dist/src/utility/misc.js +0 -105
- package/dist/src/utility/misc.js.map +0 -1
- package/dist/src/utility/panorama.js +0 -163
- package/dist/src/utility/panorama.js.map +0 -1
- package/dist/src/utility/pmrem.js +0 -354
- package/dist/src/utility/pmrem.js.map +0 -1
- package/dist/src/utility/rendermipmap.js +0 -115
- package/dist/src/utility/rendermipmap.js.map +0 -1
- package/dist/src/utility/serialization/json.js +0 -402
- package/dist/src/utility/serialization/json.js.map +0 -1
- package/dist/src/utility/serialization/manager.js +0 -623
- package/dist/src/utility/serialization/manager.js.map +0 -1
- package/dist/src/utility/serialization/scene/animation.js +0 -248
- package/dist/src/utility/serialization/scene/animation.js.map +0 -1
- package/dist/src/utility/serialization/scene/batch.js +0 -59
- package/dist/src/utility/serialization/scene/batch.js.map +0 -1
- package/dist/src/utility/serialization/scene/camera.js +0 -790
- package/dist/src/utility/serialization/scene/camera.js.map +0 -1
- package/dist/src/utility/serialization/scene/common.js +0 -222
- package/dist/src/utility/serialization/scene/common.js.map +0 -1
- package/dist/src/utility/serialization/scene/light.js +0 -575
- package/dist/src/utility/serialization/scene/light.js.map +0 -1
- package/dist/src/utility/serialization/scene/material.js +0 -1111
- package/dist/src/utility/serialization/scene/material.js.map +0 -1
- package/dist/src/utility/serialization/scene/mesh.js +0 -148
- package/dist/src/utility/serialization/scene/mesh.js.map +0 -1
- package/dist/src/utility/serialization/scene/misc.js +0 -39
- package/dist/src/utility/serialization/scene/misc.js.map +0 -1
- package/dist/src/utility/serialization/scene/node.js +0 -451
- package/dist/src/utility/serialization/scene/node.js.map +0 -1
- package/dist/src/utility/serialization/scene/particle.js +0 -425
- package/dist/src/utility/serialization/scene/particle.js.map +0 -1
- package/dist/src/utility/serialization/scene/primitive.js +0 -692
- package/dist/src/utility/serialization/scene/primitive.js.map +0 -1
- package/dist/src/utility/serialization/scene/scene.js +0 -704
- package/dist/src/utility/serialization/scene/scene.js.map +0 -1
- package/dist/src/utility/serialization/scene/terrain.js +0 -488
- package/dist/src/utility/serialization/scene/terrain.js.map +0 -1
- package/dist/src/utility/serialization/scene/water.js +0 -465
- package/dist/src/utility/serialization/scene/water.js.map +0 -1
- package/dist/src/utility/shprojector.js +0 -297
- package/dist/src/utility/shprojector.js.map +0 -1
- package/dist/src/utility/textures/ggxlut.js +0 -213
- package/dist/src/utility/textures/ggxlut.js.map +0 -1
- package/dist/src/utility/textures/gradientnoise.js +0 -62
- package/dist/src/utility/textures/gradientnoise.js.map +0 -1
- package/dist/src/utility/textures/randomnoise.js +0 -41
- package/dist/src/utility/textures/randomnoise.js.map +0 -1
- package/dist/src/values.js +0 -162
- package/dist/src/values.js.map +0 -1
- package/dist/utility/blueprint/material/common.js +0 -7
- package/dist/utility/blueprint/material/common.js.map +0 -1
- package/dist/utility/serialization/blueprint/constants.js +0 -255
- package/dist/utility/serialization/blueprint/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/constants.js +0 -203
- package/dist/utility/serialization/blueprint/material/constants.js.map +0 -1
- package/dist/utility/serialization/blueprint/material/texture.js +0 -165
- package/dist/utility/serialization/blueprint/material/texture.js.map +0 -1
- package/dist/utility/serialization/scene/cloth_script.js +0 -834
- package/dist/utility/serialization/scene/cloth_script.js.map +0 -1
- package/dist/utility/serialization/scene/spring_script.js +0 -596
- package/dist/utility/serialization/scene/spring_script.js.map +0 -1
|
@@ -2,6 +2,7 @@ import { applyMaterialMixins } from '../../meshmaterial.js';
|
|
|
2
2
|
import { Vector4, Vector3 } from '@zephyr3d/base';
|
|
3
3
|
import { getGGXLUT } from '../../../utility/textures/ggxlut.js';
|
|
4
4
|
import { getSheenLUT } from '../../../utility/textures/sheenlut.js';
|
|
5
|
+
import { getLTCMatLUT, getLTCAmpLUT } from '../../../utility/textures/ltclut.js';
|
|
5
6
|
import { mixinTextureProps } from '../texture.js';
|
|
6
7
|
import { ShaderHelper } from '../../shader/helper.js';
|
|
7
8
|
import { MaterialVaryingFlags, RENDER_PASS_TYPE_LIGHT } from '../../../values.js';
|
|
@@ -24,12 +25,14 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
24
25
|
let FEATURE_IRIDESCENCE = 0;
|
|
25
26
|
const EMISSIVE_COLOR_UNIFORM = S.defineInstanceUniform('emissiveColor', 'rgb', 'EmissiveColor');
|
|
26
27
|
const EMISSIVE_STRENGTH_UNIFORM = S.defineInstanceUniform('emissiveStrength', 'float', 'EmissiveStrength');
|
|
28
|
+
const RECT_SPECULAR_SCALE_UNIFORM = S.defineInstanceUniform('rectSpecularScale', 'float', 'RectSpecularScale');
|
|
27
29
|
const cls = class extends S {
|
|
28
30
|
static pbrCommonMixed = true;
|
|
29
31
|
_f0;
|
|
30
32
|
_emissiveColor;
|
|
31
33
|
_emissiveStrength;
|
|
32
34
|
_occlusionStrength;
|
|
35
|
+
_rectSpecularScale;
|
|
33
36
|
_sheenFactor;
|
|
34
37
|
_clearcoatFactor;
|
|
35
38
|
_transmissionFactor;
|
|
@@ -43,6 +46,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
43
46
|
this._occlusionStrength = 1;
|
|
44
47
|
this._emissiveColor = new Vector3(0, 0, 0);
|
|
45
48
|
this._emissiveStrength = 1;
|
|
49
|
+
this._rectSpecularScale = 1;
|
|
46
50
|
this._sheenFactor = Vector4.zero();
|
|
47
51
|
this._clearcoatFactor = new Vector4(0, 0, 1, 0);
|
|
48
52
|
this._transmissionFactor = 0;
|
|
@@ -63,6 +67,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
63
67
|
this.iridescenceThicknessMin = other.iridescenceThicknessMin;
|
|
64
68
|
this.iridescenceThicknessMax = other.iridescenceThicknessMax;
|
|
65
69
|
this.occlusionStrength = other.occlusionStrength;
|
|
70
|
+
this.rectSpecularScale = other.rectSpecularScale;
|
|
66
71
|
this.emissiveColor = other.emissiveColor;
|
|
67
72
|
this.emissiveStrength = other.emissiveStrength;
|
|
68
73
|
this.transmission = other.transmission;
|
|
@@ -166,6 +171,15 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
166
171
|
this.uniformChanged();
|
|
167
172
|
}
|
|
168
173
|
}
|
|
174
|
+
get rectSpecularScale() {
|
|
175
|
+
return this._rectSpecularScale;
|
|
176
|
+
}
|
|
177
|
+
set rectSpecularScale(val) {
|
|
178
|
+
if (val !== this._rectSpecularScale) {
|
|
179
|
+
this._rectSpecularScale = val;
|
|
180
|
+
this.uniformChanged();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
169
183
|
get emissiveColor() {
|
|
170
184
|
return this._emissiveColor;
|
|
171
185
|
}
|
|
@@ -251,6 +265,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
251
265
|
if (this.needFragmentColor() && this.drawContext.materialFlags & MaterialVaryingFlags.INSTANCING) {
|
|
252
266
|
scope.$outputs.zEmissiveColor = this.getInstancedUniform(scope, EMISSIVE_COLOR_UNIFORM);
|
|
253
267
|
scope.$outputs.zEmissiveStrength = this.getInstancedUniform(scope, EMISSIVE_STRENGTH_UNIFORM);
|
|
268
|
+
scope.$outputs.zRectSpecularScale = this.getInstancedUniform(scope, RECT_SPECULAR_SCALE_UNIFORM);
|
|
254
269
|
}
|
|
255
270
|
}
|
|
256
271
|
fragmentShader(scope) {
|
|
@@ -261,6 +276,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
261
276
|
if (!(this.drawContext.materialFlags & MaterialVaryingFlags.INSTANCING)) {
|
|
262
277
|
scope.zEmissiveColor = pb.vec3().uniform(2);
|
|
263
278
|
scope.zEmissiveStrength = pb.float().uniform(2);
|
|
279
|
+
scope.zRectSpecularScale = pb.float().uniform(2);
|
|
264
280
|
}
|
|
265
281
|
if (this.occlusionTexture) {
|
|
266
282
|
scope.zOcclusionStrength = pb.float().uniform(2);
|
|
@@ -272,7 +288,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
272
288
|
if (this.clearcoat) {
|
|
273
289
|
scope.zClearcoatFactor = pb.vec4().uniform(2);
|
|
274
290
|
}
|
|
275
|
-
if (this.
|
|
291
|
+
if (this.needsTransmissionData()) {
|
|
276
292
|
scope.zTransmissionFactor = pb.float().uniform(2);
|
|
277
293
|
scope.zThicknessFactor = pb.float().uniform(2);
|
|
278
294
|
scope.zAttenuationColor = pb.vec3().uniform(2);
|
|
@@ -284,6 +300,8 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
284
300
|
if (this.drawContext.drawEnvLight) {
|
|
285
301
|
scope.zGGXLut = pb.tex2D().uniform(2);
|
|
286
302
|
}
|
|
303
|
+
scope.zLTCMatLut = pb.tex2D().uniform(2);
|
|
304
|
+
scope.zLTCAmpLut = pb.tex2D().uniform(2);
|
|
287
305
|
}
|
|
288
306
|
}
|
|
289
307
|
needSceneColor() {
|
|
@@ -296,6 +314,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
296
314
|
if (!(ctx.materialFlags & MaterialVaryingFlags.INSTANCING)) {
|
|
297
315
|
bindGroup.setValue('zEmissiveColor', this._emissiveColor);
|
|
298
316
|
bindGroup.setValue('zEmissiveStrength', this._emissiveStrength);
|
|
317
|
+
bindGroup.setValue('zRectSpecularScale', this._rectSpecularScale);
|
|
299
318
|
}
|
|
300
319
|
if (this.occlusionTexture) {
|
|
301
320
|
bindGroup.setValue('zOcclusionStrength', this._occlusionStrength);
|
|
@@ -307,7 +326,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
307
326
|
if (this.clearcoat) {
|
|
308
327
|
bindGroup.setValue('zClearcoatFactor', this._clearcoatFactor);
|
|
309
328
|
}
|
|
310
|
-
if (this.
|
|
329
|
+
if (this.needsTransmissionData()) {
|
|
311
330
|
bindGroup.setValue('zTransmissionFactor', this._transmissionFactor);
|
|
312
331
|
bindGroup.setValue('zThicknessFactor', this._thicknessFactor);
|
|
313
332
|
bindGroup.setValue('zAttenuationColor', this._attenuationColor);
|
|
@@ -319,6 +338,8 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
319
338
|
if (ctx.drawEnvLight) {
|
|
320
339
|
bindGroup.setTexture('zGGXLut', getGGXLUT(1024));
|
|
321
340
|
}
|
|
341
|
+
bindGroup.setTexture('zLTCMatLut', getLTCMatLUT());
|
|
342
|
+
bindGroup.setTexture('zLTCAmpLut', getLTCAmpLUT());
|
|
322
343
|
}
|
|
323
344
|
}
|
|
324
345
|
getF0(scope) {
|
|
@@ -343,7 +364,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
343
364
|
pb.float('ccNoV'),
|
|
344
365
|
pb.float('ccFresnel')
|
|
345
366
|
] : [],
|
|
346
|
-
...this.
|
|
367
|
+
...this.needsTransmissionData() ? [
|
|
347
368
|
pb.float('transmissionFactor'),
|
|
348
369
|
pb.float('thicknessFactor'),
|
|
349
370
|
pb.vec3('attenuationColor'),
|
|
@@ -401,8 +422,10 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
401
422
|
if (this.clearcoatRoughnessTexture) {
|
|
402
423
|
data.ccFactor.y = pb.clamp(pb.mul(data.ccFactor.y, this.sampleClearcoatRoughnessTexture(scope).g), 0, 1);
|
|
403
424
|
}
|
|
425
|
+
scope.$l.ccF0Scalar = pb.pow(pb.div(pb.sub(data.f0.a, 1), pb.add(data.f0.a, 1)), 2);
|
|
426
|
+
data.ccFresnel = pb.add(scope.ccF0Scalar, pb.mul(pb.sub(1, scope.ccF0Scalar), pb.pow(pb.sub(1, data.ccNoV), 5)));
|
|
404
427
|
}
|
|
405
|
-
if (this.
|
|
428
|
+
if (this.needsTransmissionData()) {
|
|
406
429
|
if (this.transmissionTexture) {
|
|
407
430
|
data.transmissionFactor = pb.mul(this.sampleTransmissionTexture(scope).r, scope.zTransmissionFactor);
|
|
408
431
|
} else {
|
|
@@ -436,6 +459,16 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
436
459
|
const instancing = !!(this.drawContext.materialFlags & MaterialVaryingFlags.INSTANCING);
|
|
437
460
|
return instancing ? scope.$inputs.zEmissiveStrength : scope.zEmissiveStrength;
|
|
438
461
|
}
|
|
462
|
+
getRectSpecularScale(scope) {
|
|
463
|
+
const instancing = !!(this.drawContext.materialFlags & MaterialVaryingFlags.INSTANCING);
|
|
464
|
+
return instancing ? scope.$inputs.zRectSpecularScale : scope.zRectSpecularScale;
|
|
465
|
+
}
|
|
466
|
+
needsSSSTransmissionData() {
|
|
467
|
+
return !!this.subsurfaceProfile && this.drawContext.renderPass?.type === RENDER_PASS_TYPE_LIGHT;
|
|
468
|
+
}
|
|
469
|
+
needsTransmissionData() {
|
|
470
|
+
return this.transmission || this.needsSSSTransmissionData();
|
|
471
|
+
}
|
|
439
472
|
calculateEmissiveColor(scope) {
|
|
440
473
|
const pb = scope.$builder;
|
|
441
474
|
if (this.emissiveTexture) {
|
|
@@ -632,13 +665,22 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
632
665
|
pb.float('sourceRadiusFactor'),
|
|
633
666
|
pb.vec3('outColor').inout()
|
|
634
667
|
], function() {
|
|
635
|
-
this.$l.H = pb.normalize(pb.add(this.viewVec, this.L));
|
|
636
|
-
this.$l.NoH = pb.clamp(pb.dot(this.normal, this.H), 0, 1);
|
|
637
668
|
this.$l.NoL = pb.clamp(pb.dot(this.normal, this.L), 0, 1);
|
|
638
669
|
this.$l.NoV = pb.clamp(pb.dot(this.normal, this.viewVec), 0, 1);
|
|
639
670
|
this.$if(pb.greaterThan(this.NoL, 0), function() {
|
|
671
|
+
this.$l.specularLightDir = this.L;
|
|
672
|
+
this.$if(pb.greaterThan(this.sourceRadiusFactor, 0), function() {
|
|
673
|
+
this.$l.reflectionVec = pb.reflect(pb.neg(this.viewVec), this.normal);
|
|
674
|
+
this.$l.centerToRay = pb.sub(pb.mul(this.reflectionVec, pb.dot(this.L, this.reflectionVec)), this.L);
|
|
675
|
+
this.$l.centerToRayLength = pb.length(this.centerToRay);
|
|
676
|
+
this.$l.sphereLightBlend = pb.clamp(pb.div(this.sourceRadiusFactor, pb.max(this.centerToRayLength, 0.0001)), 0, 1);
|
|
677
|
+
this.specularLightDir = pb.normalize(pb.add(this.L, pb.mul(this.centerToRay, this.sphereLightBlend)));
|
|
678
|
+
});
|
|
679
|
+
this.$l.H = pb.normalize(pb.add(this.viewVec, this.specularLightDir));
|
|
680
|
+
this.$l.NoH = pb.clamp(pb.dot(this.normal, this.H), 0, 1);
|
|
681
|
+
this.$l.specularNoL = pb.clamp(pb.dot(this.normal, this.specularLightDir), 0, 1);
|
|
640
682
|
this.$l.VoH = pb.clamp(pb.dot(this.viewVec, this.H), 0, 1);
|
|
641
|
-
this.$l.schlickFresnel = that.fresnelSchlick(this, this.VoH,
|
|
683
|
+
this.$l.schlickFresnel = that.fresnelSchlick(this, this.VoH, this.data.f0.rgb, this.data.f90);
|
|
642
684
|
if (that.iridescence) {
|
|
643
685
|
this.$l.F = pb.mix(this.schlickFresnel, this.data.iridescenceFresnel, this.data.iridescenceFactor.x);
|
|
644
686
|
} else {
|
|
@@ -647,11 +689,20 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
647
689
|
if (that.sheen) {
|
|
648
690
|
this.$l.sheenAlbedoScaling = that.getSheenAlbedoScalingForDirect(this, this.NoV, this.NoL, this.data.sheenColor, this.data.sheenRoughness);
|
|
649
691
|
}
|
|
650
|
-
this.$l.
|
|
651
|
-
|
|
692
|
+
this.$l.baseLayerAttenuation = pb.float(1);
|
|
693
|
+
if (that.clearcoat) {
|
|
694
|
+
this.$if(pb.greaterThan(this.data.ccFactor.x, 0), function() {
|
|
695
|
+
this.$l.ccF0 = pb.vec3(pb.pow(pb.div(pb.sub(this.data.f0.a, 1), pb.add(this.data.f0.a, 1)), 2));
|
|
696
|
+
this.$l.clearcoatF = that.fresnelSchlick(this, this.VoH, this.ccF0, pb.vec3(1));
|
|
697
|
+
this.baseLayerAttenuation = pb.clamp(pb.sub(1, pb.mul(this.clearcoatF.r, this.data.ccFactor.x)), 0, 1);
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
this.$l.alphaRoughness = pb.mul(this.data.roughness, this.data.roughness);
|
|
701
|
+
this.$l.specularRoughness = pb.sqrt(this.alphaRoughness);
|
|
652
702
|
this.$l.D = that.distributionGGX(this, this.NoH, this.alphaRoughness);
|
|
653
|
-
this.$l.V = that.visGGX(this, this.NoV, this.
|
|
654
|
-
this.$l.specular = pb.mul(this.lightColor, this.D, this.V, this.F, this.specularScale);
|
|
703
|
+
this.$l.V = that.visGGX(this, this.NoV, this.specularNoL, this.alphaRoughness);
|
|
704
|
+
this.$l.specular = pb.mul(this.lightColor, this.D, this.V, this.F, this.data.specularWeight, this.specularScale);
|
|
705
|
+
this.specular = pb.mul(this.specular, this.baseLayerAttenuation);
|
|
655
706
|
if (that.sheen) {
|
|
656
707
|
this.specular = pb.mul(this.specular, this.sheenAlbedoScaling);
|
|
657
708
|
}
|
|
@@ -660,7 +711,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
660
711
|
this.$l.iridescenceFresnelMax = pb.vec3(pb.max(pb.max(this.data.iridescenceFresnel.r, this.data.iridescenceFresnel.g), this.data.iridescenceFresnel.b));
|
|
661
712
|
this.F = pb.mix(this.schlickFresnel, this.iridescenceFresnelMax, this.data.iridescenceFactor.x);
|
|
662
713
|
}
|
|
663
|
-
this.$l.diffuseBRDF = pb.mul(pb.sub(pb.vec3(1), this.F), pb.div(this.data.diffuse.rgb, Math.PI));
|
|
714
|
+
this.$l.diffuseBRDF = pb.mul(pb.sub(pb.vec3(1), pb.mul(this.F, this.data.specularWeight)), pb.div(this.data.diffuse.rgb, Math.PI));
|
|
664
715
|
this.$l.diffuse = pb.mul(this.lightColor, pb.max(this.diffuseBRDF, pb.vec3(0)), this.diffuseScale);
|
|
665
716
|
if (that.transmission && that.drawContext.renderPass.type === RENDER_PASS_TYPE_LIGHT) {
|
|
666
717
|
this.$l.transmissionRay = that.getVolumeTransmissionRay(this, this.normal, this.viewVec, this.data.thicknessFactor, this.data.f0.a);
|
|
@@ -672,6 +723,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
672
723
|
if (that.sheen) {
|
|
673
724
|
this.diffuse = pb.mul(this.diffuse, this.sheenAlbedoScaling);
|
|
674
725
|
}
|
|
726
|
+
this.diffuse = pb.mul(this.diffuse, this.baseLayerAttenuation);
|
|
675
727
|
this.outColor = pb.add(this.outColor, this.diffuse);
|
|
676
728
|
if (that.sheen) {
|
|
677
729
|
this.$l.sheenD = that.D_Charlie(this, this.NoH, this.data.sheenRoughness);
|
|
@@ -679,14 +731,15 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
679
731
|
this.outColor = pb.add(this.outColor, pb.mul(this.lightColor, this.data.sheenColor, this.sheenD, this.sheenV));
|
|
680
732
|
}
|
|
681
733
|
if (that.clearcoat) {
|
|
682
|
-
this.
|
|
734
|
+
this.$l.clearcoatAlphaRoughness = pb.mul(this.data.ccFactor.y, this.data.ccFactor.y);
|
|
735
|
+
this.alphaRoughness = this.clearcoatAlphaRoughness;
|
|
683
736
|
this.NoH = pb.clamp(pb.dot(this.data.ccNormal, this.H), 0, 1);
|
|
684
|
-
this.NoL = pb.clamp(pb.dot(this.data.ccNormal, this.
|
|
685
|
-
this.ccF0 = pb.vec3(
|
|
737
|
+
this.NoL = pb.clamp(pb.dot(this.data.ccNormal, this.specularLightDir), 0, 1);
|
|
738
|
+
this.ccF0 = pb.vec3(pb.pow(pb.div(pb.sub(this.data.f0.a, 1), pb.add(this.data.f0.a, 1)), 2));
|
|
686
739
|
this.F = that.fresnelSchlick(this, this.VoH, this.ccF0, pb.vec3(1));
|
|
687
740
|
this.D = that.distributionGGX(this, this.NoH, this.alphaRoughness);
|
|
688
741
|
this.V = that.visGGX(this, this.data.ccNoV, this.NoL, this.alphaRoughness);
|
|
689
|
-
this.outColor = pb.add(
|
|
742
|
+
this.outColor = pb.add(this.outColor, pb.mul(this.lightColor, this.D, this.V, this.F, this.data.ccFactor.x));
|
|
690
743
|
}
|
|
691
744
|
});
|
|
692
745
|
});
|
|
@@ -696,6 +749,147 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
696
749
|
const pb = scope.$builder;
|
|
697
750
|
const that = this;
|
|
698
751
|
const funcName = 'Z_PBRRectLight';
|
|
752
|
+
const LUT_SIZE = 64;
|
|
753
|
+
const LUT_SCALE = (LUT_SIZE - 1) / LUT_SIZE;
|
|
754
|
+
const LUT_BIAS = 0.5 / LUT_SIZE;
|
|
755
|
+
pb.func('Z_LTCIntegrateEdgeVec', [
|
|
756
|
+
pb.vec3('v1'),
|
|
757
|
+
pb.vec3('v2')
|
|
758
|
+
], function() {
|
|
759
|
+
this.$l.x = pb.dot(this.v1, this.v2);
|
|
760
|
+
this.$l.y = pb.abs(this.x);
|
|
761
|
+
this.$l.a = pb.add(0.8543985, pb.mul(pb.add(0.4965155, pb.mul(0.0145206, this.y)), this.y));
|
|
762
|
+
this.$l.b = pb.add(3.417594, pb.mul(pb.add(4.1616724, this.y), this.y));
|
|
763
|
+
this.$l.v = pb.div(this.a, this.b);
|
|
764
|
+
this.$l.thetaSinTheta = this.$choice(pb.greaterThan(this.x, 0), this.v, pb.sub(pb.mul(0.5, pb.inverseSqrt(pb.max(pb.sub(1, pb.mul(this.x, this.x)), 1e-7))), this.v));
|
|
765
|
+
this.$return(pb.mul(pb.cross(this.v1, this.v2), this.thetaSinTheta));
|
|
766
|
+
});
|
|
767
|
+
pb.func('Z_LTCClipQuadToHorizon', [
|
|
768
|
+
pb.vec3[5]('L').inout(),
|
|
769
|
+
pb.int('n').out()
|
|
770
|
+
], function() {
|
|
771
|
+
this.$l.config = pb.int(0);
|
|
772
|
+
this.$if(pb.greaterThan(this.L[0].z, 0), function() {
|
|
773
|
+
this.config = pb.add(this.config, 1);
|
|
774
|
+
});
|
|
775
|
+
this.$if(pb.greaterThan(this.L[1].z, 0), function() {
|
|
776
|
+
this.config = pb.add(this.config, 2);
|
|
777
|
+
});
|
|
778
|
+
this.$if(pb.greaterThan(this.L[2].z, 0), function() {
|
|
779
|
+
this.config = pb.add(this.config, 4);
|
|
780
|
+
});
|
|
781
|
+
this.$if(pb.greaterThan(this.L[3].z, 0), function() {
|
|
782
|
+
this.config = pb.add(this.config, 8);
|
|
783
|
+
});
|
|
784
|
+
this.n = 0;
|
|
785
|
+
this.$if(pb.equal(this.config, 0), function() {}).$elseif(pb.equal(this.config, 1), function() {
|
|
786
|
+
this.n = 3;
|
|
787
|
+
this.L[1] = pb.add(pb.mul(pb.neg(this.L[1].z), this.L[0]), pb.mul(this.L[0].z, this.L[1]));
|
|
788
|
+
this.L[2] = pb.add(pb.mul(pb.neg(this.L[3].z), this.L[0]), pb.mul(this.L[0].z, this.L[3]));
|
|
789
|
+
}).$elseif(pb.equal(this.config, 2), function() {
|
|
790
|
+
this.n = 3;
|
|
791
|
+
this.L[0] = pb.add(pb.mul(pb.neg(this.L[0].z), this.L[1]), pb.mul(this.L[1].z, this.L[0]));
|
|
792
|
+
this.L[2] = pb.add(pb.mul(pb.neg(this.L[2].z), this.L[1]), pb.mul(this.L[1].z, this.L[2]));
|
|
793
|
+
}).$elseif(pb.equal(this.config, 3), function() {
|
|
794
|
+
this.n = 4;
|
|
795
|
+
this.L[2] = pb.add(pb.mul(pb.neg(this.L[2].z), this.L[1]), pb.mul(this.L[1].z, this.L[2]));
|
|
796
|
+
this.L[3] = pb.add(pb.mul(pb.neg(this.L[3].z), this.L[0]), pb.mul(this.L[0].z, this.L[3]));
|
|
797
|
+
}).$elseif(pb.equal(this.config, 4), function() {
|
|
798
|
+
this.n = 3;
|
|
799
|
+
this.L[0] = pb.add(pb.mul(pb.neg(this.L[3].z), this.L[2]), pb.mul(this.L[2].z, this.L[3]));
|
|
800
|
+
this.L[1] = pb.add(pb.mul(pb.neg(this.L[1].z), this.L[2]), pb.mul(this.L[2].z, this.L[1]));
|
|
801
|
+
}).$elseif(pb.equal(this.config, 6), function() {
|
|
802
|
+
this.n = 4;
|
|
803
|
+
this.L[0] = pb.add(pb.mul(pb.neg(this.L[0].z), this.L[1]), pb.mul(this.L[1].z, this.L[0]));
|
|
804
|
+
this.L[3] = pb.add(pb.mul(pb.neg(this.L[3].z), this.L[2]), pb.mul(this.L[2].z, this.L[3]));
|
|
805
|
+
}).$elseif(pb.equal(this.config, 7), function() {
|
|
806
|
+
this.n = 5;
|
|
807
|
+
this.L[4] = pb.add(pb.mul(pb.neg(this.L[3].z), this.L[0]), pb.mul(this.L[0].z, this.L[3]));
|
|
808
|
+
this.L[3] = pb.add(pb.mul(pb.neg(this.L[3].z), this.L[2]), pb.mul(this.L[2].z, this.L[3]));
|
|
809
|
+
}).$elseif(pb.equal(this.config, 8), function() {
|
|
810
|
+
this.n = 3;
|
|
811
|
+
this.L[0] = pb.add(pb.mul(pb.neg(this.L[0].z), this.L[3]), pb.mul(this.L[3].z, this.L[0]));
|
|
812
|
+
this.L[1] = pb.add(pb.mul(pb.neg(this.L[2].z), this.L[3]), pb.mul(this.L[3].z, this.L[2]));
|
|
813
|
+
this.L[2] = this.L[3];
|
|
814
|
+
}).$elseif(pb.equal(this.config, 9), function() {
|
|
815
|
+
this.n = 4;
|
|
816
|
+
this.L[1] = pb.add(pb.mul(pb.neg(this.L[1].z), this.L[0]), pb.mul(this.L[0].z, this.L[1]));
|
|
817
|
+
this.L[2] = pb.add(pb.mul(pb.neg(this.L[2].z), this.L[3]), pb.mul(this.L[3].z, this.L[2]));
|
|
818
|
+
}).$elseif(pb.equal(this.config, 11), function() {
|
|
819
|
+
this.n = 5;
|
|
820
|
+
this.L[4] = this.L[3];
|
|
821
|
+
this.L[3] = pb.add(pb.mul(pb.neg(this.L[2].z), this.L[3]), pb.mul(this.L[3].z, this.L[2]));
|
|
822
|
+
this.L[2] = pb.add(pb.mul(pb.neg(this.L[2].z), this.L[1]), pb.mul(this.L[1].z, this.L[2]));
|
|
823
|
+
}).$elseif(pb.equal(this.config, 12), function() {
|
|
824
|
+
this.n = 4;
|
|
825
|
+
this.L[1] = pb.add(pb.mul(pb.neg(this.L[1].z), this.L[2]), pb.mul(this.L[2].z, this.L[1]));
|
|
826
|
+
this.L[0] = pb.add(pb.mul(pb.neg(this.L[0].z), this.L[3]), pb.mul(this.L[3].z, this.L[0]));
|
|
827
|
+
}).$elseif(pb.equal(this.config, 13), function() {
|
|
828
|
+
this.n = 5;
|
|
829
|
+
this.L[4] = this.L[3];
|
|
830
|
+
this.L[3] = this.L[2];
|
|
831
|
+
this.L[2] = pb.add(pb.mul(pb.neg(this.L[1].z), this.L[2]), pb.mul(this.L[2].z, this.L[1]));
|
|
832
|
+
this.L[1] = pb.add(pb.mul(pb.neg(this.L[1].z), this.L[0]), pb.mul(this.L[0].z, this.L[1]));
|
|
833
|
+
}).$elseif(pb.equal(this.config, 14), function() {
|
|
834
|
+
this.n = 5;
|
|
835
|
+
this.L[4] = pb.add(pb.mul(pb.neg(this.L[0].z), this.L[3]), pb.mul(this.L[3].z, this.L[0]));
|
|
836
|
+
this.L[0] = pb.add(pb.mul(pb.neg(this.L[0].z), this.L[1]), pb.mul(this.L[1].z, this.L[0]));
|
|
837
|
+
}).$elseif(pb.equal(this.config, 15), function() {
|
|
838
|
+
this.n = 4;
|
|
839
|
+
});
|
|
840
|
+
this.$if(pb.equal(this.n, 3), function() {
|
|
841
|
+
this.L[3] = this.L[0];
|
|
842
|
+
});
|
|
843
|
+
this.$if(pb.equal(this.n, 4), function() {
|
|
844
|
+
this.L[4] = this.L[0];
|
|
845
|
+
});
|
|
846
|
+
});
|
|
847
|
+
pb.func('Z_LTCEvaluateRect', [
|
|
848
|
+
pb.vec3('N'),
|
|
849
|
+
pb.vec3('V'),
|
|
850
|
+
pb.vec3('P'),
|
|
851
|
+
pb.mat3('Minv'),
|
|
852
|
+
pb.vec3('p0'),
|
|
853
|
+
pb.vec3('p1'),
|
|
854
|
+
pb.vec3('p2'),
|
|
855
|
+
pb.vec3('p3')
|
|
856
|
+
], function() {
|
|
857
|
+
this.$l.T1 = pb.normalize(pb.sub(this.V, pb.mul(this.N, pb.dot(this.V, this.N))));
|
|
858
|
+
this.$l.T2 = pb.cross(this.N, this.T1);
|
|
859
|
+
if (pb.getDevice().type === 'webgl') {
|
|
860
|
+
this.$l.ltcBasis = pb.mat3(pb.vec3(this.T1.x, this.T2.x, this.N.x), pb.vec3(this.T1.y, this.T2.y, this.N.y), pb.vec3(this.T1.z, this.T2.z, this.N.z));
|
|
861
|
+
this.$l.ltcMatrix = pb.mul(this.Minv, this.ltcBasis);
|
|
862
|
+
} else {
|
|
863
|
+
this.$l.ltcMatrix = pb.mul(this.Minv, pb.transpose(pb.mat3(this.T1, this.T2, this.N)));
|
|
864
|
+
}
|
|
865
|
+
this.$l.L = pb.vec3[5]();
|
|
866
|
+
this.L[0] = pb.mul(this.ltcMatrix, pb.sub(this.p0, this.P));
|
|
867
|
+
this.L[1] = pb.mul(this.ltcMatrix, pb.sub(this.p1, this.P));
|
|
868
|
+
this.L[2] = pb.mul(this.ltcMatrix, pb.sub(this.p2, this.P));
|
|
869
|
+
this.L[3] = pb.mul(this.ltcMatrix, pb.sub(this.p3, this.P));
|
|
870
|
+
this.$l.n = pb.int(0);
|
|
871
|
+
this.Z_LTCClipQuadToHorizon(this.L, this.n);
|
|
872
|
+
this.$if(pb.equal(this.n, 0), function() {
|
|
873
|
+
this.$return(pb.vec3(0));
|
|
874
|
+
});
|
|
875
|
+
this.L[0] = pb.normalize(this.L[0]);
|
|
876
|
+
this.L[1] = pb.normalize(this.L[1]);
|
|
877
|
+
this.L[2] = pb.normalize(this.L[2]);
|
|
878
|
+
this.L[3] = pb.normalize(this.L[3]);
|
|
879
|
+
this.L[4] = pb.normalize(this.L[4]);
|
|
880
|
+
this.$l.sum = pb.float(0);
|
|
881
|
+
this.sum = pb.add(this.sum, this.Z_LTCIntegrateEdgeVec(this.L[0], this.L[1]).z);
|
|
882
|
+
this.sum = pb.add(this.sum, this.Z_LTCIntegrateEdgeVec(this.L[1], this.L[2]).z);
|
|
883
|
+
this.sum = pb.add(this.sum, this.Z_LTCIntegrateEdgeVec(this.L[2], this.L[3]).z);
|
|
884
|
+
this.$if(pb.greaterThanEqual(this.n, 4), function() {
|
|
885
|
+
this.sum = pb.add(this.sum, this.Z_LTCIntegrateEdgeVec(this.L[3], this.L[4]).z);
|
|
886
|
+
});
|
|
887
|
+
this.$if(pb.equal(this.n, 5), function() {
|
|
888
|
+
this.sum = pb.add(this.sum, this.Z_LTCIntegrateEdgeVec(this.L[4], this.L[0]).z);
|
|
889
|
+
});
|
|
890
|
+
this.sum = pb.max(0, this.sum);
|
|
891
|
+
this.$return(pb.vec3(this.sum));
|
|
892
|
+
});
|
|
699
893
|
pb.func(funcName, [
|
|
700
894
|
pb.vec3('worldPos'),
|
|
701
895
|
pb.vec3('normal'),
|
|
@@ -717,40 +911,38 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
717
911
|
this.$l.lightNormal = pb.normalize(pb.cross(this.ax, this.ay));
|
|
718
912
|
this.lightNormal = pb.neg(this.lightNormal);
|
|
719
913
|
this.$if(pb.greaterThan(this.area, 0), function() {
|
|
720
|
-
this.$l.
|
|
721
|
-
this.$l.
|
|
722
|
-
this.$l.
|
|
723
|
-
this.$l.
|
|
724
|
-
this.$l.
|
|
725
|
-
this.$l.
|
|
726
|
-
this.$l.
|
|
727
|
-
this.$l.
|
|
728
|
-
this.$l.
|
|
729
|
-
this.$l.
|
|
730
|
-
this.$l.
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
this.
|
|
735
|
-
this
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
this.NoL_light = pb.clamp(pb.dot(this.lightNormal, pb.neg(this.L)), 0, 1);
|
|
739
|
-
this.$if(pb.greaterThan(this.NoL_light, 0), function() {
|
|
740
|
-
this.falloff = pb.float(1);
|
|
741
|
-
this.$if(pb.greaterThan(this.range, 0), function() {
|
|
742
|
-
this.falloff = pb.max(0, pb.sub(1, pb.div(this.dist, this.range)));
|
|
743
|
-
this.falloff = pb.mul(this.falloff, this.falloff);
|
|
744
|
-
});
|
|
745
|
-
this.atten = pb.mul(this.invDist2, this.NoL_light, this.falloff);
|
|
746
|
-
this.lightColor = pb.mul(this.baseColor, this.atten, this.NoL);
|
|
747
|
-
that.directLighting(this, this.L, this.lightColor, this.normal, this.viewVec, this.data, pb.float(1), pb.float(1), pb.float(0), this.outColor);
|
|
914
|
+
this.$l.ex = this.ax;
|
|
915
|
+
this.$l.ey = this.ay;
|
|
916
|
+
this.$l.p0 = pb.sub(pb.sub(this.center, this.ex), this.ey);
|
|
917
|
+
this.$l.p1 = pb.add(pb.sub(this.center, this.ey), this.ex);
|
|
918
|
+
this.$l.p2 = pb.add(pb.add(this.center, this.ex), this.ey);
|
|
919
|
+
this.$l.p3 = pb.add(pb.sub(this.center, this.ex), this.ey);
|
|
920
|
+
this.$l.centerToPoint = pb.sub(this.center, this.worldPos);
|
|
921
|
+
this.$l.dist = pb.length(this.centerToPoint);
|
|
922
|
+
this.$l.L = pb.normalize(this.centerToPoint);
|
|
923
|
+
this.$l.NoV = pb.clamp(pb.dot(this.normal, this.viewVec), 0.0001, 1);
|
|
924
|
+
this.$l.NoL_light = pb.clamp(pb.dot(this.lightNormal, pb.neg(this.L)), 0, 1);
|
|
925
|
+
// Keep rect lights single-sided, but avoid applying an extra cosine falloff
|
|
926
|
+
// on top of the LTC integral, which makes the light look noticeably dimmer.
|
|
927
|
+
this.$if(pb.greaterThan(this.NoL_light, 1e-5), function() {
|
|
928
|
+
this.$l.falloff = pb.float(1);
|
|
929
|
+
this.$if(pb.greaterThan(this.range, 0), function() {
|
|
930
|
+
this.$l.fadeStart = pb.mul(this.range, 0.9);
|
|
931
|
+
this.falloff = pb.sub(1, pb.smoothStep(this.fadeStart, this.range, this.dist));
|
|
748
932
|
});
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
933
|
+
this.$l.uv = pb.clamp(pb.add(pb.mul(pb.vec2(this.data.roughness, pb.sqrt(pb.max(pb.sub(1, this.NoV), 0))), LUT_SCALE), pb.vec2(LUT_BIAS)), pb.vec2(0), pb.vec2(1));
|
|
934
|
+
this.$l.t1 = pb.textureSampleLevel(this.zLTCMatLut, this.uv, 0);
|
|
935
|
+
this.$l.t2 = pb.textureSampleLevel(this.zLTCAmpLut, this.uv, 0);
|
|
936
|
+
this.$l.Minv = pb.mat3(pb.vec3(this.t1.x, 0, this.t1.y), pb.vec3(0, 1, 0), pb.vec3(this.t1.z, 0, this.t1.w));
|
|
937
|
+
this.$l.spec = this.Z_LTCEvaluateRect(this.normal, this.viewVec, this.worldPos, this.Minv, this.p0, this.p1, this.p2, this.p3);
|
|
938
|
+
this.$l.diff = this.Z_LTCEvaluateRect(this.normal, this.viewVec, this.worldPos, pb.mat3(pb.vec3(1, 0, 0), pb.vec3(0, 1, 0), pb.vec3(0, 0, 1)), this.p0, this.p1, this.p2, this.p3);
|
|
939
|
+
this.$l.lightColor = pb.mul(this.colorIntensity.rgb, this.colorIntensity.a, this.falloff);
|
|
940
|
+
this.$l.baseF0 = this.data.f0.rgb;
|
|
941
|
+
this.$l.rectSpecularScale = that.getRectSpecularScale(this);
|
|
942
|
+
this.$l.specularLtc = pb.mul(this.spec, pb.add(pb.mul(this.baseF0, this.t2.x), pb.mul(pb.sub(pb.vec3(1), this.baseF0), this.t2.y)), this.data.specularWeight, this.rectSpecularScale);
|
|
943
|
+
this.$l.diffuseLtc = pb.mul(this.diff, pb.div(this.data.diffuse.rgb, Math.PI));
|
|
944
|
+
this.outColor = pb.add(this.outColor, pb.mul(this.lightColor, pb.add(this.diffuseLtc, this.specularLtc)));
|
|
945
|
+
});
|
|
754
946
|
});
|
|
755
947
|
});
|
|
756
948
|
scope.$g[funcName](worldPos, normal, viewVec, commonData, posRange, axisX, axisY, colorIntensity, outColor);
|
|
@@ -881,7 +1073,7 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
881
1073
|
});
|
|
882
1074
|
return pb.getGlobalScope()[funcName](outsideIOR, eta2, cosTheta1, thinFilmThickness, baseF0);
|
|
883
1075
|
}
|
|
884
|
-
indirectLighting(scope, normal, viewVec, commonData, outColor, outRoughness) {
|
|
1076
|
+
indirectLighting(scope, normal, viewVec, commonData, outColor, outRoughness, outDiffuseColor) {
|
|
885
1077
|
const pb = scope.$builder;
|
|
886
1078
|
const that = this;
|
|
887
1079
|
const ctx = that.drawContext;
|
|
@@ -893,13 +1085,16 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
893
1085
|
pb.vec3('outColor').inout(),
|
|
894
1086
|
...outRoughness ? [
|
|
895
1087
|
pb.vec4('outRoughness').out()
|
|
1088
|
+
] : [],
|
|
1089
|
+
...outDiffuseColor ? [
|
|
1090
|
+
pb.vec3('outDiffuseColor').inout()
|
|
896
1091
|
] : []
|
|
897
1092
|
], function() {
|
|
898
1093
|
if (!ctx.drawEnvLight || !ctx.env.light.envLight.hasRadiance() && !ctx.env.light.envLight.hasIrradiance()) {
|
|
899
1094
|
return;
|
|
900
1095
|
}
|
|
901
1096
|
const envLightStrength = ShaderHelper.getEnvLightStrength(this);
|
|
902
|
-
|
|
1097
|
+
const envLightSpecularStrength = ShaderHelper.getEnvLightSpecularStrength(this);
|
|
903
1098
|
if (that.occlusionTexture) {
|
|
904
1099
|
const occlusionSample = that.sampleOcclusionTexture(this).r;
|
|
905
1100
|
this.$l.occlusion = pb.mul(pb.add(pb.mul(this.zOcclusionStrength, pb.sub(occlusionSample, 1)), 1), envLightStrength);
|
|
@@ -913,16 +1108,20 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
913
1108
|
}
|
|
914
1109
|
this.$l.ggxLutSample = pb.clamp(pb.textureSampleLevel(this.zGGXLut, pb.clamp(pb.vec2(this.NoV, this.data.roughness), pb.vec2(0), pb.vec2(1)), 0), pb.vec4(0), pb.vec4(1));
|
|
915
1110
|
this.$l.f_ab = this.ggxLutSample.rg;
|
|
916
|
-
this.$l.
|
|
917
|
-
this.$l.Fr = pb.sub(pb.max(pb.vec3(pb.sub(1, this.data.roughness)), this.F0), this.F0);
|
|
1111
|
+
this.$l.Fr = pb.sub(pb.max(pb.vec3(pb.sub(1, this.data.roughness)), this.data.f0.rgb), this.data.f0.rgb);
|
|
918
1112
|
if (that.iridescence) {
|
|
919
|
-
this.$l.k_S = pb.mix(pb.add(this.
|
|
1113
|
+
this.$l.k_S = pb.mix(pb.add(this.data.f0.rgb, pb.mul(this.Fr, pb.pow(pb.sub(1, this.NoV), 5))), this.data.iridescenceFresnel, this.data.iridescenceFactor.x);
|
|
920
1114
|
} else {
|
|
921
|
-
this.$l.k_S = pb.add(this.
|
|
1115
|
+
this.$l.k_S = pb.add(this.data.f0.rgb, pb.mul(this.Fr, pb.pow(pb.sub(1, this.NoV), 5)));
|
|
922
1116
|
}
|
|
923
1117
|
if (outRoughness || ctx.env.light.envLight.hasRadiance()) {
|
|
924
1118
|
this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));
|
|
925
1119
|
this.$l.specularFactor = pb.mul(this.FssEss, this.data.specularWeight, this.occlusion);
|
|
1120
|
+
if (that.clearcoat) {
|
|
1121
|
+
this.$if(pb.greaterThan(this.data.ccFactor.x, 0), function() {
|
|
1122
|
+
this.specularFactor = pb.mul(this.specularFactor, pb.clamp(pb.sub(1, pb.mul(this.data.ccFresnel, this.data.ccFactor.x)), 0, 1));
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
926
1125
|
if (that.sheen) {
|
|
927
1126
|
this.specularFactor = pb.mul(this.specularFactor, this.sheenAlbedoScaling);
|
|
928
1127
|
}
|
|
@@ -930,25 +1129,30 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
930
1129
|
this.outRoughness = pb.vec4(this.specularFactor /*this.data.f0.rgb*/ , this.data.roughness);
|
|
931
1130
|
} else if (ctx.env.light.envLight.hasRadiance()) {
|
|
932
1131
|
this.$l.radiance = ctx.env.light.envLight.getRadiance(this, pb.reflect(pb.neg(this.viewVec), this.normal), this.data.roughness);
|
|
933
|
-
this.outColor = pb.add(this.outColor, pb.mul(this.radiance, this.specularFactor));
|
|
1132
|
+
this.outColor = pb.add(this.outColor, pb.mul(this.radiance, this.specularFactor, envLightSpecularStrength));
|
|
934
1133
|
}
|
|
935
1134
|
}
|
|
936
1135
|
if (ctx.env.light.envLight.hasIrradiance()) {
|
|
937
1136
|
this.$l.irradiance = ctx.env.light.envLight.getIrradiance(this, this.normal);
|
|
938
1137
|
if (that.iridescence) {
|
|
939
1138
|
this.$l.iridescenceF0Max = pb.vec3(pb.max(pb.max(this.data.iridescenceF0.r, this.data.iridescenceF0.g), this.data.iridescenceF0.b));
|
|
940
|
-
this.$l.mixedF0 = pb.mix(this.
|
|
1139
|
+
this.$l.mixedF0 = pb.mix(this.data.f0.rgb, this.iridescenceF0Max, this.data.iridescenceFactor.x);
|
|
941
1140
|
this.Fr = pb.sub(pb.max(pb.vec3(pb.sub(1, this.data.roughness)), this.mixedF0), this.mixedF0);
|
|
942
1141
|
this.k_S = pb.add(this.mixedF0, pb.mul(this.Fr, pb.pow(pb.sub(1, this.NoV), 5)));
|
|
943
1142
|
} else {
|
|
944
|
-
this.$l.mixedF0 = this.
|
|
1143
|
+
this.$l.mixedF0 = this.data.f0.rgb;
|
|
945
1144
|
}
|
|
946
|
-
this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));
|
|
1145
|
+
this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x, this.data.specularWeight), pb.vec3(this.f_ab.y));
|
|
947
1146
|
this.$l.Ems = pb.sub(1, pb.add(this.f_ab.x, this.f_ab.y));
|
|
948
|
-
this.$l.F_avg = pb.add(this.mixedF0, pb.div(pb.sub(pb.vec3(1), this.mixedF0), 21));
|
|
1147
|
+
this.$l.F_avg = pb.mul(pb.add(this.mixedF0, pb.div(pb.sub(pb.vec3(1), this.mixedF0), 21)), this.data.specularWeight);
|
|
949
1148
|
this.$l.FmsEms = pb.div(pb.mul(this.FssEss, this.F_avg, this.Ems), pb.sub(pb.vec3(1), pb.mul(this.F_avg, this.Ems)));
|
|
950
1149
|
this.$l.k_D = pb.mul(this.data.diffuse.rgb, pb.add(pb.sub(pb.vec3(1), this.FssEss), this.FmsEms));
|
|
951
1150
|
this.$l.iblDiffuse = pb.mul(pb.add(this.FmsEms, this.k_D), this.irradiance, this.occlusion);
|
|
1151
|
+
if (that.clearcoat) {
|
|
1152
|
+
this.$if(pb.greaterThan(this.data.ccFactor.x, 0), function() {
|
|
1153
|
+
this.iblDiffuse = pb.mul(this.iblDiffuse, pb.clamp(pb.sub(1, pb.mul(this.data.ccFresnel, this.data.ccFactor.x)), 0, 1));
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
952
1156
|
if (that.sheen) {
|
|
953
1157
|
this.iblDiffuse = pb.mul(this.iblDiffuse, this.sheenAlbedoScaling);
|
|
954
1158
|
}
|
|
@@ -957,6 +1161,9 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
957
1161
|
this.iblDiffuse = pb.mix(this.iblDiffuse, this.iblTransmission, this.data.transmissionFactor);
|
|
958
1162
|
}
|
|
959
1163
|
this.outColor = pb.add(this.outColor, this.iblDiffuse);
|
|
1164
|
+
if (outDiffuseColor) {
|
|
1165
|
+
this.outDiffuseColor = pb.add(this.outDiffuseColor, this.iblDiffuse);
|
|
1166
|
+
}
|
|
960
1167
|
}
|
|
961
1168
|
if (that.sheen && (ctx.env.light.envLight.hasSheenRadiance() || ctx.env.light.envLight.hasIrradiance())) {
|
|
962
1169
|
this.$l.sheenBRDF = this.sheenLutSample.b;
|
|
@@ -971,17 +1178,21 @@ import { mixinPBRBRDF } from './brdf.js';
|
|
|
971
1178
|
this.$l.NoV = pb.clamp(pb.dot(this.data.ccNormal, this.viewVec), 0.0001, 1);
|
|
972
1179
|
this.$l.ggxLutSample = pb.clamp(pb.textureSampleLevel(this.zGGXLut, pb.clamp(pb.vec2(this.NoV, this.data.ccFactor.y), pb.vec2(0), pb.vec2(1)), 0), pb.vec4(0), pb.vec4(1));
|
|
973
1180
|
this.$l.f_ab = this.ggxLutSample.rg;
|
|
974
|
-
this.$l.
|
|
975
|
-
this.$l.
|
|
1181
|
+
this.$l.Fr = pb.sub(pb.max(pb.vec3(pb.sub(1, this.data.ccFactor.y)), pb.vec3(pb.pow(pb.div(pb.sub(this.data.f0.a, 1), pb.add(this.data.f0.a, 1)), 2))), pb.vec3(pb.pow(pb.div(pb.sub(this.data.f0.a, 1), pb.add(this.data.f0.a, 1)), 2)));
|
|
1182
|
+
this.$l.ccF0 = pb.vec3(pb.pow(pb.div(pb.sub(this.data.f0.a, 1), pb.add(this.data.f0.a, 1)), 2));
|
|
976
1183
|
this.$l.k_S = pb.add(this.ccF0, pb.mul(this.Fr, pb.pow(pb.sub(1, this.NoV), 5)));
|
|
977
1184
|
this.$l.radiance = ctx.env.light.envLight.getRadiance(this, pb.reflect(pb.neg(this.viewVec), this.data.ccNormal), this.data.ccFactor.y);
|
|
978
1185
|
this.$l.FssEss = pb.add(pb.mul(this.k_S, this.f_ab.x), pb.vec3(this.f_ab.y));
|
|
979
|
-
this.$l.ccSpecular = pb.mul(this.radiance, this.FssEss, this.occlusion);
|
|
980
|
-
this.outColor = pb.add(
|
|
1186
|
+
this.$l.ccSpecular = pb.mul(this.radiance, this.FssEss, this.occlusion, envLightSpecularStrength);
|
|
1187
|
+
this.outColor = pb.add(this.outColor, pb.mul(this.ccSpecular, this.data.ccFactor.x));
|
|
981
1188
|
}
|
|
982
1189
|
});
|
|
983
|
-
if (outRoughness) {
|
|
1190
|
+
if (outRoughness && outDiffuseColor) {
|
|
1191
|
+
scope.$g[funcName](normal, viewVec, commonData, outColor, outRoughness, outDiffuseColor);
|
|
1192
|
+
} else if (outRoughness) {
|
|
984
1193
|
scope.$g[funcName](normal, viewVec, commonData, outColor, outRoughness);
|
|
1194
|
+
} else if (outDiffuseColor) {
|
|
1195
|
+
scope.$g[funcName](normal, viewVec, commonData, outColor, outDiffuseColor);
|
|
985
1196
|
} else {
|
|
986
1197
|
scope.$g[funcName](normal, viewVec, commonData, outColor);
|
|
987
1198
|
}
|