diff --git a/API.md b/API.md index 45be8069..af70962b 100644 --- a/API.md +++ b/API.md @@ -114,9 +114,6 @@ GltfState containing a state for visualization in GltfView * [.renderingParameters](#GltfState+renderingParameters) * [.morphing](#GltfState+renderingParameters.morphing) * [.skinning](#GltfState+renderingParameters.skinning) - * [.clearcoat](#GltfState+renderingParameters.clearcoat) - * [.sheen](#GltfState+renderingParameters.sheen) - * [.transmission](#GltfState+renderingParameters.transmission) * [.clearColor](#GltfState+renderingParameters.clearColor) * [.exposure](#GltfState+renderingParameters.exposure) * [.usePunctual](#GltfState+renderingParameters.usePunctual) @@ -126,6 +123,7 @@ GltfState containing a state for visualization in GltfView * [.toneMap](#GltfState+renderingParameters.toneMap) * [.debugOutput](#GltfState+renderingParameters.debugOutput) * [.environmentRotation](#GltfState+renderingParameters.environmentRotation) + * [.useDirectionalLightsWithDisabledIBL](#GltfState+renderingParameters.useDirectionalLightsWithDisabledIBL) * _static_ * [.ToneMaps](#GltfState.ToneMaps) * [.NONE](#GltfState.ToneMaps.NONE) @@ -222,9 +220,6 @@ parameters used to configure the rendering * [.renderingParameters](#GltfState+renderingParameters) * [.morphing](#GltfState+renderingParameters.morphing) * [.skinning](#GltfState+renderingParameters.skinning) - * [.clearcoat](#GltfState+renderingParameters.clearcoat) - * [.sheen](#GltfState+renderingParameters.sheen) - * [.transmission](#GltfState+renderingParameters.transmission) * [.clearColor](#GltfState+renderingParameters.clearColor) * [.exposure](#GltfState+renderingParameters.exposure) * [.usePunctual](#GltfState+renderingParameters.usePunctual) @@ -234,6 +229,7 @@ parameters used to configure the rendering * [.toneMap](#GltfState+renderingParameters.toneMap) * [.debugOutput](#GltfState+renderingParameters.debugOutput) * [.environmentRotation](#GltfState+renderingParameters.environmentRotation) + * [.useDirectionalLightsWithDisabledIBL](#GltfState+renderingParameters.useDirectionalLightsWithDisabledIBL) @@ -246,24 +242,6 @@ morphing between vertices #### renderingParameters.skinning skin / skeleton -**Kind**: static property of [renderingParameters](#GltfState+renderingParameters) - - -#### renderingParameters.clearcoat -KHR_materials_clearcoat - -**Kind**: static property of [renderingParameters](#GltfState+renderingParameters) - - -#### renderingParameters.sheen -KHR_materials_sheen - -**Kind**: static property of [renderingParameters](#GltfState+renderingParameters) - - -#### renderingParameters.transmission -KHR_materials_transmission - **Kind**: static property of [renderingParameters](#GltfState+renderingParameters) @@ -323,6 +301,12 @@ Front faces: -X = 180 -Z = 270 +**Kind**: static property of [renderingParameters](#GltfState+renderingParameters) + + +#### renderingParameters.useDirectionalLightsWithDisabledIBL +If this is set to true, directional lights will be generated if IBL is disabled + **Kind**: static property of [renderingParameters](#GltfState+renderingParameters) diff --git a/app_web/index.html b/app_web/index.html index ea80e276..ed37a73a 100644 --- a/app_web/index.html +++ b/app_web/index.html @@ -318,9 +318,12 @@

Advanced Controls

- Clearcoat - Sheen - Transmission + KHR_materials_clearcoat + KHR_materials_sheen + KHR_materials_transmission + KHR_materials_volume + KHR_materials_ior + KHR_materials_specular diff --git a/app_web/src/logic/uimodel.js b/app_web/src/logic/uimodel.js index f5b13673..389fe9a8 100644 --- a/app_web/src/logic/uimodel.js +++ b/app_web/src/logic/uimodel.js @@ -71,6 +71,12 @@ class UIModel this.clearcoatEnabled = app.clearcoatChanged$.pipe(pluck("event", "msg")); this.sheenEnabled = app.sheenChanged$.pipe(pluck("event", "msg")); this.transmissionEnabled = app.transmissionChanged$.pipe(pluck("event", "msg")); + this.volumeEnabled = app.$watchAsObservable('volumeEnabled').pipe( + map( ({ newValue, oldValue }) => newValue)); + this.iorEnabled = app.$watchAsObservable('iorEnabled').pipe( + map( ({ newValue, oldValue }) => newValue)); + this.specularEnabled = app.$watchAsObservable('specularEnabled').pipe( + map( ({ newValue, oldValue }) => newValue)); this.iblEnabled = app.iblChanged$.pipe(pluck("event", "msg")); this.punctualLightsEnabled = app.punctualLightsChanged$.pipe(pluck("event", "msg")); this.renderEnvEnabled = app.$watchAsObservable('renderEnv').pipe( diff --git a/app_web/src/main.js b/app_web/src/main.js index 932ae75d..22c4fa3e 100644 --- a/app_web/src/main.js +++ b/app_web/src/main.js @@ -174,13 +174,22 @@ async function main() }); uiModel.clearcoatEnabled.subscribe( clearcoatEnabled => { - state.renderingParameters.clearcoat = clearcoatEnabled; + state.renderingParameters.enabledExtensions.KHR_materials_clearcoat = clearcoatEnabled; }); uiModel.sheenEnabled.subscribe( sheenEnabled => { - state.renderingParameters.sheen = sheenEnabled; + state.renderingParameters.enabledExtensions.KHR_materials_sheen = sheenEnabled; }); uiModel.transmissionEnabled.subscribe( transmissionEnabled => { - state.renderingParameters.transmission = transmissionEnabled; + state.renderingParameters.enabledExtensions.KHR_materials_transmission = transmissionEnabled; + }); + uiModel.volumeEnabled.subscribe( volumeEnabled => { + state.renderingParameters.enabledExtensions.KHR_materials_volume = volumeEnabled; + }); + uiModel.iorEnabled.subscribe( iorEnabled => { + state.renderingParameters.enabledExtensions.KHR_materials_ior = iorEnabled; + }); + uiModel.specularEnabled.subscribe( specularEnabled => { + state.renderingParameters.enabledExtensions.KHR_materials_specular = specularEnabled; }); uiModel.iblEnabled.subscribe( iblEnabled => { diff --git a/app_web/src/ui/ui.js b/app_web/src/ui/ui.js index bae522fd..e1c27621 100644 --- a/app_web/src/ui/ui.js +++ b/app_web/src/ui/ui.js @@ -86,13 +86,18 @@ const app = new Vue({ clearcoatEnabled: true, sheenEnabled: true, transmissionEnabled: true, + volumeEnabled: true, + iorEnabled: true, + specularEnabled: true, activeTab: 0, loadingComponent: {}, showDropDownOverlay: false, uploadedHDR: undefined, - // this is a helper to reset the ui when image based lighting is reenabled + + // these are handls for certain ui change related things environmentVisiblePrefState: true, + volumeEnabledPrefState: true, }; }, mounted: function() @@ -118,6 +123,17 @@ const app = new Vue({ this.renderEnv = this.environmentVisiblePrefState; } }, + transmissionTriggered: function(value) + { + if(this.transmissionEnabled == false) + { + this.volumeEnabledPrefState = this.volumeEnabled; + this.volumeEnabled = false; + } + else{ + this.volumeEnabled = this.volumeEnabledPrefState; + } + }, warn(message) { this.$buefy.toast.open({ message: message, diff --git a/source/GltfState/gltf_state.js b/source/GltfState/gltf_state.js index 45d5b7f1..c1d6c983 100644 --- a/source/GltfState/gltf_state.js +++ b/source/GltfState/gltf_state.js @@ -39,15 +39,18 @@ class GltfState morphing: true, /** skin / skeleton */ skinning: true, - /** KHR_materials_clearcoat */ - clearcoat: true, - /** KHR_materials_sheen */ - sheen: true, - /** KHR_materials_transmission */ - transmission: true, - /** KHR_materials_ior makes the index of refraction configurable */ - ior: true, + enabledExtensions: { + /** KHR_materials_clearcoat */ + KHR_materials_clearcoat: true, + /** KHR_materials_sheen */ + KHR_materials_sheen: true, + /** KHR_materials_transmission */ + KHR_materials_transmission: true, + /** KHR_materials_volume */ + KHR_materials_volume: true, + /** KHR_materials_ior makes the index of refraction configurable */ + KHR_materials_ior: true, /** KHR_materials_specular allows configuring specular color (f0 color) and amount of specular reflection */ KHR_materials_specular: true, }, diff --git a/source/Renderer/renderer.js b/source/Renderer/renderer.js index 488e76f2..4ff4a0db 100644 --- a/source/Renderer/renderer.js +++ b/source/Renderer/renderer.js @@ -432,7 +432,7 @@ class gltfRenderer } if(transmissionSampleTexture !== undefined && (state.renderingParameters.useIBL || state.renderingParameters.usePunctual) - && state.environment && state.renderingParameters.transmission) + && state.environment && state.renderingParameters.enabledExtensions.KHR_materials_transmission) { this.webGl.context.activeTexture(GL.TEXTURE0 + textureCount); this.webGl.context.bindTexture(this.webGl.context.TEXTURE_2D, this.opaqueRenderTexture); diff --git a/source/gltf/material.js b/source/gltf/material.js index a0fbeef7..4be8d88a 100644 --- a/source/gltf/material.js +++ b/source/gltf/material.js @@ -63,23 +63,23 @@ class gltfMaterial extends GltfObject { const defines = Array.from(this.defines); - if (this.hasClearcoat && renderingParameters.clearcoat) + if (this.hasClearcoat && renderingParameters.enabledExtensions.KHR_materials_clearcoat) { defines.push("MATERIAL_CLEARCOAT 1"); } - if (this.hasSheen && renderingParameters.sheen) + if (this.hasSheen && renderingParameters.enabledExtensions.KHR_materials_sheen) { defines.push("MATERIAL_SHEEN 1"); } - if (this.hasTransmission && renderingParameters.transmission) + if (this.hasTransmission && renderingParameters.enabledExtensions.KHR_materials_transmission) { defines.push("MATERIAL_TRANSMISSION 1"); } - if (this.hasVolume && renderingParameters.transmission) + if (this.hasVolume && renderingParameters.enabledExtensions.KHR_materials_volume) { defines.push("MATERIAL_VOLUME 1"); } - if(this.hasIOR && renderingParameters.ior) + if(this.hasIOR && renderingParameters.enabledExtensions.KHR_materials_ior) { defines.push("MATERIAL_IOR 1"); }