PointLight QML Type
シーン内のポイントライトを定義します。詳細...
Import Statement: | import QtQuick3D |
Inherits: |
プロパティ
- constantFade : real
- linearFade : real
- quadraticFade : real
詳細説明
点光源は球体と表現することができ、光の中心からすべての方向に等しい強さで光を放つ。これは電球の発光に似ています。
点光源を回転させたり拡大縮小しても、何の効果もありません。点光源を移動すると、光が放射される位置が変わります。
デフォルトでは、点光源の強度は逆二乗則に従って減衰します。ただし、フェードオフ(および範囲)は、constantFade 、linearFade 、quadraticFade プロパティで制御できます。光の減衰は次の式で計算されます: constantFade +distance
* (linearFade * 0.01) +distance^2
* (quadraticFade * 0.0001)
簡単な例:3つの異なる方法で球体をシェーディングする
背景の拡大された長方形の前に球体を含むシーンを取ります。長方形のPrincipledMaterial のデフォルトのベースカラーは白です。
ライトなしで、2つのメッシュのライト関連のシェーディングを無効にすると、次のようになります:
import QtQuick import QtQuick3D View3D { anchors.fill: parent PerspectiveCamera { z: 600 } Model { source: "#Rectangle" scale: Qt.vector3d(10, 10, 10) z: -100 materials: PrincipledMaterial { lighting: PrincipledMaterial.NoLighting } } Model { source: "#Sphere" scale: Qt.vector3d(2, 2, 2) materials: PrincipledMaterial { lighting: PrincipledMaterial.NoLighting baseColor: "#40c060" roughness: 0.1 } } }
ディレクショナル・ライトを追加し、デフォルトでZ軸の下方向に発光させると、次のようになります:
import QtQuick import QtQuick3D View3D { anchors.fill: parent PerspectiveCamera { z: 600 } DirectionalLight { } Model { source: "#Rectangle" scale: Qt.vector3d(10, 10, 10) z: -100 materials: PrincipledMaterial { } } Model { source: "#Sphere" scale: Qt.vector3d(2, 2, 2) materials: PrincipledMaterial { baseColor: "#40c060" roughness: 0.1 } } }
PointLight { z: 300 }
ここでは、白の PointLight を Z 軸上に移動させ、カメラとシーンの中心の中間に位置するようにしています。DirectionalLight とは異なり、PointLight の回転は重要ではありませんが、位置は重要です。ここでは、特に背景の矩形メッシュで、強度の減少が見られます。
その他の使用例については、Qt Quick 3D - Lights Exampleを参照してください。
DirectionalLight,SpotLight,Shadow Mappingも参照して ください。
プロパティの説明
constantFade : real |
このプロパティは、ライトの減衰項の定数係数です。デフォルト値は 1.0 です。
linearFade : real |
このプロパティは、ライトへの距離に比例して、ライティング エフェクトがライトを減光させる割合を増加させます。デフォルト値は0.0
で、ライトはリニア フェードしないことを意味します。ここで使用される値は、光の減衰の計算に使用される前に0.01
で乗算されます。
quadraticFade : real |
このプロパティは、逆二乗則に比例して、照明効果が光を減衰させる割合を増加させます。デフォルト値は1.0で、点光源の減衰が逆二乗則に正確に従うことを意味します。つまり、オブジェクトまでの距離が2倍になると、光量は1/4に減少します。ここで使用される値は、光の減衰を計算する前に0.0001
。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.