My goal is to generate all the required images on the go (512x512, plain color from code) and i have this part working already, can either store it as a png/jpeg both blob and base64 if needed
or perhaps there’s a smarter solution to have all the goodies that skybox brings including reflections and etc by color code?
I have a gradient sky shader that is applied to huge box, and these colors change quite often, I know that it would not look as good as with normal detailed skybox, but I’ll be able to use metalicness and reflectivitness on materials, which will bring somewhat better looking results that it is now, completely matte.
app.scene.envAtlas = textureAtlas;
app.scene.skyboxMip = 0; // use top mipmap level of cubemap (full resolution)
app.scene.skyboxIntensity = 2; // make it brighter
var Skybox = pc.createScript('skybox');
// initialize code called once per entity
Skybox.prototype.initialize = function() {
var textureCube = new pc.Texture(this.app.graphicsDevice, {
cubemap: true,
width: 1024,
height: 1024
});
var textureAtlas = new pc.Texture(this.app.graphicsDevice, {
width: 1024,
height: 1024
});
console.log(this.app.assets.find("skybox.jpg", "texture").id);
pc.reprojectTexture(this.app.assets.find("skybox.jpg", "texture").resource, textureCube, {
numSamples: 1,
});
pc.EnvLighting.generateAtlas(textureCube, {
target: textureAtlas,
});
this.app.scene.envAtlas = textureAtlas;
this.app.scene.skyboxMip = 0;
};
except that texture is very low quality, but I guess that won’t matther since I will be using simple gradient texture, now just uploaded test equir 1500x500 from internet.
with the code i’ve been using earlier, once you set the EQUIRECT texture to be completely white, ambient also turns to be completely white, which makes shadows not to appear.
in the editor version capture: skybox is transparent image (white) and the shadows still reflecs by ambient color, which is my goal.
I have another example in the works, might get both working soon
var Skybox = pc.createScript('skybox');
// initialize code called once per entity
Skybox.prototype.initialize = function() {
var textureCube = new pc.Texture(this.app.graphicsDevice, {
cubemap: true,
width: 512,
height: 512
});
var textureAtlas = new pc.Texture(this.app.graphicsDevice, {
width: 512,
height: 512
});
pc.reprojectTexture(this.app.assets.find("skybox2", "texture").resource, textureCube, {
});
pc.EnvLighting.generateAtlas(textureCube, {
target: textureAtlas,
});
this.app.scene.envAtlas = textureAtlas;
this.app.scene.skyboxMip = 0;
};
How would I get the equivalent lighting on materials compared to cubemap?
I’ve tried to apply the same identical texture as a cubemap, while the visual sky is identical, reflection is different, less visible with envAtlas
Hey guys I got all of this working and I’m setting skybox using envAtlas - all over engine-only
But I still need to be able to set custom ambient color, any ideas?