background blur

This commit is contained in:
Kseninia Mikhaylova 2024-07-03 16:07:50 +03:00
parent e4a6c95b08
commit 35a7f42132
10 changed files with 24 additions and 27 deletions

View File

@ -35,7 +35,7 @@ const loadAll = async () => {
const { scene: light } = await useGLTF('/models_light/zabor_so_svetom.glb') const { scene: light } = await useGLTF('/models_light/zabor_so_svetom.glb')
pointLight.value = light.children[2] pointLight.value = light.children[2]
pointLight.value.color = '#f0dea9' pointLight.value.color = '#f0dea9'
pointLight.value.intensity = pointLight.value.intensity * 0.2 pointLight.value.intensity = pointLight.value.intensity * 0.1
// pointLight.value.intensity = 0 // pointLight.value.intensity = 0
pointLight.value.shadow.camera.near = 50 pointLight.value.shadow.camera.near = 50
pointLight.value.shadow.bias = -0.002 pointLight.value.shadow.bias = -0.002
@ -112,8 +112,6 @@ watch([section_count, extra_section], () => {
<template v-if="pointLight"> <template v-if="pointLight">
<TresPointLight v-bind="pointLight" cast-shadow /> <TresPointLight v-bind="pointLight" cast-shadow />
</template> </template>
<TresAmbientLight color="rgb(191,231,255)" :intensity="5" />
</TresCanvas> </TresCanvas>
</ClientOnly> </ClientOnly>
</div> </div>

View File

@ -1,7 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { import {
ReinhardToneMapping, PCFSoftShadowMap, PCFSoftShadowMap,
PMREMGenerator, Euler, EquirectangularReflectionMapping,
CineonToneMapping,
Euler,
} from 'three'; } from 'three';
import { GainMapLoader, } from '@monogrid/gainmap-js' import { GainMapLoader, } from '@monogrid/gainmap-js'
import { useGLTF, } from '@tresjs/cientos' import { useGLTF, } from '@tresjs/cientos'
@ -14,7 +16,9 @@ const extra_section = use_extra_section()
const max_size = use_max_size() const max_size = use_max_size()
const { scene, renderer } = useTresContext() const { scene, renderer } = useTresContext()
renderer.value.toneMapping = ReinhardToneMapping renderer.value.toneMapping = CineonToneMapping
renderer.value.toneMappingExposure = 0.5
// renderer.value.gammaOutput = true
renderer.value.shadowMap.enabled = true renderer.value.shadowMap.enabled = true
renderer.value.shadowMap.type = PCFSoftShadowMap renderer.value.shadowMap.type = PCFSoftShadowMap
@ -61,24 +65,19 @@ watch([section_count, extra_section], () => {
} }
}) })
const pmremGenerator = new PMREMGenerator(renderer.value);
pmremGenerator.compileEquirectangularShader();
onMounted(async () => { onMounted(async () => {
const loader = new GainMapLoader(renderer.value) const loader = new GainMapLoader(renderer.value)
const result = await loader.loadAsync([ const result = await loader.loadAsync([
'hdrmaps/alps_field_4k.webp', 'hdrmaps/hdr.webp',
'hdrmaps/alps_field_4k-gainmap.webp', 'hdrmaps/hdr-gainmap.webp',
'hdrmaps/alps_field_4k.json', 'hdrmaps/hdr.json',
]) ])
const exrCubeRenderTarget = pmremGenerator.fromEquirectangular(result.renderTarget.texture); scene.value.environment = result.renderTarget.texture
const exrBackground = exrCubeRenderTarget.texture; scene.value.background = result.renderTarget.texture
const newEnvMap = exrCubeRenderTarget ? exrCubeRenderTarget.texture : null; scene.value.background.mapping = EquirectangularReflectionMapping
scene.value.backgroundRotation = new Euler(0, 10, 0)
scene.value.environment = newEnvMap scene.value.backgroundIntensity = 1.5
scene.value.background = exrBackground scene.value.backgroundBlurriness = 0.05
scene.value.backgroundRotation = new Euler(0, 5, 0)
// scene.value.background.mapping = EquirectangularReflectionMapping
result.renderTarget.texture.dispose(); result.renderTarget.texture.dispose();
}) })

View File

@ -35,7 +35,7 @@ const aboutText = computed(() => marked.parse(about?.content || ''))
const deliveryText = computed(() => delivery?.content.split('[col]').map(el => marked.parse(el || ''))) const deliveryText = computed(() => delivery?.content.split('[col]').map(el => marked.parse(el || '')))
const advantagesText = computed(() => { const advantagesText = computed(() => {
let c = advantages?.content || '' let c = advantages?.content || ''
Object.entries(calculatorData.value || {}).map(item => { Object.entries(calculatorData.value || {}).map(item => {
c = c.replaceAll(`[${item[0]}]`, roubleSign.format(item[1])) c = c.replaceAll(`[${item[0]}]`, roubleSign.format(item[1]))
}) })
return marked.parse(c) return marked.parse(c)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -1,8 +1,8 @@
{ {
"gainMapMax": [ "gainMapMax": [
15.999075124875333, 5.336506559810254,
15.999075124875333, 5.336506559810254,
15.999075124875333 5.336506559810254
], ],
"gainMapMin": [ "gainMapMin": [
0, 0,
@ -14,7 +14,7 @@
1, 1,
1 1
], ],
"hdrCapacityMax": 15.999075124875333, "hdrCapacityMax": 5.336506559810254,
"hdrCapacityMin": 0, "hdrCapacityMin": 0,
"offsetHdr": [ "offsetHdr": [
0.015625, 0.015625,

BIN
public/hdrmaps/hdr.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@ -16,8 +16,8 @@ export const set_material = (scene: any, color: any) => {
color: new Color(c || '#9c9c00'), color: new Color(c || '#9c9c00'),
transparent: true, transparent: true,
opacity: 1, opacity: 1,
roughness: 0.3, roughness: 0.5,
metalness: 0.3 metalness: 0
}) })
set_metaril_func(scene, material) set_metaril_func(scene, material)
} }