Problem loading texture

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).

my code looks like so:

self.Avatar = render.attachNewNode(CardMaker('').generate())
        tex = loader.loadTexture("textures/hero/run01.png")
        self.Avatar.setTexture( tex,1 )
        self.Avatar.reparentTo( render )
        self.Avatar.setPos( 0,10,0 ) 
        self.Avatar.setLightOff() 
        self.Avatar.setTransparency(True) 
        self.Avatar.setBillboardPointEye() 

Are there any limitations regarding picture files for textures that I am unaware of?

Also: Once I straighten this out, how do I mark certain pixels as transparent? (Is there a fixed color value?)

Thanks in advance,
Ogga

Can you describe exactly the problem you are experiencing? Are you seeing an error message? If so, can you post it here?

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.

Here’s a better explanation:

: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?

David

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.”

Yup. Did the trick.
Not quite sure how I missed that.

Regarding my second question:

any thoughts?

Thanks for your help. Guess I should’ve looked into that one a bit more before posting. :blush:

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).

David

Why does it seem to work without that line?:

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.

I don’t understand your text

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.

David

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

panda3d.org/manual/index.php/T … d_Blending