but i don’t know how exactly Textures and Materials interact, i don’t really see a way to actually set the “TextureMagnification” for Materials.
I tried to define my own fabric and see if i could set the sampler there somehow but o don’t find much information
on what is all possible with the fabric approach.
var fabric = {
type : 'customMaterial',
uniforms : {
image : 'someimage.png
},
components : {
diffuse : 'texture2D(image, materialInput.st).rgb'
},
sampler: Cesium.TextureMinificationFilter.NEAREST
};
var newmat = new Cesium.Material({
fabric : fabric
});
**3. Context. Why do you need to do this? We might know a better way to accomplish your goal.**
I have relatively low resolved textures that look horrible (not usable) when stretched over a larger rectangle
and i would like to use nearest neighbor to solve that. I also tried deactivating antialiasing completely with the fxaa parameter of the viewer, this does also not solve the issue.
**4. The Cesium version you're using, your operating system and browser.**
Does not really apply
Thanks for any help!
Kind regards,
Daniel
If you can invest some time into adding this feature and contributing a pull request that’d definitely be appreciated! Since Texture and Sampler are both private classes, I think you’d need to do something similar to how ImageryLayer does it, which takes in a min/mag filter here:
It then internally creates the sampler here and passes it to the Texture constructor below:
You would do this in the Material class, take in a min/mag filter, create a sampler, pass it when the Texture is created here:
This would make it work at the Primitive level, when creating a material directly, like in this Sandcastle example:
It would be a separate feature to link it up with the Entity API. Hope this helps, let me know if you run into any other issues! You can always open a draft PR if you have an implementation that works but are unsure if it’s the best approach.