I’m trying to use cubemap as a background and I can load it successfully on playcanvas engine.
However, I can’t get rid of the blurred effect and also not possible to load textures for the cubemap.
var hdr = {
name: 'hdr',
ddsPath: `../assets/cubemaps/GIPS_TEST_2.dds`,
textures: [
`../assets/cubemaps/px.PNG`,
`../assets/cubemaps/nx.PNG`,
`../assets/cubemaps/py.PNG`,
`../assets/cubemaps/ny.PNG`,
`../assets/cubemaps/pz.PNG`,
`../assets/cubemaps/nz.PNG`
]
};
var textures = hdr.textures.map(function(v, i) {
var asset = new pc.Asset(hdr.name+ '-' + i, 'texture', { url: v });
app.assets.add(asset);
app.assets.load(asset);
return asset.id;
});
app.scene.ambientLight = new pc.Color(0.2, 0.2, 0.2);
// set up some general scene rendering properties
app.scene.gammaCorrection = pc.GAMMA_SRGB;
app.scene.toneMapping = pc.TONEMAP_ACES;
// setup skydome
// app.scene.skyboxMip = 0; // use top mipmap level of cubemap (full resolution)
app.scene.skyboxIntensity = 2; // make it brighter
// Load a cubemap asset. This DDS file was 'prefiltered' in the PlayCanvas Editor and then downloaded.
var cubemapAsset = new pc.Asset('GIPS_TEST_2.dds', 'cubemap', {
url: "../assets/cubemaps/GIPS_TEST_2.dds"
}, {
anisotropy: 1,
magFilter:1,
minFilter: 5,
type: pc.TEXTURETYPE_RGBM,
textures: textures
});
app.assets.add(cubemapAsset);
app.assets.load(cubemapAsset);
cubemapAsset.ready(function () {
app.scene.setSkybox(cubemapAsset.resources);
});
Is there anything I missed?
This code used to work on an old 1.2.x version… but not working anymore with 1.4.x version.
Thanks.