09-22-2024, 01:37 PM
(This post was last modified: 09-22-2024, 01:38 PM by MrElephant.
Edit Reason: changed should* to shouldn't
)
(11-04-2023, 10:47 PM)nailuj843 Wrote:(06-23-2023, 07:08 PM)Luctaris Wrote:(06-23-2023, 01:26 AM)vod1003 Wrote: Thank you for this amazing tool. Any tips for exporting from Blender to programs like Unity or Maya? The textures don't seem to embed when exported as fbx.
I saw that you opened up an issue on the github regarding this too. I'll post my answer here for anyone wondering in the future.
Quote:Support for external exporters and file formats is somewhat out of the scope of this project. I can't control how scenes using my tool are imported and interpreted by other software.
This project sets up a custom shader node layout for each material used in the scene.
I couldn't find a suitable file format that can support texture blending, vertex color information, texture mirroring, fog information, etc... which is why I opted to create my own custom .glr file format and associated importer for Blender.
If you want an importer for Maya, 3ds Max, 4D cinema, etc... a custom importer addon/plugin/script will need to be made to interpret the .glr file format for that tool.
If there is enough interest, I might look into creating an addon for Unity/Maya to handle my file format, but I primarily chose to use Blender because it's 100% free and easily accessible.
TL;DR: Sorry... I won't go out of my way to purchase $1000+ software like Maya just so a few people can use my addon.
A fix for the FBX export not linking to the textures is to use this script, which will associate the textures to the materials
Code:# Get access to Blender Python API
import bpy
#Loop over all materials
for mat in bpy.data.materials:
# Get the name of each material (this name is what will be used to find the .png texture file)
matName = mat.name
# Cut off the last 4 characters of the material name '(XX)'
matSubName = matName[:-4]
# Create a new_texture to be assigned to the material
tex = bpy.data.textures.new(matSubName, 'IMAGE')
# Add a reference to a newly created texture_slot on the material
slot = mat.texture_slots.add()
# Assign the new_texture to the new_texture_slot on the material
slot.texture = tex
# Make the file path to the Scene Rip output folder to find the image to assign to the texture
filePath = "PATH TO TEXTURE DUMP OUTPUT FOLDER/GLideNHQ/scene_rips/"
# Create the file name based on the material name
fileName = filePath + matSubName + ".png"
# load in the file from the scene_rips folder
image = bpy.data.images.load(fileName, check_existing=False)
# Assign the image to the Texture
tex.image = image
Then export the FBX making sure to use
Path Mode : Copy
You may have to manually correct the Transparency when importing the FBX to other applications such as Unity
Cheers!
Can you confirm where we are supposed to add in this piece of code? Without it, textures are not applied when exported. Are we supposed to add it to import_glr.py, or run it from the "scripting" section in blender. This shouldn't be possible, as it generates an error " - 'material' object has no attribute 'texture_slots'