Validation report
Format: glTF 2.0
Generator: Khronos glTF Blender I/O v0.9.36
Stats:
119 draw calls
0 animations
0 materials
79736 vertices
70573 triangles
Extensions:
KHR_draco_mesh_compression
NOTE: Extensions above are present in the model, but may or may not be recognized by this viewer. Any "UNSUPPORTED_EXTENSION" warnings below refer only to extensions that could not be scanned by the validation suite, and may still have rendered correctly. See: three-gltf-viewer#122
UNSUPPORTED_EXTENSION Cannot validate an extension as it is not supported by the validator: 'KHR_draco_mesh_compression'. /extensionsUsed/0
I downloaded it from here, the biggest one is .glb, this person may have compressed it, it means that I donât understand very much, I just learned it,
By the way, itâs convenient for me to ask, how do I design the sky and its four corners are different in color! Its code is like this, I didnât find what to do in Playcanvas
Floor
The floor is composed of a simple plane always filling the screen. A simple 2x2 texture created directly in JS is sent and the shaders uses the UVs to color each corner. Those colors are then naturally interpolated for the whole surface.
I will study it again, his color can be changed manually,
like this, add debug
var Script = pc.createScript('script');
// initialize code called once per entity
Script.prototype.initialize = function() {
var plane = new pc.Entity();
plane.addComponent("model", {
type: "plane",
});
this.app.root.addChild(plane);
// Create a 8x8x24-bit texture
var device = this.app.graphicsDevice;
var texture = new pc.Texture(device, {
width: 8,
height: 8,
format: pc.PIXELFORMAT_R8_G8_B8,
addressU: pc.ADDRESS_CLAMP_TO_EDGE,
addressV: pc.ADDRESS_CLAMP_TO_EDGE
});
var topLeft = new pc.Color(1, 0, 0, 1); // red
var topRight = new pc.Color(1, 1, 1, 1); // white
var bottomRight = new pc.Color(1, 1, 0, 1); // yellow
var bottomLeft = new pc.Color(0, 0, 1, 1); // blue
// Fill the texture with a gradient
var pixels = texture.lock(); // Locks mip level (level of detail) of the texture
// and get an array with pixel data for us to fill.
// Array type in this case will be pc.PIXELFORMAT_R8_G8_B8,
// which has a size = width * height * depth * 3.
// - width and height are the texture sizes
// - depth will be 1 by default, unless you change it manually
// - 3 is amount of colors per pixel (red, green, blue)
var count = 0;
var top = new pc.Color();
var bottom = new pc.Color();
var result = new pc.Color();
for (var w=0; w<8; w++) { // pixel row
for (var h=0; h<8; h++) { // pixel column
// find a linearly interpolated color horizontally
top.lerp(topLeft, topRight, w/8); // between top left and right
bottom.lerp(bottomLeft, bottomRight, w/8); // between bottom left and right
// then find the final color by interpolating top and bottom vertically
result.lerp(top, bottom, h/8);
// assign the result color to each texture pixel:
pixels[count++] = result.r * 32; // red
pixels[count++] = result.g * 32; // green
pixels[count++] = result.b * 32; // blue
}
}
texture.unlock(); // unlock miplevel and send it to VRAM
var material = new pc.StandardMaterial();
material.diffuseMap = texture;
material.update();
plane.model.material = material;
};