Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Can I set texture filtering for uploaded texture?

The Challenge

The goal is to display the uploaded image pixelated, with NEAREST texture filtering.

What I tried so far

  1. Using CSS' image-rendering property.
  2. Setting the .glb model filters to NEAREST.

What I think the problem is

I think the issue is that the images that come with the model are properly filtered, but the new uploaded one isn't.

Interesting Links I've Found

Model Viewer Materials API

Example

document.getElementById("urlA").addEventListener("change", function() {
  const file = this.files[0];
  const viewer = document.getElementById("modelA");

  if (!file) return;

  const reader = new FileReader();
  reader.addEventListener('load', async function() {
    const texture = await viewer.createTexture(reader.result);
    viewer.model.materials[0].pbrMetallicRoughness.baseColorTexture.setTexture(texture);
  });
  reader.readAsDataURL(file);
})
body {
  background-color: rgba(255, 255, 255, 0.85)
}

h1 {
  margin: 0;
  font-size: 16pt;
  font-family: Arial, Helvetica, sans-serif;
  color: #4a5a8a
}

model-viewer {
  width: 256px;
  height: 256px;
  border: 2px solid black;
  background-color: #484E61
}

input[type="file"] {
  margin: 15px auto
}
<script src="https://unpkg.com/@google/model-viewer@1.12.0/dist/model-viewer-umd.js"></script>
<h1>Upload an image to preview it in the model</h1>
<input type="file" id="urlA">
<model-viewer id="modelA" camera-controls src="https://modelviewer.dev/shared-assets/models/Astronaut.glb" shadow-intensity="0" environment-image="neutral" exposure="0.5"></model-viewer>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!