Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8005349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:12:16+00:00 2026-06-04T17:12:16+00:00

I know how to create a mesh dynamically in three.js, but its not clear

  • 0

I know how to create a mesh dynamically in three.js, but its not clear how to add custom UV and normals in the mesh. here is how to create a custom mesh, how do we add UV and normals to this mesh programmatically?

thanks!

var imgTexture = THREE.ImageUtils.loadTexture(image);
var avatarGeom = new THREE.Geometry();

avatarGeom.vertices.push(new THREE.Vector3(0.895813,0.732893,0));
avatarGeom.vertices.push(new THREE.Vector3(-1.007173,0.732893,0));
avatarGeom.vertices.push(new THREE.Vector3(0.895813,-1.390674,0));
avatarGeom.vertices.push(new THREE.Vector3(-1.007173,-1.390674,0));

var face = new THREE.Face3(2,3,1);
avatarGeom.faces.push(face);

face = new THREE.Face3(0,2,1);
avatarGeom.faces.push(face);

var avatar = new THREE.Mesh(avatarGeom,new THREE.MeshLambertMaterial(imgTexture));
avatar.doubleSided = true;
scene.add(avatar);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:12:18+00:00Added an answer on June 4, 2026 at 5:12 pm

    The normal goes in the face. The UVs go in the geometry.

    var imgTexture = THREE.ImageUtils.loadTexture(image);
    var avatarGeom = new THREE.Geometry();
    
    avatarGeom.vertices.push(new THREE.Vector3(0.895813,0.732893,0));
    avatarGeom.vertices.push(new THREE.Vector3(-1.007173,0.732893,0));
    avatarGeom.vertices.push(new THREE.Vector3(0.895813,-1.390674,0));
    avatarGeom.vertices.push(new THREE.Vector3(-1.007173,-1.390674,0));
    
    var face = new THREE.Face3(2,3,1);
    face.normal.set(0,0,1); // normal
    avatarGeom.faces.push(face);
    avatarGeom.faceVertexUvs[0].push([new THREE.UV(1,1),new THREE.UV(0,1),new THREE.UV(1,0)]); // uvs
    
    face = new THREE.Face3(0,2,1);
    face.normal.set(0,0,1); // normal
    avatarGeom.faces.push(face);
    avatarGeom.faceVertexUvs[0].push([new THREE.UV(0,0),new THREE.UV(1,1),new THREE.UV(1,0)]); // uvs
    
    var avatar = new THREE.Mesh(avatarGeom,new THREE.MeshLambertMaterial(imgTexture));
    avatar.doubleSided = true;
    scene.add(avatar);
    

    The reason UVs go in the geometry is because this way we can have different channels (different sets of UVs for the same geometry).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know how to create simple object and add dynamically properties to it. object
I know how to create a job dynamically from this create-sql-server-job-automatically The issue I
I know I can create a List<T> from IEnumerable<T> by doing myEnumerableCollection.ToList() , but
Does anyone know to create custom feed (xml) for Web PI 3.0??
In my program I've create a mesh that look like this: http://en.wikibooks.org/wiki/File:Blender3DNoobToPro-Creating_The_Canvas.jpg And I
Would like to know create drop shadow for UINavigationbar. I tried to create custom
I know I can create a custom event and associate data with it and
I know how to create an histogram in Python, but I would like that
I know how to create a custom template for a specific page. However I
What kind of skills should a WPF developer know to create MVVM applications? Things

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.