[SOLVED] HDR to Cubemap using code

Hello, I am engine user

and now I just try to make cubemap using playcanvas resource(Download from editor)

so I have .dds file and px.png, nx.png, py.png, ny.png, pz.png, nz.png files…

and also px.hdr, nx.hdr, py.hdr, ny.hdr, pz.hdr, nz.hdr files

and here is code

var data = {
    name: 'bridge',
    cubemap: 'Bridge.dds',
    textures: [

var textures = data.textures.map(function(v, i) {
    var asset = new pc.Asset(data.name + '-' + i, 'texture', { url: v }); 
    return asset.id;

var cubemap = new pc.Asset(
    { url: data.cubemap },
        anisotropy: 1,
        magFilter: 1,
        minFilter: 1,
        rgbm: true,
        textures: textures

app.scene.Exposure = 1;
app.scene._skyboxIntensity = 3;

It’s really darker than editor project.
Is this already hdr applied??

The darkness could be because of the tonemapping mode you have set. Or maybe the skybox intensity setting on the scene.

Thank you for your answer

The problem was GammaCorrection

I added this code

app.scene.gammaCorrection = pc.GAMMA_SRGB

So… what is pc.GAMMA_SRGB??

Thank you for giving me a clue. :slight_smile:


1 Like