Textures
See original GitHub issueHi,
After haveing done some research I cant seem to figure out how to assign a texture to a mesh. Taking a piece of code given here
using SharpGLTF.Scenes;
using SharpGLTF.Geometry;
using SharpGLTF.Geometry.VertexTypes;
using SharpGLTF.Materials;
// Create a mesh with a triangle.
var mesh = new MeshBuilder<VertexPosition>();
var prim = mesh.UsePrimitive(MaterialBuilder.CreateDefault());
prim.AddTriangle
(
new VertexPosition(0, -1, 0),
new VertexPosition(1, 0, 0),
new VertexPosition(0, 1, 0)
);
// Create a scene and add the mesh:
var scene = new SceneBuilder();
mesh.UsePrimitive(material);
scene.AddRigidMesh(mesh, Matrix4x4.Identity);
// save it to GLB:
scene.ToGltf2().Save(@"D:\\New folder\\File.gltf");
How can I add an image to this triangle?
I understand that I should use MeshBuilder<VertexPosition, VertexColor1Texture1>()
, but what should I modify to insert a texture? MeshBuilder, pimitive, or material?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Textures for 3D, graphic design and Photoshop!
Textures.com is a website that offers digital pictures of all sorts of materials. Sign up for free and download 15 free images every...
Read more >20000+ Best Free Textures · 100% Free Download
Download and use 20000+ Texture stock photos for free. ✓ Thousands of new images every day ✓ Completely Free to Use ✓ High-quality...
Read more >Free textures and tutorials for Photoshop and more!
Over 1000 high-resolution textures, Photoshop tutorials, and more. Free for commercial and personal use. Grunge, metal, lens effects, atmosphere, ink, ...
Read more >ambientCG - CC0 Textures, HDRIs and Models
All textures come with PBR maps and tile seamlessly. Explore All PBR Materials · Wood 041. Accurate Displacement. Photogrammetry is used for many...
Read more >750+ Best Texture Pictures [HD] | Download Free Images ...
Download the perfect texture pictures. Find over 100+ of the best free texture images. Free for commercial use ✓ No attribution required ✓...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you, I finnaly was able to assign a texture. I will leave the code here in case someone needs it
Thank you, I finally was able to assign texture