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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:32:37+00:00 2026-06-04T23:32:37+00:00

Is there a way to replace all textures in a simple 3D model imported

  • 0

Is there a way to replace all textures in a simple 3D model imported via Collada loader in the Three.js library?

What I’d like to accomplish is to apply colour, specular and normal maps to the model via ShaderMaterial by pointing to new files with the model’s material names but added “-color”, “-normal” and “-spec” wording:

“brochureFrontCover” -> “brochureFrontCover-color.jpg”, “brochureFrontCover-normal.jpg”, “brochureFrontCover-spec.jpg”

If any good soul could show me how such function should look, I’d be very grateful.

The script:
http://dev.printhouse.co.uk/uv-simulator/j/Brochure.js

Collada model:
http://dev.printhouse.co.uk/uv-simulator/m/Brochure.dae

  • 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-04T23:32:39+00:00Added an answer on June 4, 2026 at 11:32 pm

    I think it should be something like this:

    THREE.SceneUtils.traverseHierarchy( dae, function ( child ) {
    
        if ( child.material ) {
    
            var shader = THREE.ShaderUtils.lib[ "normal" ];
            var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
    
            uniforms[ "tDiffuse" ].texture = THREE.ImageUtils.loadTexture( child.material.name + "-color.jpg" );
            uniforms[ "tNormal" ].texture = THREE.ImageUtils.loadTexture( child.material.name + "-normal.jpg" );
            uniforms[ "tSpecular" ].texture = THREE.ImageUtils.loadTexture( child.material.name + "-spec.jpg" );
    
            uniforms[ "enableDiffuse" ].value = true;
            uniforms[ "enableSpecular" ].value = true;
    
            child.geometry.computeTangents();
    
            child.material = new THREE.ShaderMaterial( {
                uniforms: uniforms,
                vertexShader: shader.vertexShader,
                fragmentShader: shader.fragmentShader,
                lights: true
            } );
    
        }
    
    } );
    

    This example should be a good reference if you need to tweak uniforms.

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

Sidebar

Related Questions

Is there a lazy way I can quickly replace all instances of a word
Hi is there any way to 'replace' all occurences of 10 or more occurances
Is there a way to replace all the brush definitions for a WPF application
I was wondering if there is a way to replace all instances of CRLF
There's a way to replace all occurencies of a string in files in Vim
I'm looking for a way to replace all instances of a form: model->variable with
Is there any way to replace titles faster then str_replace function? I've got a
Is there any way to replace a value in an ArrayAdapter mPairedDevicesArrayAdapter = new
Is there a way to dynamically replace the field being written to and read
Is there any easy way to replace standard 2 radio buttons on License Wizard

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.