Hello, I am attempting to create an animated texture by cycling through texture stages. However, when I use setTexture on my model, no texture is applied. This is how I have it set up:
Yes, I am using simplepbr. I added a material and set priority to one using your code, and it still appears black. It even appears black when I do not use simplePBr. Do you have any idea what the issue might be?
Hmm… I’m guessing that the material for the model exists on a child-node of “self.trail” (due to the way that models are generally loaded in Panda, I believe). I wonder then whether the call to “setTexture” isn’t resulting in a new material being made on the parent-node that’s overriding what’s present on the child-node…
You may have to do some investigation to determine the proper name to give to “findTexture”.
By the by:
The “ls()” method does indeed return “None”, and thus isn’t useful in a “print”-statement–however, the call should itself print output to the terminal.
i.e.:
print( myNodePath.ls() ) # Prints "None"
myNodePath.ls() # Prints the NodePath-hierarchy for "myNodePath"
So when I use self.trail.findAllTextures(), I see two textures, one called pbr-fallback and transgradiet (my desired texture).
I replaced pbr-fallback with transgradiet as per your suggestion, and the model still appears black, however the only texture in self.trail.findAllTextures() is transgradiet.
I have thought about using VideoTexture, however, animating the texture by cycling through texture stages better suits my purposes.
Ah, I was thinking that you would replace your own texture, not “pbr-fallback”. Still, the fact that even then you’re only seeing black is odd.
Could you perhaps put together a simple model and texture that demonstrates the problem, so that we can examine it ourselves and try to investigate what’s going on? Ideally something very simple–just a cube and a single-colour texture, for example.
here is a plain cube and 2 textures, when I attempt to set the texture to “papertex”, the model appears white, and when I attempt to set it to “transgradiet”, it appears black.
Ah, I think that I might have an idea: Does your model have UV-coordinates?
My guess is that it doesn’t, and that what’s happening is that you’re seeing just one (sub-)pixel from each texture. In the case of the paper texture, that happens to be a white pixel; in the case of the transparent texture, that happens to be a black pixel.
I just had one more question about setting UV coordinates. I was able to get the texture to appear when I used setTexGen, however, I want to use the uv coordinates defined in my model. is there a way to do this? when I apply the texture in my exported model, it appears the way I want it to.
Generally speaking, I believe that it’s something that’s applied in the 3D modelling program.
If by this you mean within your 3D modelling program, then it may be that said package is using automatically-generated coordinates to do so–but these presumably are either not available to or not observed by the exporter.
So, it may be that more-explicitly-defined UV-mapping is called for. If you search online you should, I daresay, find tutorials regarding this for your modelling program!