Change FBX texture or texture path

loaders

#1

Hello,

is there a way to change a single texture of a FBX with Threejs?

Example:
Change ‘texture1.png’ to ‘texture2.png’
or
Change texture1 path from ‘textures1/’ to ‘texture2/’

Greetings
mALLe


#2

You can use LoadingManager.setURLModifier() for this.


#3

Hi,
sorry iam not realy good at coding :frowning_face:

I dont get it how does it work.

Greetings


#4

Something like this:

const loadingManager = new THREE.LoadingManager();
loadingManager.setURLModifier( function( url ) {

    // this function is called for each asset request

    if ( url === './texture1.png' ) {

        url = './texture2.png'

    }

    return url;

} );

const loader = new THREE.FBXLoader( loadingManager );

#6

Hi,

now I have loaded a FBX with Texture and Animation. All fine.
But my next question is, can I attach a second FBX to the first one?
Like a Weapon or something?


#7

See Linking two objects in Three.js

Please invest a little bit more effort in research before posting a new question. Attaching objects to another is a very basic operation in 3D.


#8

Sorry,
iam very bad at this ;/

With help I figured out to add a object with object.children[0].add(object2).
Now I want to add the object2 at a bone like this:

object.skeleton.bones[1].add(object2);

But object2 is not shown :frowning:


#9

Hello,

now I have to Objects. FBX2 is added to FBX1 like “FBX1.add(FBX2)”.
Is there a way that the child follow the FBX1 animation?

I invested days to search the Internet but dont solved it :frowning:


#10

This one might help:


#11

Hello again,

after adding my FBX to AnimationObjectGroup its kind of “transparent”.
I can look into some parts. Is there a way to fix this?