diff options
Diffstat (limited to 'examples/qt3d/compute-particles')
14 files changed, 0 insertions, 773 deletions
diff --git a/examples/qt3d/compute-particles/CMakeLists.txt b/examples/qt3d/compute-particles/CMakeLists.txt deleted file mode 100644 index 483f99a86..000000000 --- a/examples/qt3d/compute-particles/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause - -cmake_minimum_required(VERSION 3.16) -project(compute-particles LANGUAGES CXX) - -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}") - -find_package(Qt6 REQUIRED COMPONENTS 3DCore 3DInput 3DQuick 3DRender Core Gui Qml Quick) - -qt_add_executable(compute-particles - main.cpp -) - -set_target_properties(compute-particles PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(compute-particles PUBLIC - Qt::3DCore - Qt::3DInput - Qt::3DQuick - Qt::3DRender - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick -) - -# Resources: -set(compute-particles_resource_files - "ComputeFrameGraph.qml" - "ComputeMaterial.qml" - "ParticlesScene.qml" - "main.qml" - "shaders/gl43/particles.comp" - "shaders/gl43/particles.frag" - "shaders/gl43/particles.vert" - "shaders/gl45/particles.comp" - "shaders/gl45/particles.frag" - "shaders/gl45/particles.vert" -) - -qt6_add_resources(compute-particles "compute-particles" - PREFIX - "/" - FILES - ${compute-particles_resource_files} -) - -install(TARGETS compute-particles - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/qt3d/compute-particles/ComputeFrameGraph.qml b/examples/qt3d/compute-particles/ComputeFrameGraph.qml deleted file mode 100644 index 066b4fa3c..000000000 --- a/examples/qt3d/compute-particles/ComputeFrameGraph.qml +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import Qt3D.Core 2.0 -import Qt3D.Render 2.9 - -Viewport { - property alias camera: selector.camera - - RenderSurfaceSelector { - id: surfaceSelector - - // Clear Buffer - ClearBuffers { - buffers: ClearBuffers.ColorDepthBuffer - NoDraw {} - } - - // Compute Pass - DispatchCompute { - workGroupX: 50; workGroupY: 1; workGroupZ: 1 - TechniqueFilter { - matchAll: [ - FilterKey { name: "type"; value: "compute"} - ] - } - } - - // Draw particles from buffer computed in the Compute Pass - CameraSelector { - id: selector - TechniqueFilter { - MemoryBarrier { waitFor: MemoryBarrier.VertexAttributeArray } - matchAll: [ - FilterKey { name: "type"; value: "draw"} - ] - } - } - } -} - diff --git a/examples/qt3d/compute-particles/ComputeMaterial.qml b/examples/qt3d/compute-particles/ComputeMaterial.qml deleted file mode 100644 index c1bb5c528..000000000 --- a/examples/qt3d/compute-particles/ComputeMaterial.qml +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 - -Material { - property Buffer dataBuffer; - property real particleStep: 0.4 - property real finalCollisionFactor: 0.2 - - parameters: [ - Parameter { name: "particleStep"; value: particleStep }, - Parameter { name: "finalCollisionFactor"; value: finalCollisionFactor } - ] - - effect: Effect { - techniques: [ - Technique { - renderPasses: [ - RenderPass { - shaderProgram: ShaderProgram { - computeShaderCode: loadSource("qrc:/shaders/gl43/particles.comp") - } - // We set the buffer as the parameter data - parameters: [ - Parameter { name: "Particles"; value: dataBuffer } - ] - } - ] - filterKeys: [ - FilterKey { name: "type"; value: "compute" } - ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - profile: GraphicsApiFilter.CoreProfile - majorVersion: 4 - minorVersion: 3 - } - }, - Technique { - renderPasses: [ - RenderPass { - shaderProgram: ShaderProgram { - vertexShaderCode: loadSource("qrc:/shaders/gl43/particles.vert") - fragmentShaderCode: loadSource("qrc:/shaders/gl43/particles.frag") - } - // We assume the mesh to be drawn will also receive - // Vertex buffers attributes that will be used to position and color - } - ] - filterKeys: [ - FilterKey { name: "type"; value: "draw" } - ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - profile: GraphicsApiFilter.CoreProfile - majorVersion: 4 - minorVersion: 3 - } - }, - Technique { - renderPasses: [ - RenderPass { - shaderProgram: ShaderProgram { - computeShaderCode: loadSource("qrc:/shaders/gl45/particles.comp") - } - // We set the buffer as the parameter data - parameters: [ - Parameter { name: "Particles"; value: dataBuffer } - ] - } - ] - filterKeys: [ - FilterKey { name: "type"; value: "compute" } - ] - graphicsApiFilter { - api: GraphicsApiFilter.RHI - profile: GraphicsApiFilter.NoProfile - majorVersion: 1 - minorVersion: 0 - } - }, - Technique { - renderPasses: [ - RenderPass { - shaderProgram: ShaderProgram { - vertexShaderCode: loadSource("qrc:/shaders/gl45/particles.vert") - fragmentShaderCode: loadSource("qrc:/shaders/gl45/particles.frag") - } - // We assume the mesh to be drawn will also receive - // Vertex buffers attributes that will be used to position and color - } - ] - filterKeys: [ - FilterKey { name: "type"; value: "draw" } - ] - graphicsApiFilter { - api: GraphicsApiFilter.RHI - profile: GraphicsApiFilter.NoProfile - majorVersion: 1 - minorVersion: 0 - } - } - ] // techniques - } -} - diff --git a/examples/qt3d/compute-particles/ParticlesScene.qml b/examples/qt3d/compute-particles/ParticlesScene.qml deleted file mode 100644 index ccb42c2b6..000000000 --- a/examples/qt3d/compute-particles/ParticlesScene.qml +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 -import Qt3D.Extras 2.0 - -Entity { - property alias particleStep: computeMaterial.particleStep - property alias finalCollisionFactor: computeMaterial.finalCollisionFactor - - readonly property int _SPHERE: 0 - readonly property int _CUBE: 1 - readonly property int _CYLINDER: 2 - readonly property int _TORUS: 3 - - property int particlesShape: _SPHERE - - signal reset() - - components: [ - RenderSettings { - ComputeFrameGraph { - camera: sceneCamera - } - // explicitly set RenderingPolicy to AlwaysRender, as changes in the - // scene won't be reflected in actual Qt scene-graph changes (due to - // GPU compute calls) - renderPolicy: RenderSettings.Always - } - ] - - FirstPersonCameraController { camera: sceneCamera } - - Camera { - id: sceneCamera - projectionType: CameraLens.PerspectiveProjection - viewCenter: Qt.vector3d(0, 0, 0) - position: Qt.vector3d(0, 0, -800) - nearPlane: 0.1 - farPlane: 1000 - fieldOfView: 25 - aspectRatio: 1.33 - } - - property int particlesCount: 50 * 1024 - readonly property int floatSize: 4 - - function buildParticlesBuffer() { - var byteSizeOfParticleData = 12; - var bufferData = new Float32Array(particlesCount * byteSizeOfParticleData); - var factor = 500.0; - for (var i = 0; i < particlesCount; ++i) { - var positionIdx = i * byteSizeOfParticleData; - var velocityIdx = i * byteSizeOfParticleData + 4; - var colorIdx = i * byteSizeOfParticleData + 8; - - for (var j = 0; j < 3; ++j) { - bufferData[positionIdx + j] = (Math.random() - 0.5) * factor; - bufferData[velocityIdx + j] = Math.random() * 2.0; - bufferData[colorIdx + j] = 0.75 + Math.sin(((i / 1024.0) + j * 0.333) * 6.0) * 0.25; - } - - bufferData[positionIdx + 3] = 1.0; - bufferData[velocityIdx + 3] = 0.0; - bufferData[colorIdx + 3] = 1.0; - } - return bufferData - } - - Buffer { - id: particleBuffer - // struct ParticleData - // { - // vec3 position; // Aligned to 4 floats - // vec3 velocity; // Aligned to 4 floats - // vec3 color; // Aligned to 4 floats - // }; - data: buildParticlesBuffer() - } - - onReset : { - particleBuffer.data = buildParticlesBuffer() - } - - Attribute { - id: particlePositionDataAttribute - name: "particlePosition" - attributeType: Attribute.VertexAttribute - vertexBaseType: Attribute.Float - vertexSize: 3 - divisor: 1 - byteStride: 12 * floatSize - buffer: particleBuffer - } - - Attribute { - id: particleColorDataAttribute - name: "particleColor" - attributeType: Attribute.VertexAttribute - vertexBaseType: Attribute.Float - vertexSize: 3 - divisor: 1 - byteOffset: 8 * floatSize - byteStride: 12 * floatSize - buffer: particleBuffer - } - - ComputeMaterial { - id: computeMaterial - dataBuffer: particleBuffer - } - - Entity { - id: particleComputeEntity - readonly property ComputeCommand particlesComputeJob: ComputeCommand {} - components: [ - particlesComputeJob, - computeMaterial - ] - } - - SphereGeometry { - id: sphereGeometry - rings: 10 - slices: 10 - radius: 1 - // Additional Attributes - attributes: [ - particlePositionDataAttribute, - particleColorDataAttribute - ] - } - - CuboidGeometry { - id: cubeGeometry - yzMeshResolution: Qt.size(2, 2) - xzMeshResolution: Qt.size(2, 2) - xyMeshResolution: Qt.size(2, 2) - // Additional Attributes - attributes: [ - particlePositionDataAttribute, - particleColorDataAttribute - ] - } - - CylinderGeometry { - id: cylinderGeometry - rings: 10 - slices: 10 - radius: 1 - length: 1.5 - // Additional Attributes - attributes: [ - particlePositionDataAttribute, - particleColorDataAttribute - ] - } - - TorusGeometry { - id: torusGeometry - rings: 10 - slices: 10 - radius: 1 - minorRadius: 0.5 - // Additional Attributes - attributes: [ - particlePositionDataAttribute, - particleColorDataAttribute - ] - } - - Entity { - id: particleRenderEntity - readonly property GeometryRenderer particlesRenderer: GeometryRenderer { - instanceCount: particlesCount - indexOffset: 0 - firstInstance: 0 - primitiveType: GeometryRenderer.Triangles - geometry: { - switch (particlesShape) { - case _SPHERE: - return sphereGeometry; - case _CUBE: - return cubeGeometry; - case _CYLINDER: - return cylinderGeometry; - case _TORUS: - return torusGeometry; - } - } - } - - components: [ - particlesRenderer, - computeMaterial - ] - } -} - diff --git a/examples/qt3d/compute-particles/compute-particles.pro b/examples/qt3d/compute-particles/compute-particles.pro deleted file mode 100644 index c25cc0c30..000000000 --- a/examples/qt3d/compute-particles/compute-particles.pro +++ /dev/null @@ -1,14 +0,0 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -QT += 3dcore 3drender 3dquick 3dinput quick qml - -HEADERS += \ - - -RESOURCES += \ - compute-particles.qrc - -SOURCES += \ - main.cpp diff --git a/examples/qt3d/compute-particles/compute-particles.qrc b/examples/qt3d/compute-particles/compute-particles.qrc deleted file mode 100644 index b9d41c875..000000000 --- a/examples/qt3d/compute-particles/compute-particles.qrc +++ /dev/null @@ -1,14 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>ComputeFrameGraph.qml</file> - <file>ComputeMaterial.qml</file> - <file>ParticlesScene.qml</file> - <file>shaders/gl43/particles.frag</file> - <file>shaders/gl43/particles.vert</file> - <file>shaders/gl43/particles.comp</file> - <file>shaders/gl45/particles.frag</file> - <file>shaders/gl45/particles.vert</file> - <file>shaders/gl45/particles.comp</file> - </qresource> -</RCC> diff --git a/examples/qt3d/compute-particles/main.cpp b/examples/qt3d/compute-particles/main.cpp deleted file mode 100644 index 3a8452813..000000000 --- a/examples/qt3d/compute-particles/main.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -#include <QGuiApplication> -#include <QQuickView> -#include <Qt3DRender/qt3drender-config.h> - -int main(int argc, char* argv[]) -{ - QGuiApplication app(argc, argv); - -#if !QT_CONFIG(qt3d_rhi_renderer) - qputenv("QSG_RHI_BACKEND", "opengl"); -#endif - - QQuickView view; - - view.resize(500, 500); - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl("qrc:/main.qml")); - view.show(); - - return app.exec(); -} diff --git a/examples/qt3d/compute-particles/main.qml b/examples/qt3d/compute-particles/main.qml deleted file mode 100644 index 89094bc1b..000000000 --- a/examples/qt3d/compute-particles/main.qml +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause - -import QtQuick 2.0 -import QtQuick.Scene3D 2.0 -import QtQuick.Controls 2.0 -import QtQuick.Layouts 1.1 - -Item { - - Scene3D { - anchors.fill: parent - aspects: "input" - ParticlesScene { - id: scene - particleStep: stepSlider.value - finalCollisionFactor: collisionSlider.value - } - } - - ColumnLayout { - id: colorLayout - anchors.left: parent.left - anchors.leftMargin: 35 - anchors.right: parent.right - anchors.rightMargin: 35 - anchors.bottom: parent.bottom - anchors.bottomMargin: 35 - spacing: 15 - - RowLayout { - Text { - text: "Particles Step:" - color: "white" - } - Slider { - height: 35 - id: stepSlider - Layout.fillWidth: true - from: 0.0 - to: 2 - value: 0.4 - } - } - RowLayout { - Text { - text: "Particles Collision:" - color: "white" - } - Slider { - height: 35 - id: collisionSlider - Layout.fillWidth: true - from: 0.0 - to: 2 - value: 0.2 - } - } - RowLayout { - Button { - text: "Reset Particles" - onClicked: scene.reset() - } - } - RowLayout { - Text { - text: "Particles Shape:" - color: "white" - } - ButtonGroup { - exclusive: true - id: particlesTypeGroup - } - CheckBox { - text: "Sphere" - checked: true - ButtonGroup.group: particlesTypeGroup - onClicked: scene.particlesShape = scene._SPHERE - } - CheckBox - { text: "Cube" - checked: false - ButtonGroup.group: particlesTypeGroup - onClicked: scene.particlesShape = scene._CUBE - } - CheckBox { - text: "Cylinder" - checked: false - ButtonGroup.group: particlesTypeGroup - onClicked: scene.particlesShape = scene._CYLINDER - } - CheckBox { - text: "Torus" - checked: false - ButtonGroup.group: particlesTypeGroup - onClicked: scene.particlesShape = scene._TORUS - } - } - } -} diff --git a/examples/qt3d/compute-particles/shaders/gl43/particles.comp b/examples/qt3d/compute-particles/shaders/gl43/particles.comp deleted file mode 100644 index af993bbe2..000000000 --- a/examples/qt3d/compute-particles/shaders/gl43/particles.comp +++ /dev/null @@ -1,41 +0,0 @@ -#version 430 core - -uniform float particleStep; -uniform float finalCollisionFactor; - -layout (local_size_x = 1024) in; - -struct ParticleData -{ - vec4 position; - vec4 direction; - vec4 color; -}; - -// Particles from previouse frame -layout (std430, binding = 0) coherent buffer Particles -{ - ParticleData particles[]; -} data; - -void main(void) -{ - uint globalId = gl_GlobalInvocationID.x; - - // Retrieve current particle from previous frame - ParticleData currentParticle = data.particles[globalId]; - - // New position = old position + distance traveled over step duration - currentParticle.position = currentParticle.position + currentParticle.direction * particleStep; - - // Make acceleration more or less point toward the center of the scene - vec4 acceleration = normalize(vec4(0.0) - currentParticle.position) * finalCollisionFactor; - - // New velocity = old velocity + acceleration over step duration - currentParticle.direction = currentParticle.direction + acceleration * particleStep; - - - - // Save updated particle - data.particles[globalId] = currentParticle; -} diff --git a/examples/qt3d/compute-particles/shaders/gl43/particles.frag b/examples/qt3d/compute-particles/shaders/gl43/particles.frag deleted file mode 100644 index 3f11b9868..000000000 --- a/examples/qt3d/compute-particles/shaders/gl43/particles.frag +++ /dev/null @@ -1,33 +0,0 @@ -#version 430 core - -out vec4 color; - -in VertexBlock -{ - flat vec3 color; - vec3 pos; - vec3 normal; -} frag_in; - -const vec4 lightPosition = vec4(0.0, 0.0, 0.0, 0.0); -const vec3 lightIntensity = vec3(1.0, 1.0, 1.0); -const vec3 ka = vec3(0.1, 0.1, 0.1); -const vec3 ks = vec3(0.8, 0.8, 0.8); -const float shininess = 50.0; - -vec3 ads() -{ - vec3 n = normalize( frag_in.normal); - vec3 s = normalize( vec3(lightPosition) - frag_in.pos ); - vec3 v = normalize( -frag_in.pos ); - vec3 h = normalize( v + s ); - return lightIntensity * (ka + - frag_in.color * max( dot(s, frag_in.normal ), 0.0 ) + - ks * pow( max( dot( h, n ), 0.0 ), shininess ) ); -} - - -void main(void) -{ - color = vec4(ads(), 1.0); -} diff --git a/examples/qt3d/compute-particles/shaders/gl43/particles.vert b/examples/qt3d/compute-particles/shaders/gl43/particles.vert deleted file mode 100644 index 5f2da2a00..000000000 --- a/examples/qt3d/compute-particles/shaders/gl43/particles.vert +++ /dev/null @@ -1,27 +0,0 @@ -#version 430 core - -in vec3 vertexPosition; -in vec3 vertexNormal; - -in vec3 particlePosition; -in vec3 particleColor; - -out VertexBlock -{ - flat vec3 color; - vec3 pos; - vec3 normal; -} v_out; - -uniform mat4 mvp; -uniform mat3 modelViewNormal; -uniform mat4 modelView; - -void main(void) -{ - vec4 pos = vec4(vertexPosition.xyz, 1.0) + vec4(particlePosition, 0.0); - gl_Position = mvp * pos; - v_out.pos = vec4(modelView * pos).xyz; - v_out.normal = normalize(modelViewNormal * vertexNormal); - v_out.color = mix(particleColor * 0.2, particleColor, smoothstep(0.5, 0.8, abs(v_out.normal).z)); -} diff --git a/examples/qt3d/compute-particles/shaders/gl45/particles.comp b/examples/qt3d/compute-particles/shaders/gl45/particles.comp deleted file mode 100644 index 9a6f74cfc..000000000 --- a/examples/qt3d/compute-particles/shaders/gl45/particles.comp +++ /dev/null @@ -1,43 +0,0 @@ -#version 450 core - -layout(std140, binding=3) uniform particle_uniforms { - float particleStep; - float finalCollisionFactor; -}; - -layout (local_size_x = 1024) in; - -struct ParticleData -{ - vec4 position; - vec4 direction; - vec4 color; -}; - -// Particles from previouse frame -layout (std430, binding = 5) coherent buffer Particles -{ - ParticleData particles[]; -} data; - -void main(void) -{ - uint globalId = gl_GlobalInvocationID.x; - - // Retrieve current particle from previous frame - ParticleData currentParticle = data.particles[globalId]; - - // New position = old position + distance traveled over step duration - currentParticle.position = currentParticle.position + currentParticle.direction * particleStep; - - // Make acceleration more or less point toward the center of the scene - vec4 acceleration = normalize(vec4(0.0) - currentParticle.position) * finalCollisionFactor; - - // New velocity = old velocity + acceleration over step duration - currentParticle.direction = currentParticle.direction + acceleration * particleStep; - - - - // Save updated particle - data.particles[globalId] = currentParticle; -} diff --git a/examples/qt3d/compute-particles/shaders/gl45/particles.frag b/examples/qt3d/compute-particles/shaders/gl45/particles.frag deleted file mode 100644 index 42fb12b40..000000000 --- a/examples/qt3d/compute-particles/shaders/gl45/particles.frag +++ /dev/null @@ -1,33 +0,0 @@ -#version 450 core - -layout(location = 0) out vec4 color; - -layout(location = 0) in VertexBlock -{ - flat vec3 color; - vec3 pos; - vec3 normal; -} frag_in; - -const vec4 lightPosition = vec4(0.0, 0.0, 0.0, 0.0); -const vec3 lightIntensity = vec3(1.0, 1.0, 1.0); -const vec3 ka = vec3(0.1, 0.1, 0.1); -const vec3 ks = vec3(0.8, 0.8, 0.8); -const float shininess = 50.0; - -vec3 ads() -{ - vec3 n = normalize( frag_in.normal); - vec3 s = normalize( vec3(lightPosition) - frag_in.pos ); - vec3 v = normalize( -frag_in.pos ); - vec3 h = normalize( v + s ); - return lightIntensity * (ka + - frag_in.color * max( dot(s, frag_in.normal ), 0.0 ) + - ks * pow( max( dot( h, n ), 0.0 ), shininess ) ); -} - - -void main(void) -{ - color = vec4(ads(), 1.0); -} diff --git a/examples/qt3d/compute-particles/shaders/gl45/particles.vert b/examples/qt3d/compute-particles/shaders/gl45/particles.vert deleted file mode 100644 index b5815f6fb..000000000 --- a/examples/qt3d/compute-particles/shaders/gl45/particles.vert +++ /dev/null @@ -1,33 +0,0 @@ -#version 450 core - -layout(location = 0) in vec3 vertexPosition; -layout(location = 1) in vec3 vertexNormal; - -layout(location = 2) in vec3 particlePosition; -layout(location = 3) in vec3 particleColor; - -layout (location = 0) out VertexBlock -{ - flat vec3 color; - vec3 pos; - vec3 normal; -} v_out; - -layout(std140, binding = 1) uniform qt3d_command_uniforms { - mat4 modelMatrix; - mat4 inverseModelMatrix; - mat4 modelViewMatrix; - mat3 modelNormalMatrix; - mat4 inverseModelViewMatrix; - mat4 modelViewProjection; - mat4 inverseModelViewProjectionMatrix; -}; - -void main(void) -{ - vec4 pos = vec4(vertexPosition.xyz, 1.0) + vec4(particlePosition, 0.0); - gl_Position = modelViewProjection * pos; - v_out.pos = vec4(modelViewMatrix * pos).xyz; - v_out.normal = normalize(modelNormalMatrix * vertexNormal); - v_out.color = mix(particleColor * 0.2, particleColor, smoothstep(0.5, 0.8, abs(v_out.normal).z)); -} |