supertuxkart / stk-blender

Blender 2.80 exporter
MIT License
23 stars 19 forks source link

Materials are not exported if the texture path is relative to the blend file #27

Open AmyLillya opened 4 months ago

AmyLillya commented 4 months ago

When exporting the .spm model from blender, the model has no materials in game, it defaults to a white shader. The kart folder has all the textures there.

blender_MQWLkpA88U supertuxkart_Exr5sa1ZhP

The materials.xml file is exported with no parameters. I tried to manually set them in the same way as other custom karts but that didn't work.

AmyLillya commented 4 months ago

After bashing my head trying to figure out what was breaking exporting the materials I finally found what the issue is!

I noticed that if I create a brand new .blend file, append all the objects for the kart, and export without saving the .blend file, then all the materials get exported correctly. However if I save the .blend file before exporting then the materials break in-game.

That gave me the clue that what breaks the exporter is when the texture used by the material have a relative path, that is, they are located somewhere inside the folder where the .blend file is. For example:

This texture is inside the folder where the .blend file is located, receiving a relative path. This breaks the exporter: stk exporter problem 1

This texture is located in a separate folder in the system, receiving an absolute path. This exports correctly: blender_zuWDMo6kQg

I don't know how the .spm exporter works and if it could be changed to work with relative paths. At least a note in the kart creation manual warning to not use relative path would be much appreciated and could save a lot of frustration for someone who's a beginner like me.

AmyLillya commented 4 months ago

Forgot to mention, the addon does work on the latest Blender version, the issue was not related to that.

awab1433 commented 2 weeks ago

I think thats my problem?! Im also dead in my tracks with the kart wheels not exporting properly Please guide.

awab1433 commented 2 weeks ago

Also, how do you generate a texture file like u did above?

RQWorldblender commented 2 weeks ago

Reading about what happened, there is a way to make paths used for Blender files absolute or relative. In File -> External Data -> Make Paths Absolute or Make Paths Relative, these options can be used as a temporary workaround. However, the issue here seems to be elsewhere, either a change made since Blender 4.0 or the bundled Python version. I haven't been making any add-ons recently since the Blender 2.93 LTS version, I'm going to need to catch up with the latest changes. Although I did make a commit this week, the changes are for the SPM importer, so I have to do more investigation unless someone else steps up.

@AmyLillya @awab1433 Perhaps it may help if you can send me some relevant files I can look through that can help in my investigation?

awab1433 commented 2 weeks ago

only 1 wheel is exported, and in the xml file, the same wheel (rear right) is used for all 4 wheels. only happens when i get models on sketchfab.

On Tue, Sep 3, 2024 at 12:09 PM Richard Qian @.***> wrote:

Reading about what happened, there is a way to make paths used for Blender files absolute or relative. In File -> External Data -> Make Paths Absolute or Make Paths Relative, these options can be used as a temporary workaround. However, the issue here seems to be elsewhere, either a change made since Blender 4.0 or the bundled Python version. I haven't been making any add-ons recently since the Blender 2.93 LTS version, I'm going to need to catch up with the latest changes. Although I did make a commit this week, the changes are for the SPM importer, so I have to do more investigation unless someone else steps up.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2327231720, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBAH6LCW54NXTBUMZQU3ZUYCPXAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGIZTCNZSGA . You are receiving this because you commented.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

RQWorldblender commented 2 weeks ago

only 1 wheel is exported, and in the xml file, the same wheel (rear right) is used for all 4 wheels. only happens when i get models on sketchfab.

Is it okay if I can see your .blend file that you're working on, to see if I can reproduce the issue you're having? I'm using Blender 4.2.1 LTS, so I may not always be on the latest version. Have you also set up your model centered at the origin? The wheel positions are based on the 4 quads, and a kart should be facing north when you view it from the top. The wheels determined are based on which quad they are in during export time.

awab1433 commented 2 weeks ago

this issue is with every model i make im using blender 2.83, so it might not be compatible with yours. I can send you the textures if you want!

On Tue, Sep 3, 2024 at 1:55 PM Richard Qian @.***> wrote:

only 1 wheel is exported, and in the xml file, the same wheel (rear right) is used for all 4 wheels. only happens when i get models on sketchfab.

Is it okay if I can see your .blend file that you're working on, to see if I can reproduce the issue you're having? I'm using Blender 4.2.1 LTS, so I may not always be on the latest version. Have you also set up your model centered at the origin? The wheel positions are based on the 4 quads, and a kart should be facing north when you view it from the top. The wheels determined are based on which quad they are in during export time.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2327421621, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBAB5QVBN4DRNBLBKDH3ZUYO5PAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGQZDCNRSGE . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

RQWorldblender commented 2 weeks ago

this issue is with every model i make im using blender 2.83, so it might not be compatible with yours. I can send you the textures if you want!

