question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Javascript API to create textures

See original GitHub issue

Description I load a gltf model into the viewer with a material that has only a baseColorFactor defined inside its pbrMetallicRoughness properties

Problem I want to change material properties in order to load a baseColorTexture. According with the examples there is an API to handle this:

material.pbrMetallicRoughness.baseColorTexture.texture.source.setURI

However, In my scenario, baseColorTexture is null so I’ll get an error if I try to manipulate its source. Is it possibile to create textures with javascript code? Is there some API that I’m missing?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
elalishcommented, Nov 17, 2020

My apologies; after looking through this part of the code in more detail we are in fact missing the ability to create a texture from scratch; we can only setURI() on existing textures. I’m working on adding this functionality.

2reactions
elalishcommented, Aug 10, 2021

out now in v1.8

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using textures in WebGL - Web APIs | MDN
The first thing to do is add code to load the textures. In our case, we'll be using a single texture, mapped onto...
Read more >
Texture – three.js docs
An image object, typically created using the TextureLoader.load method. This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4,...
Read more >
MeshTexture | API Reference | ArcGIS API for JavaScript 4.25
MeshTexture represents image data to be used for MeshMaterial or MeshMaterialMetallicRoughness. It is mapped to the mesh by its uv vertex attributes.
Read more >
Texture | Wonderland Engine
Texture JavaScript API reference ... HTMLVideoElement | HTMLCanvasElement | number, HTML media element to create texture from or texture id to wrap.
Read more >
Creating Procedural Textures - Babylon.js Documentation
To use this custom texture, you need to make your folder available to your babylon.js html/javascript files and use a CustomProceduralTexture class instead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found