For some reason I can’t understand I’m having trouble loading a certain texture.
I put the png file in a subfolder of the folder of the main py file.
A different jpg was loaded without an issue (I tried converting my png to jpg and bmp to no avail).
the specific error is:
exceptions.IOError: Could not load texture: textures/hero/run01.png
At first I suspected that I’m not writing the path correctly (or something of this type), but I was successful in loading a different jpg from the same folder.
:express(warning): Filename is incorrect case: /c/stuff/Projects/OOSIOS/textures
/hero/run01.png instead of /c/stuff/Projects/OOSIOS/textures/Hero/Run01.png
:express(warning): Filename is incorrect case: /c/stuff/Projects/OOSIOS/textures
/hero/run01.png instead of /c/stuff/Projects/OOSIOS/textures/Hero/Run01.png
:gobj(error): Texture::read() - couldn't read: textures/hero/run01.png
:express(warning): Filename is incorrect case: /c/stuff/Projects/OOSIOS/textures
/hero/run01.png instead of /c/stuff/Projects/OOSIOS/textures/Hero/Run01.png
:gobj(error): Unable to find texture "textures/hero/run01.png" on model-path /c/
stuff/Projects/OOSIOS;/c/Panda3D-1.7.0/etc/..;/c/Panda3D-1.7.0/etc/../models
Traceback (most recent call last):
File "oosios.py", line 23, in <module>
w = World()
File "oosios.py", line 14, in __init__
self.mHero = CHero()
File "c:\stuff\Projects\OOSIOS\Hero.py", line 23, in __init__
tex = loader.loadTexture("textures/hero/run01.png")
File "C:\Panda3D-1.7.0\direct\showbase\Loader.py", line 533, in loadTexture
raise IOError, message
IOError: Could not load texture: textures/hero/run01.png
Are you sure you have specified the case correctly? Note that textures/hero/run01.png is a different filename than Textures/Herc/Run01.png.
There are often other error messages in the log that provide more insight. For instance, it usually tells you whether it is unable to find the file, or unable to read it. If you don’t see error messages like this, try adding the line:
notify-level-gobj info
to your Config.prc file (replacing any other notify-level-gobj lines there). What is the complete output from your session?
Ah, your newly updated post shows exactly the error messages I was referring to, and also tells you how to fix it. Note the error messages about how the “filename is incorrect case.”
Transparency in Panda (as with any 3-D engine) is handled with the alpha channel, a fourth color channel. Certain file formats, like jpeg, don’t support the alpha channel, but png does. You have to paint the alpha channel in with your image painting tool. It is also possible to load the alpha channel from a separate image and combine it at runtime, but this is more complicated.
Once you have an alpha channel, you have to enable transparency with model.setTransparency(TransparencyAttrib.MAlpha).
Cus there are two types of transparency. One is full transparency and the other is opacity transparency. Full transparency requires that you use .setTransparency(TransparencyAttrib.MAlpha) while the other one doesn’t. The differents is if you deleted the pixs or not or just changed their opacity level.
“Window textures”, for example, will use a opacity transparency, so you get both a semi there something there but it’s clear; while invs collision walls will use full transparency cause the user does not need to see the wall texture.
A simpler (and better) answer is that transparency works automatically without that line when you load in a texture already applied in an egg file, as you are doing here. The setTransparency() call is needed only when you load a texture directly via loader.loadTexture() and apply it to a model by hand at runtime.
So there isn’t another type of transparency? Some of my model’s textures weren’t blending so smooth with the background, guess I should fix the texture instead