I suggest that you upgrade to a more recent Blender version, unless something is holding you back from doing so. They have LTS versions especially for those who can't upgrade as fast for whatever reason. I made the initial port of these scripts using 2.83 LTS, but other people have been working on them for long enough that more recent Blender versions are the target (the 3.x and 4.x series). Blender is apparently of one many faster-moving free/open-source projects, so I fell behind on some of the changes until this month. If that still doesn't work out, you can attach your files here.

awab1433 commented 2 weeks ago

Perfect! I'll upgrade and check if it works, although I was advised to stay on 2.8 due to issues with the exporter? Thank ypu for reaching out and helping the community!

On Tue, Sep 3, 2024 at 2:15 PM Richard Qian @.***> wrote:

this issue is with every model i make im using blender 2.83, so it might not be compatible with yours. I can send you the textures if you want!

I suggest that you upgrade to a more recent Blender version, unless something is holding you back from doing so. They have LTS versions especially for those who can't upgrade as fast for whatever reason. I made the initial port of these scripts using 2.83 LTS, but other people have been working on them for long enough that more recent Blender versions are the target (the 3.x and 4.x series). Blender is apparently of one many faster-moving free/open-source projects, so I fell behind on some of the changes until this month. If that still doesn't work out, you can attach your files here.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2327450347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBAGFKA2STJJPMJO2INTZUYRINAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGQ2TAMZUG4 . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

RQWorldblender commented 2 weeks ago

Perfect! I'll upgrade and check if it works, although I was advised to stay on 2.8 due to issues with the exporter? Thank ypu for reaching out and helping the community!

You're welcome! The readme has actually been changed so that the minimum Blender version is now >= 3.0. My intuition was right that you should upgrade your Blender version to something more recent.

awab1433 commented 2 weeks ago

4.2 is ok?

On Tue, Sep 3, 2024 at 2:25 PM Richard Qian @.***> wrote:

Perfect! I'll upgrade and check if it works, although I was advised to stay on 2.8 due to issues with the exporter? Thank ypu for reaching out and helping the community!

You're welcome! The readme has actually been changed so that the minimum Blender version is now >= 3.0. My intuition was right that you should upgrade your Blender version to something more recent.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2327464568, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBADTYEEMJ7UAB3PHM5LZUYSLVAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGQ3DINJWHA . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

awab1433 commented 2 weeks ago

or should i stick to 3.xx

On Wed, Sep 4, 2024 at 10:15 AM Awab @.***> wrote:

4.2 is ok?

On Tue, Sep 3, 2024 at 2:25 PM Richard Qian @.***> wrote:

Perfect! I'll upgrade and check if it works, although I was advised to stay on 2.8 due to issues with the exporter? Thank ypu for reaching out and helping the community!

You're welcome! The readme has actually been changed so that the minimum Blender version is now >= 3.0. My intuition was right that you should upgrade your Blender version to something more recent.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2327464568, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBADTYEEMJ7UAB3PHM5LZUYSLVAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGQ3DINJWHA . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

awab1433 commented 2 weeks ago

Made things worse.. issue not resolved[image: image.png]now i have a white car!!

On Wed, Sep 4, 2024 at 10:16 AM Awab @.***> wrote:

or should i stick to 3.xx

On Wed, Sep 4, 2024 at 10:15 AM Awab @.***> wrote:

4.2 is ok?

On Tue, Sep 3, 2024 at 2:25 PM Richard Qian @.***> wrote:

Perfect! I'll upgrade and check if it works, although I was advised to stay on 2.8 due to issues with the exporter? Thank ypu for reaching out and helping the community!

You're welcome! The readme has actually been changed so that the minimum Blender version is now >= 3.0. My intuition was right that you should upgrade your Blender version to something more recent.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2327464568, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBADTYEEMJ7UAB3PHM5LZUYSLVAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGQ3DINJWHA . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

awab1433 commented 2 weeks ago

[image: image.png]

On Wed, Sep 4, 2024 at 11:04 AM Awab @.***> wrote:

Made things worse.. issue not resolved[image: image.png]now i have a white car!!

On Wed, Sep 4, 2024 at 10:16 AM Awab @.***> wrote:

or should i stick to 3.xx

On Wed, Sep 4, 2024 at 10:15 AM Awab @.***> wrote:

4.2 is ok?

On Tue, Sep 3, 2024 at 2:25 PM Richard Qian @.***> wrote:

Perfect! I'll upgrade and check if it works, although I was advised to stay on 2.8 due to issues with the exporter? Thank ypu for reaching out and helping the community!

You're welcome! The readme has actually been changed so that the minimum Blender version is now >= 3.0. My intuition was right that you should upgrade your Blender version to something more recent.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2327464568, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBADTYEEMJ7UAB3PHM5LZUYSLVAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGQ3DINJWHA . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

RQWorldblender commented 1 week ago

@awab1433 Maybe it would help if you sent your files over. It's okay to be on Blender 4.2.x actually. I'm also not able to see any images you send since you respond via email.

awab1433 commented 1 week ago

https://drive.google.com/drive/folders/1S7QNdQRX3PsKgZJDBJi9eNmci9-QZxMq?usp=sharing

the folder nitro blade is what is exported, while the bled file is the blender file

