Hi, could You make some example of dynamic cubemap that can be used as a skybox?
Im trying to do with Your hints but I still get an errors like: “Can’t use prefiltered cubemap: undefined, false, …” It seams like var allMips is not defined couse of the condition:
var allMips = prefilteredCubeMap128 && prefilteredCubeMap64 && prefilteredCubeMap32 && prefilteredCubeMap16 && prefilteredCubeMap8 && prefilteredCubeMap4;
var angles = [
[ 0, 90, 180 ],
[ 0, -90, 180 ],
[ 90, 0, 0 ],
[ -90, 0, 0 ],
[ 0, 180, 180 ],
[ 0, 0, 180 ]
];
this.colorBuffer = new pc.Texture(this.app.graphicsDevice, {
cubemap: true,
rgbm: true,
fixCubemapSeams: true,
format: pc.PIXELFORMAT_R8_G8_B8_A8,
width: 128,
height: 128
});
this.colorBuffer.minFilter = pc.FILTER_LINEAR_MIPMAP_LINEAR;
this.colorBuffer.magFilter = pc.FILTER_LINEAR;
for (var i = 0; i < 6; i++) {
var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, this.colorBuffer, {
depth: true,
face: i
});
var e = new pc.Entity();
e.addComponent('camera', {
clearColor: new pc.Color(1, 1, 1),
aspectRatio: 1,
fov: 90
});
e.camera.renderTarget = renderTarget;
this.entity.addChild(e);
e.setLocalEulerAngles(angles[i][0], angles[i][1], angles[i][2]);
}
var options = {
device: this.app.graphicsDevice,
sourceCubemap: this.colorBuffer,
method: 1,
samples: 4096,
cpuSync: true,
filteredFixed: [],
singleFilteredFixed: true,
};
pc.prefilterCubemap(options);
this.app.scene.setSkybox(options.filteredFixed);
I really need this working for my project. Please help.