Texture quality of decal image is greatly reduced in production build. Is there any way to skip this texture compression?
by user 1141289362336784394
Texture quality of decal image is greatly reduced in production build. Is there any way to skip this texture compression?
by user 1141289362336784394
Hello there – we have an experimental AI bot that might be able to help you with your question. Would you like to try this out?
Yes – select the texture and in the inspector change the Needle Platform settings for it. There you can change compression options
It is 2K texture
by user 1141289362336784394
From your screenshot, are both inside the browser?
yes. Both are cloud deployed version in the browser
by user 1141289362336784394
Can you drop you GLB in https://gltf.report/ and check the format in the textures tab? I just tried here with setting a texture to none
What does this mean? which one is which?
sorry for the misinformation . First image is production build with ‘development build’ disabled (image quality is reduced). Second image is build with ‘development build’ enabled(image quality is perfect).
by user 1141289362336784394
by user 1141289362336784394
It shows png format
by user 1141289362336784394
so compression is disabled/working but some setting results in a texture resize. Do you have any of those in your scene?
No i don’t have any of those components in my scenes.
by user 1141289362336784394
*For additional information.
by user 1141289362336784394
Ah then you need to make sure to load the progressive textures perhaps yourself if you have custom rendering for decals. You can do that using NEEDLE_progressive.assignTextureLOD(this.context, this.sourceId, material);
in your decal renderer
import { Behaviour, GameObject, AssetReference, serializable } from “@needle-tools/engine”;
import * as THREE from “three”;
import { DecalGeometry } from “three/examples/jsm/geometries/DecalGeometry.js”;
import { Texture, Vector2, Vector3 } from “three”;
//@dont-generate-component
export class DecalProjector extends Behaviour {
@serializable(GameObject)
public parentObj!: GameObject;
start() {
const decalMaterial = new THREE.MeshStandardMaterial({
map: this.material.map,
normalScale: new THREE.Vector2(1, 1),
transparent: true,
depthTest: true,
depthWrite: false,
polygonOffset: true,
polygonOffsetFactor: -4,
wireframe: false,
side: THREE.FrontSide,
});
decalMaterial.map.repeat = new Vector2(-1, -1);
var meshComponent = null;
// Iterate through the children of the Object3D
const parentName = this.gameObject.parent?.name;
this.gameObject.parent.traverse(function (child) {
if (child instanceof THREE.Mesh) {
// Found a Mesh component
if (child.name == parentName) meshComponent = child;
}
});
if (this.gameObject.parent == null || !meshComponent) return;
var origin = new THREE.Vector3();
var orientation = new THREE.Euler();
var quaternion = new THREE.Quaternion();
this.gameObject.getWorldPosition(origin);
this.gameObject.getWorldQuaternion(quaternion);
orientation.setFromQuaternion(quaternion);
var decalSize = new THREE.Vector3(this.size.x, this.size.y, this.size.z);
var decalGeometry = new DecalGeometry(meshComponent, origin, orientation, decalSize);
var mesh = new THREE.Mesh(decalGeometry, decalMaterial);
this.scene.add(mesh);
this.gameObject.parent.attach(mesh);
}
}
This is the code which i used in Decal projector. as in this Discord.
by user 1141289362336784394
Thanks a lot for pointing out the issue. I have tried adding “NEEDLE_progressive.assignTextureLOD(this.context, this.sourceId, this.material);” in start of the above script. But still no luck. Am i missing something?
by user 1141289362336784394
You want to pass in your decalMaterial
Thank you my man it worked .
by user 1141289362336784394