RQWorldblender commented 1 week ago

@awab1433 I downloaded the Blender file you sent me, and there is something peculiar I noticed: your whole vehicle has almost everything set up to be parented to an empty object. I think this empty object may be causing issues - I'm gong to try exporting without using this empty object, and I will also center your vehicle more closely to the origin. You could also consider putting several objects into collections to make them easier to manage.

Upon looking at your vehicle more, I noticed some more errors that can be fixed:

awab1433 commented 1 week ago

Honestly, im the noob of the noob, and i dont understand wat you are saying. Feel free to do whatever you want. Thanks again!

On Thu, Sep 5, 2024 at 12:54 PM Richard Qian @.***> wrote:

@awab1433 https://github.com/awab1433 I downloaded the Blender file you sent me, and there is something peculiar I noticed: your whole vehicle has almost everything set up to be parented to an empty object. I think this empty object may be causing issues - I'm gong to try exporting without using this empty object, and I will also center your vehicle more closely to the origin.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2332521341, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBAFDN6OVXBDXNV23S6LZVCZGLAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZSGUZDCMZUGE . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

awab1433 commented 1 week ago

The way I texture the car is set an image texture and make an image for each color. Very inefficient way. Is there an easier way of doing it? If so, please tell me how. Thanks again for your dedication!

awab1433 commented 1 week ago

@AmyLillya I think i found the issue! If you use 3.x, you will have the relative file path error. However, using 2.8 solved the issue for me. Lmk if that works.

RQWorldblender commented 1 week ago

@awab1433 I mentioned that you can use vertex painting to use vertex colors. I think the STK website mentions about this; this is the only other way that you can 'texture' objects besides using image files. You should also know that if you don't set any properties for your materials, then nothing will be set and everything you use will use 'PBR Solid' by default. I can send my modified version so you have a better idea of how to do your kart better.

awab1433 commented 1 week ago

Yes please! Thanks a bunch!

On Thu, Sep 5, 2024 at 5:33 PM Richard Qian @.***> wrote:

@awab1433 https://github.com/awab1433 I mentioned that you can use vertex painting to use vertex colors. I think the STK website mentions about this; this is the only other way that you can 'texture' objects besides using image files. You should also know that if you don't set any properties for your materials, then nothing will be set and everything you use will use 'PBR Solid' by default. I can send my modified version so you have a better idea of how to do your kart better.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2332960679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBAFL56UFHVPI34UES5DZVDZ55AVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZSHE3DANRXHE . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

awab1433 commented 1 week ago

Hello, can you please send me the updated version? Thanks!

On Thu, Sep 5, 2024 at 5:33 PM Richard Qian @.***> wrote:

@awab1433 https://github.com/awab1433 I mentioned that you can use vertex painting to use vertex colors. I think the STK website mentions about this; this is the only other way that you can 'texture' objects besides using image files. You should also know that if you don't set any properties for your materials, then nothing will be set and everything you use will use 'PBR Solid' by default. I can send my modified version so you have a better idea of how to do your kart better.

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2332960679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBAFL56UFHVPI34UES5DZVDZ55AVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZSHE3DANRXHE . You are receiving this because you were mentioned.Message ID: @.***>

RQWorldblender commented 1 week ago

@awab1433 Sorry I forgot about this, but here's what I worked on so far: NitroBlade.zip

awab1433 commented 1 week ago

the file doesnt open? It will not launch.. Anyway, what did you do and how?! Cause i have a lucid air sapphire coming soon and i wanna make it work?

On Sun, Sep 8, 2024 at 12:38 PM Richard Qian @.***> wrote:

@awab1433 https://github.com/awab1433 Sorry I forgot about this, but here's what I worked on so far: NitroBlade.zip https://github.com/user-attachments/files/16923442/NitroBlade.zip

— Reply to this email directly, view it on GitHub https://github.com/supertuxkart/stk-blender/issues/27#issuecomment-2336800412, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKHBAHN7W2OTS77IN2WYHLZVSRTJAVCNFSM6AAAAABHWUTXL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZWHAYDANBRGI . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards, Awab O.M VLACS Full-Time K-9 Program

RQWorldblender commented 1 week ago

the file doesnt open? It will not launch.. Anyway, what did you do and how?! Cause i have a lucid air sapphire coming soon and i wanna make it work?

You need at least Blender 4.2 LTS to open the file, I should've mentioned that, but I was on my phone typing this. I made the following changes, but this isn't all of them:

awab1433 commented 1 week ago

you said that some were empty objects? how did you fix that?

RQWorldblender commented 1 week ago

you said that some were empty objects? how did you fix that?

In Parent -> Clear parent and keep transformation, that's how it can be done, from the object or right click menu. Your empty objects were represented by axises. I kept the one for the car body. The exporter will handle mesh objects better than empty objects unless they are a hat placer or nitro emitter.

awab1433 commented 6 hours ago

@RQWorldblender Audi.zip I dont underestand what is going on? I did what you said, but it's not happening. It worked with the other nitroblade i made?