@@ -190,7 +190,7 @@ int main()
190
190
191
191
IAssetLoader::SAssetLoadParams lp;
192
192
auto srcImageBundle = am->getAsset (" ../../media/colorexr.exr" , lp);
193
- auto kerImageBundle = am->getAsset (" ../../media/kernels/physical_flare_512 .exr" , lp);
193
+ auto kerImageBundle = am->getAsset (" ../../media/kernels/physical_flare_256 .exr" , lp);
194
194
195
195
// get GPU image views
196
196
smart_refctd_ptr<IGPUImageView> srcImageView;
@@ -234,8 +234,6 @@ int main()
234
234
srcNumChannels = channelCountOverride;
235
235
kerNumChannels = channelCountOverride;
236
236
assert (srcNumChannels == kerNumChannels); // Just to make sure, because the other case is not handled in this example
237
-
238
- const auto srcDim = srcImageView->getCreationParameters ().image ->getCreationParameters ().extent ;
239
237
240
238
// Create Out Image
241
239
smart_refctd_ptr<IGPUImage> outImg;
@@ -362,14 +360,21 @@ int main()
362
360
);
363
361
}();
364
362
365
- float bloomScale = 0 .125f ;
363
+ const float bloomRelativeScale = 0 .25f ;
366
364
const auto kerDim = kerImageView->getCreationParameters ().image ->getCreationParameters ().extent ;
365
+ const auto srcDim = srcImageView->getCreationParameters ().image ->getCreationParameters ().extent ;
366
+ const float bloomScale = core::min (float (srcDim.width )/float (kerDim.width ),float (srcDim.height )/float (kerDim.height ))*bloomRelativeScale;
367
+ if (bloomScale>1 .f )
368
+ std::cout << " WARNING: Bloom Kernel will Clip and loose sharpness, increase resolution of bloom kernel!" << std::endl;
367
369
const auto marginSrcDim = [srcDim,kerDim,bloomScale]() -> auto
368
370
{
369
371
auto tmp = srcDim;
370
- tmp.width += core::max (kerDim.width *bloomScale,1u )-1u ;
371
- tmp.height += core::max (kerDim.height *bloomScale,1u )-1u ;
372
- tmp.depth += core::max (kerDim.depth *bloomScale,1u )-1u ;
372
+ for (auto i=0u ; i<3u ; i++)
373
+ {
374
+ const auto coord = (&kerDim.width )[i];
375
+ if (coord>1u )
376
+ (&tmp.width )[i] += core::max (coord*bloomScale,1u )-1u ;
377
+ }
373
378
return tmp;
374
379
}();
375
380
constexpr bool useHalfFloats = true ;
0 commit comments