DiffuseProbeGridComponentController.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Components/DiffuseProbeGridComponentController.h>
  9. #include <Components/DiffuseProbeGridComponentConstants.h>
  10. #include <Atom/RPI.Public/Model/Model.h>
  11. #include <Atom/RPI.Public/Image/StreamingImage.h>
  12. #include <Atom/RPI.Public/Scene.h>
  13. #include <AzCore/Asset/AssetManager.h>
  14. #include <AzCore/Asset/AssetManagerBus.h>
  15. #include <AzCore/Asset/AssetSerializer.h>
  16. #include <AzCore/Serialization/SerializeContext.h>
  17. #include <AzFramework/Entity/EntityContextBus.h>
  18. #include <AzFramework/Entity/EntityContext.h>
  19. #include <AzFramework/Scene/Scene.h>
  20. #include <AzFramework/Scene/SceneSystemInterface.h>
  21. #include <AzCore/RTTI/BehaviorContext.h>
  22. namespace AZ
  23. {
  24. namespace Render
  25. {
  26. void DiffuseProbeGridComponentConfig::Reflect(ReflectContext* context)
  27. {
  28. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  29. {
  30. serializeContext->Class<DiffuseProbeGridComponentConfig>()
  31. ->Version(5) // Added EdgeBlendIbl
  32. ->Field("ProbeSpacing", &DiffuseProbeGridComponentConfig::m_probeSpacing)
  33. ->Field("Extents", &DiffuseProbeGridComponentConfig::m_extents)
  34. ->Field("AmbientMultiplier", &DiffuseProbeGridComponentConfig::m_ambientMultiplier)
  35. ->Field("ViewBias", &DiffuseProbeGridComponentConfig::m_viewBias)
  36. ->Field("NormalBias", &DiffuseProbeGridComponentConfig::m_normalBias)
  37. ->Field("NumRaysPerProbe", &DiffuseProbeGridComponentConfig::m_numRaysPerProbe)
  38. ->Field("Scrolling", &DiffuseProbeGridComponentConfig::m_scrolling)
  39. ->Field("EdgeBlendIbl", &DiffuseProbeGridComponentConfig::m_edgeBlendIbl)
  40. ->Field("FrameUpdateCount", &DiffuseProbeGridComponentConfig::m_frameUpdateCount)
  41. ->Field("TransparencyMode", &DiffuseProbeGridComponentConfig::m_transparencyMode)
  42. ->Field("EditorMode", &DiffuseProbeGridComponentConfig::m_editorMode)
  43. ->Field("RuntimeMode", &DiffuseProbeGridComponentConfig::m_runtimeMode)
  44. ->Field("BakedIrradianceTextureRelativePath", &DiffuseProbeGridComponentConfig::m_bakedIrradianceTextureRelativePath)
  45. ->Field("BakedDistanceTextureRelativePath", &DiffuseProbeGridComponentConfig::m_bakedDistanceTextureRelativePath)
  46. ->Field("BakedProbeDataTextureRelativePath", &DiffuseProbeGridComponentConfig::m_bakedProbeDataTextureRelativePath)
  47. ->Field("BakedIrradianceTextureAsset", &DiffuseProbeGridComponentConfig::m_bakedIrradianceTextureAsset)
  48. ->Field("BakedDistanceTextureAsset", &DiffuseProbeGridComponentConfig::m_bakedDistanceTextureAsset)
  49. ->Field("BakedProbeDataTextureAsset", &DiffuseProbeGridComponentConfig::m_bakedProbeDataTextureAsset)
  50. ->Field("VisualizationEnabled", &DiffuseProbeGridComponentConfig::m_visualizationEnabled)
  51. ->Field("VisualizationShowInactiveProbes", &DiffuseProbeGridComponentConfig::m_visualizationShowInactiveProbes)
  52. ->Field("VisualizationSphereRadius", &DiffuseProbeGridComponentConfig::m_visualizationSphereRadius)
  53. ;
  54. }
  55. }
  56. void DiffuseProbeGridComponentController::Reflect(ReflectContext* context)
  57. {
  58. DiffuseProbeGridComponentConfig::Reflect(context);
  59. if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
  60. {
  61. serializeContext->Class<DiffuseProbeGridComponentController>()
  62. ->Version(0)
  63. ->Field("Configuration", &DiffuseProbeGridComponentController::m_configuration);
  64. }
  65. }
  66. void DiffuseProbeGridComponentController::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
  67. {
  68. dependent.push_back(AZ_CRC("TransformService", 0x8ee22c50));
  69. }
  70. void DiffuseProbeGridComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  71. {
  72. provided.push_back(AZ_CRC("DiffuseProbeGridService", 0x63d32042));
  73. }
  74. void DiffuseProbeGridComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  75. {
  76. incompatible.push_back(AZ_CRC("DiffuseProbeGridService", 0x63d32042));
  77. incompatible.push_back(AZ_CRC_CE("NonUniformScaleService"));
  78. }
  79. void DiffuseProbeGridComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
  80. {
  81. required.push_back(AZ_CRC("BoxShapeService", 0x946a0032));
  82. required.push_back(AZ_CRC("TransformService"));
  83. }
  84. DiffuseProbeGridComponentController::DiffuseProbeGridComponentController(const DiffuseProbeGridComponentConfig& config)
  85. : m_configuration(config)
  86. {
  87. }
  88. void DiffuseProbeGridComponentController::Activate(AZ::EntityId entityId)
  89. {
  90. m_entityId = entityId;
  91. TransformNotificationBus::Handler::BusConnect(m_entityId);
  92. m_featureProcessor = RPI::Scene::GetFeatureProcessorForEntity<DiffuseProbeGridFeatureProcessorInterface>(entityId);
  93. AZ_Assert(m_featureProcessor, "DiffuseProbeGridComponentController was unable to find a DiffuseProbeGridFeatureProcessor on the EntityContext provided.");
  94. m_transformInterface = TransformBus::FindFirstHandler(entityId);
  95. AZ_Assert(m_transformInterface, "Unable to attach to a TransformBus handler");
  96. if (!m_transformInterface)
  97. {
  98. return;
  99. }
  100. LmbrCentral::ShapeComponentNotificationsBus::Handler::BusConnect(m_entityId);
  101. m_shapeBus = LmbrCentral::ShapeComponentRequestsBus::FindFirstHandler(m_entityId);
  102. AZ_Assert(m_shapeBus, "DiffuseProbeGridComponentController was unable to find ShapeComponentNotificationsBus");
  103. m_boxShapeInterface = LmbrCentral::BoxShapeComponentRequestsBus::FindFirstHandler(m_entityId);
  104. AZ_Assert(m_boxShapeInterface, "DiffuseProbeGridComponentController was unable to find box shape component");
  105. // special handling is required if this component is being cloned in the editor:
  106. // check to see if the baked textures are already referenced by another DiffuseProbeGrid
  107. if (m_featureProcessor->AreBakedTexturesReferenced(
  108. m_configuration.m_bakedIrradianceTextureRelativePath,
  109. m_configuration.m_bakedDistanceTextureRelativePath,
  110. m_configuration.m_bakedProbeDataTextureRelativePath))
  111. {
  112. // clear the baked texture paths and assets, since they belong to the original entity (not the clone)
  113. m_configuration.m_bakedIrradianceTextureRelativePath.clear();
  114. m_configuration.m_bakedDistanceTextureRelativePath.clear();
  115. m_configuration.m_bakedProbeDataTextureRelativePath.clear();
  116. m_configuration.m_bakedIrradianceTextureAsset.Reset();
  117. m_configuration.m_bakedDistanceTextureAsset.Reset();
  118. m_configuration.m_bakedProbeDataTextureAsset.Reset();
  119. }
  120. // add this diffuse probe grid to the feature processor
  121. const AZ::Transform& transform = m_transformInterface->GetWorldTM();
  122. m_handle = m_featureProcessor->AddProbeGrid(
  123. ComputeOverallTransform(transform), m_configuration.m_extents, m_configuration.m_probeSpacing);
  124. m_featureProcessor->SetAmbientMultiplier(m_handle, m_configuration.m_ambientMultiplier);
  125. m_featureProcessor->SetViewBias(m_handle, m_configuration.m_viewBias);
  126. m_featureProcessor->SetNormalBias(m_handle, m_configuration.m_normalBias);
  127. m_featureProcessor->SetNumRaysPerProbe(m_handle, m_configuration.m_numRaysPerProbe);
  128. m_featureProcessor->SetScrolling(m_handle, m_configuration.m_scrolling);
  129. m_featureProcessor->SetEdgeBlendIbl(m_handle, m_configuration.m_edgeBlendIbl);
  130. m_featureProcessor->SetFrameUpdateCount(m_handle, m_configuration.m_frameUpdateCount);
  131. m_featureProcessor->SetTransparencyMode(m_handle, m_configuration.m_transparencyMode);
  132. m_featureProcessor->SetVisualizationEnabled(m_handle, m_configuration.m_visualizationEnabled);
  133. m_featureProcessor->SetVisualizationShowInactiveProbes(m_handle, m_configuration.m_visualizationShowInactiveProbes);
  134. m_featureProcessor->SetVisualizationSphereRadius(m_handle, m_configuration.m_visualizationSphereRadius);
  135. // load the baked texture assets, but only if they are all valid
  136. if (m_configuration.m_bakedIrradianceTextureAsset.GetId().IsValid() &&
  137. m_configuration.m_bakedDistanceTextureAsset.GetId().IsValid() &&
  138. m_configuration.m_bakedProbeDataTextureAsset.GetId().IsValid())
  139. {
  140. Data::AssetBus::MultiHandler::BusConnect(m_configuration.m_bakedIrradianceTextureAsset.GetId());
  141. Data::AssetBus::MultiHandler::BusConnect(m_configuration.m_bakedDistanceTextureAsset.GetId());
  142. Data::AssetBus::MultiHandler::BusConnect(m_configuration.m_bakedProbeDataTextureAsset.GetId());
  143. m_configuration.m_bakedIrradianceTextureAsset.QueueLoad();
  144. m_configuration.m_bakedDistanceTextureAsset.QueueLoad();
  145. m_configuration.m_bakedProbeDataTextureAsset.QueueLoad();
  146. }
  147. else if (m_configuration.m_runtimeMode == DiffuseProbeGridMode::Baked ||
  148. m_configuration.m_runtimeMode == DiffuseProbeGridMode::AutoSelect ||
  149. m_configuration.m_editorMode == DiffuseProbeGridMode::Baked ||
  150. m_configuration.m_editorMode == DiffuseProbeGridMode::AutoSelect)
  151. {
  152. AZ_Error("DiffuseProbeGrid", false, "DiffuseProbeGrid mode is set to Baked or Auto-Select, but it does not have baked texture assets. Please re-bake this DiffuseProbeGrid.");
  153. }
  154. m_featureProcessor->SetMode(m_handle, m_configuration.m_runtimeMode);
  155. // if this is a new DiffuseProbeGrid entity and the box shape has not been changed (i.e., it's still unit sized)
  156. // then use the default extents, otherwise use the current box shape extents
  157. AZ::Vector3 extents(0.0f);
  158. AZ::Vector3 boxDimensions = m_boxShapeInterface->GetBoxDimensions();
  159. if (m_configuration.m_entityId == EntityId::InvalidEntityId && boxDimensions == AZ::Vector3(1.0f))
  160. {
  161. extents = m_configuration.m_extents;
  162. }
  163. else
  164. {
  165. extents = boxDimensions;
  166. }
  167. m_boxShapeInterface->SetBoxDimensions(extents);
  168. m_boxChangedByGridEvent.Signal(true);
  169. }
  170. void DiffuseProbeGridComponentController::OnAssetReady(Data::Asset<Data::AssetData> asset)
  171. {
  172. // if all assets are ready we can set the baked texture images
  173. if (m_configuration.m_bakedIrradianceTextureAsset.IsReady() &&
  174. m_configuration.m_bakedDistanceTextureAsset.IsReady() &&
  175. m_configuration.m_bakedProbeDataTextureAsset.IsReady())
  176. {
  177. Data::AssetBus::MultiHandler::BusDisconnect(m_configuration.m_bakedIrradianceTextureAsset.GetId());
  178. Data::AssetBus::MultiHandler::BusDisconnect(m_configuration.m_bakedDistanceTextureAsset.GetId());
  179. Data::AssetBus::MultiHandler::BusDisconnect(m_configuration.m_bakedProbeDataTextureAsset.GetId());
  180. UpdateBakedTextures();
  181. }
  182. }
  183. void DiffuseProbeGridComponentController::OnAssetError(Data::Asset<Data::AssetData> asset)
  184. {
  185. Data::AssetBus::MultiHandler::BusDisconnect(asset.GetId());
  186. AZ_Error("DiffuseProbeGrid", false, "Failed to load baked texture [%s], please re-bake this DiffuseProbeGrid.", asset.GetId().ToString<AZStd::string>().c_str());
  187. }
  188. void DiffuseProbeGridComponentController::Deactivate()
  189. {
  190. if (m_featureProcessor)
  191. {
  192. m_featureProcessor->RemoveProbeGrid(m_handle);
  193. }
  194. LmbrCentral::ShapeComponentNotificationsBus::Handler::BusDisconnect();
  195. Data::AssetBus::MultiHandler::BusDisconnect();
  196. TransformNotificationBus::Handler::BusDisconnect();
  197. m_transformInterface = nullptr;
  198. m_featureProcessor = nullptr;
  199. m_shapeBus = nullptr;
  200. m_boxShapeInterface = nullptr;
  201. }
  202. void DiffuseProbeGridComponentController::SetConfiguration(const DiffuseProbeGridComponentConfig& config)
  203. {
  204. m_configuration = config;
  205. }
  206. const DiffuseProbeGridComponentConfig& DiffuseProbeGridComponentController::GetConfiguration() const
  207. {
  208. return m_configuration;
  209. }
  210. void DiffuseProbeGridComponentController::OnTransformChanged([[maybe_unused]] const AZ::Transform& local, const AZ::Transform& world)
  211. {
  212. if (!m_featureProcessor)
  213. {
  214. return;
  215. }
  216. m_featureProcessor->SetTransform(m_handle, ComputeOverallTransform(world));
  217. }
  218. void DiffuseProbeGridComponentController::OnShapeChanged(ShapeChangeReasons changeReason)
  219. {
  220. if (!m_featureProcessor)
  221. {
  222. return;
  223. }
  224. if (m_inShapeChangeHandler)
  225. {
  226. return;
  227. }
  228. m_inShapeChangeHandler = true;
  229. AZ_Assert(m_featureProcessor->IsValidProbeGridHandle(m_handle), "OnShapeChanged handler called before probe was registered with feature processor");
  230. if (changeReason == ShapeChangeReasons::ShapeChanged)
  231. {
  232. AZ::Vector3 dimensions = m_boxShapeInterface->GetBoxDimensions();
  233. if (m_featureProcessor->ValidateExtents(m_handle, dimensions))
  234. {
  235. m_featureProcessor->SetExtents(m_handle, dimensions);
  236. m_configuration.m_extents = dimensions;
  237. }
  238. else
  239. {
  240. // restore old dimensions
  241. m_boxShapeInterface->SetBoxDimensions(m_configuration.m_extents);
  242. m_boxChangedByGridEvent.Signal(true);
  243. }
  244. // the shape translation offset may have changed, which would affect the overall transform
  245. m_featureProcessor->SetTransform(m_handle, ComputeOverallTransform(m_transformInterface->GetWorldTM()));
  246. }
  247. m_inShapeChangeHandler = false;
  248. }
  249. AZ::Aabb DiffuseProbeGridComponentController::GetAabb() const
  250. {
  251. return m_shapeBus ? m_shapeBus->GetEncompassingAabb() : AZ::Aabb::CreateNull();
  252. }
  253. void DiffuseProbeGridComponentController::RegisterBoxChangedByGridHandler(AZ::Event<bool>::Handler& handler)
  254. {
  255. handler.Connect(m_boxChangedByGridEvent);
  256. }
  257. bool DiffuseProbeGridComponentController::ValidateProbeSpacing(const AZ::Vector3& newSpacing)
  258. {
  259. return m_featureProcessor->ValidateProbeSpacing(m_handle, newSpacing);
  260. }
  261. void DiffuseProbeGridComponentController::SetProbeSpacing(const AZ::Vector3& probeSpacing)
  262. {
  263. m_configuration.m_probeSpacing = probeSpacing;
  264. m_featureProcessor->SetProbeSpacing(m_handle, m_configuration.m_probeSpacing);
  265. }
  266. void DiffuseProbeGridComponentController::SetAmbientMultiplier(float ambientMultiplier)
  267. {
  268. if (!m_featureProcessor)
  269. {
  270. return;
  271. }
  272. m_configuration.m_ambientMultiplier = ambientMultiplier;
  273. m_featureProcessor->SetAmbientMultiplier(m_handle, m_configuration.m_ambientMultiplier);
  274. }
  275. void DiffuseProbeGridComponentController::SetViewBias(float viewBias)
  276. {
  277. if (!m_featureProcessor)
  278. {
  279. return;
  280. }
  281. m_configuration.m_viewBias = viewBias;
  282. m_featureProcessor->SetViewBias(m_handle, m_configuration.m_viewBias);
  283. }
  284. void DiffuseProbeGridComponentController::SetNormalBias(float normalBias)
  285. {
  286. if (!m_featureProcessor)
  287. {
  288. return;
  289. }
  290. m_configuration.m_normalBias = normalBias;
  291. m_featureProcessor->SetNormalBias(m_handle, m_configuration.m_normalBias);
  292. }
  293. void DiffuseProbeGridComponentController::SetNumRaysPerProbe(const DiffuseProbeGridNumRaysPerProbe& numRaysPerProbe)
  294. {
  295. if (!m_featureProcessor)
  296. {
  297. return;
  298. }
  299. m_configuration.m_numRaysPerProbe = numRaysPerProbe;
  300. m_featureProcessor->SetNumRaysPerProbe(m_handle, m_configuration.m_numRaysPerProbe);
  301. }
  302. void DiffuseProbeGridComponentController::SetScrolling(bool scrolling)
  303. {
  304. if (!m_featureProcessor)
  305. {
  306. return;
  307. }
  308. m_configuration.m_scrolling = scrolling;
  309. m_featureProcessor->SetScrolling(m_handle, m_configuration.m_scrolling);
  310. }
  311. void DiffuseProbeGridComponentController::SetEdgeBlendIbl(bool edgeBlendIbl)
  312. {
  313. if (!m_featureProcessor)
  314. {
  315. return;
  316. }
  317. m_configuration.m_edgeBlendIbl = edgeBlendIbl;
  318. m_featureProcessor->SetEdgeBlendIbl(m_handle, m_configuration.m_edgeBlendIbl);
  319. }
  320. void DiffuseProbeGridComponentController::SetFrameUpdateCount(uint32_t frameUpdateCount)
  321. {
  322. if (!m_featureProcessor)
  323. {
  324. return;
  325. }
  326. m_configuration.m_frameUpdateCount = frameUpdateCount;
  327. m_featureProcessor->SetFrameUpdateCount(m_handle, m_configuration.m_frameUpdateCount);
  328. }
  329. void DiffuseProbeGridComponentController::SetTransparencyMode(DiffuseProbeGridTransparencyMode transparencyMode)
  330. {
  331. if (!m_featureProcessor)
  332. {
  333. return;
  334. }
  335. m_configuration.m_transparencyMode = transparencyMode;
  336. m_featureProcessor->SetTransparencyMode(m_handle, m_configuration.m_transparencyMode);
  337. }
  338. void DiffuseProbeGridComponentController::SetEditorMode(DiffuseProbeGridMode editorMode)
  339. {
  340. if (!m_featureProcessor)
  341. {
  342. return;
  343. }
  344. // update the configuration and change the DiffuseProbeGrid mode
  345. m_configuration.m_editorMode = editorMode;
  346. m_featureProcessor->SetMode(m_handle, m_configuration.m_editorMode);
  347. }
  348. void DiffuseProbeGridComponentController::SetRuntimeMode(DiffuseProbeGridMode runtimeMode)
  349. {
  350. if (!m_featureProcessor)
  351. {
  352. return;
  353. }
  354. // only update the configuration
  355. m_configuration.m_runtimeMode = runtimeMode;
  356. }
  357. void DiffuseProbeGridComponentController::SetVisualizationEnabled(bool visualizationEnabled)
  358. {
  359. if (!m_featureProcessor)
  360. {
  361. return;
  362. }
  363. m_configuration.m_visualizationEnabled = visualizationEnabled;
  364. m_featureProcessor->SetVisualizationEnabled(m_handle, m_configuration.m_visualizationEnabled);
  365. }
  366. void DiffuseProbeGridComponentController::SetVisualizationShowInactiveProbes(bool visualizationShowInactiveProbes)
  367. {
  368. if (!m_featureProcessor)
  369. {
  370. return;
  371. }
  372. m_configuration.m_visualizationShowInactiveProbes = visualizationShowInactiveProbes;
  373. m_featureProcessor->SetVisualizationShowInactiveProbes(m_handle, m_configuration.m_visualizationShowInactiveProbes);
  374. }
  375. void DiffuseProbeGridComponentController::SetVisualizationSphereRadius(float visualizationSphereRadius)
  376. {
  377. if (!m_featureProcessor)
  378. {
  379. return;
  380. }
  381. m_configuration.m_visualizationSphereRadius = visualizationSphereRadius;
  382. m_featureProcessor->SetVisualizationSphereRadius(m_handle, m_configuration.m_visualizationSphereRadius);
  383. }
  384. void DiffuseProbeGridComponentController::BakeTextures(DiffuseProbeGridBakeTexturesCallback callback)
  385. {
  386. if (!m_featureProcessor)
  387. {
  388. return;
  389. }
  390. m_featureProcessor->BakeTextures(
  391. m_handle,
  392. callback,
  393. m_configuration.m_bakedIrradianceTextureRelativePath,
  394. m_configuration.m_bakedDistanceTextureRelativePath,
  395. m_configuration.m_bakedProbeDataTextureRelativePath);
  396. }
  397. void DiffuseProbeGridComponentController::UpdateBakedTextures()
  398. {
  399. if (!m_featureProcessor)
  400. {
  401. return;
  402. }
  403. DiffuseProbeGridBakedTextures bakedTextures;
  404. bakedTextures.m_irradianceImage = RPI::StreamingImage::FindOrCreate(m_configuration.m_bakedIrradianceTextureAsset);
  405. bakedTextures.m_irradianceImageRelativePath = m_configuration.m_bakedIrradianceTextureRelativePath;
  406. bakedTextures.m_distanceImage = RPI::StreamingImage::FindOrCreate(m_configuration.m_bakedDistanceTextureAsset);
  407. bakedTextures.m_distanceImageRelativePath = m_configuration.m_bakedDistanceTextureRelativePath;
  408. bakedTextures.m_probeDataImage = RPI::StreamingImage::FindOrCreate(m_configuration.m_bakedProbeDataTextureAsset);
  409. bakedTextures.m_probeDataImageRelativePath = m_configuration.m_bakedProbeDataTextureRelativePath;
  410. m_featureProcessor->SetBakedTextures(m_handle, bakedTextures);
  411. }
  412. AZ::Transform DiffuseProbeGridComponentController::ComputeOverallTransform(const AZ::Transform& entityTransform) const
  413. {
  414. const bool isTypeAxisAligned = m_boxShapeInterface ? m_boxShapeInterface->IsTypeAxisAligned() : false;
  415. const AZ::Vector3 translationOffset = m_shapeBus ? m_shapeBus->GetTranslationOffset() : AZ::Vector3::CreateZero();
  416. const AZ::Transform translationOffsetTransform = AZ::Transform::CreateTranslation(translationOffset);
  417. if (isTypeAxisAligned)
  418. {
  419. AZ::Transform entityTransformNoRotation = entityTransform;
  420. entityTransformNoRotation.SetRotation(AZ::Quaternion::CreateIdentity());
  421. return entityTransformNoRotation * translationOffsetTransform;
  422. }
  423. return entityTransform * translationOffsetTransform;
  424. }
  425. } // namespace Render
  426. } // namespace AZ