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 8837659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:47:02+00:00 2026-06-14T09:47:02+00:00

I tried to load a collada file (exported from Blender) into a three.js scene

  • 0

I tried to load a collada file (exported from Blender) into a three.js scene and then replace the material with a ShaderMaterial.

Since there is only one object in this collada file it is located at collada.scene.children[0] so I tried to change the material property to a newly created one. I can easily replace the material with a wireframe or even a textured StandardPhongMaterial, but as soon as I add a ShaderMaterial the model only shows up in black without any lighting or texturing.

The material setup is as follows:

materials[0] = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );

var shader = THREE.ShaderUtils.lib[ "normal" ];
var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
uniforms[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( "color.png" );
uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( "normal.png" );
uniforms[ "tSpecular" ].texture = THREE.ImageUtils.loadTexture( "spec.png" );
uniforms[ "enableDiffuse" ].value = true;
uniforms[ "enableSpecular" ].value = true;

materials[1] = new THREE.ShaderMaterial( {
  uniforms: uniforms,
  vertexShader: shader.vertexShader,
  fragmentShader: shader.fragmentShader,
  lights: true
});

var basicTexture = THREE.ImageUtils.loadTexture( "color.png ")
materials[2] = new THREE.MeshPhongMaterial( { map: basicTexture });

On Model load I add the ShaderMaterial to the model before adding it to the scene so that all necessary attributes are available:

loader.load('model.dae', function(collada) {
  model = collada.scene;
  model.scale.x = model.scale.y = model.scale.z = 50;
  model.rotation.y = 180;
  model.updateMatrix();
  model.children[0].material = materials[1];
  model.children[0].geometry.computeTangents();
  scene.add(model);
});

The full source code is available here: http://rainbowrangers.de/normalmap/

How do I fix this?

  • 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-14T09:47:04+00:00Added an answer on June 14, 2026 at 9:47 am

    You are using an old format. It should be

    uniforms[ “tDiffuse” ].value = THREE.ImageUtils.loadTexture( “color.png” );

    See the Migration post at the three.js Wiki: https://github.com/mrdoob/three.js/wiki/Migration

    texture uniform changes: texture units are now assigned automatically, texture object goes to value property instead of texture one { type: “t”, value: 0, texture: map } => { type: “t”, value: map }

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

Sidebar

Related Questions

I'm attempting to load a scene from a file into Three.js (custom format, not
I tried to load huge data file eg 10 mb files into the db
I downloaded a KML file and tried to load it into my project, which
I tried to load top3 record of table into DataGrid it shows error Cannot
i tried to find how i could load kml file and I found that
how can i load a default value from my json store (remote) into a
I am facing a big issue with PDFBOX: I tried to load a file
I'm trying to load a depthbuffer from a file and copy it to the
I'm trying to load a very large image (about 16000x7000 pixel) into a Material,
I'm trying to load a custom cursor from a resource file (.rc) in Visual

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.