[Solved] Exporting materials for Ogre_V2 from Blender? Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

[Solved] Exporting materials for Ogre_V2 from Blender?

Post by knn217 »

Hello, I was following the "Blender2ogre" documentation to learn how to create and export my assets from Blender.
I tried to export the DamagedHelmet sample model to learn which material setup was correct, but there was no success.

At first, I tried to export from the DamagedHelmet's original setup:
Image
but the mesh has no color when loaded in the app:
Image
So I tried a new setup, based on the documentation's description for the metallic workflow:
Image
but this time, the exporter ran into an error:

Code: Select all

Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_ogre\ui\export.py", line 210, in execute
    scene.dot_scene(target_path, target_file_name_no_ext)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_ogre\ogre\scene.py", line 199, in dot_scene
    dot_materialsv2json(materials, path, separate_files=config.get('SEPARATE_MATERIALS'), prefix=prefix)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_ogre\ogre\materialv2json.py", line 36, in dot_materialsv2json
    generator.process_materials()
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_ogre\ogre\materialv2json.py", line 80, in process_materials
    self.copy_textures()
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_ogre\ogre\materialv2json.py", line 298, in copy_textures
    util.image_magick(image, src_filename, dst_filename, separate_channel=channel)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\scripts\addons\io_ogre\util.py", line 411, in image_magick
    subprocess.call(cmd)
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\subprocess.py", line 1456, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

Are there any other steps I missed for the metallic workflow? This is the most I could get out of the docs.

Last edited by knn217 on Mon Nov 06, 2023 12:29 am, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5477
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1359

Re: Exporting materials for Ogre_V2 from Blender?

Post by dark_sylinc »

This seems to be an exporter bug, so you may have better luck asking there.

The traceback reports an error finding a file, so I guess it is either not finding imagemagick, or it doesn't find your texture file.

knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: Exporting materials for Ogre_V2 from Blender?

Post by knn217 »

dark_sylinc wrote: Fri Nov 03, 2023 7:55 pm

This seems to be an exporter bug, so you may have better luck asking there.

Thanks for the reply! I'll try that then.

knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: Exporting materials for Ogre_V2 from Blender?

Post by knn217 »

After some attempts, I finally managed to export something that has texture in Ogre-next. The setup is simply just remove everything but the "BaseColor" image texture like so:
Image

I don't know if this is a feature but this makes the "BaseColor" image texture combine with the "Base Color" Setting underneath (I thought the "BaseColor" image texture would replace the "Base Color" Setting when plugged in, not combine with it).
Here are 2 examples:
_When the "Base Color" Setting underneath is set to white: Image
_When the "Base Color" Setting underneath is set to red: Image

Also, it made no difference when I switched between "sRGB" and "Non-Color" Color Space for the "BaseColor" image texture, which I thought was odd.

knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: Exporting materials for Ogre_V2 from Blender?

Post by knn217 »

dark_sylinc wrote: Fri Nov 03, 2023 7:55 pm

The traceback reports an error finding a file, so I guess it is either not finding imagemagick, or it doesn't find your texture file.

The problem really was an .exe file in "imagemagick" not found, due to being combined into another .exe file, reinstalling "imagemagick" with legacy option selected solved the issue for me.

It also seems like Ogre-next's JSON material support is currently not very widely used right now, so I'm going to try and modify this module for some features I need. Right now, I'm trying to make some hair cards so what I'm focusing on is "Transparency".

I had a look at this post: viewtopic.php?t=84573

In the 2 examples you gave, "Transparency" doesn't seem to have a path to an image texture, but "use_alpha_from_textures" is set to true, does this mean it uses the alpha from "diffuse", "roughness", ...? I'm asking this since the texture files I downloaded has the file "Opacity.png" which is supposed to be used for Transparency but it seems like JSON material doesn't use it.

Also, is there a documentation page to learn JSON material? The best I found are some forum posts... I also found some very detailed docs but they were for the OgreV1 materials which look somewhat different from JSON material.

Right now, I'm just trying to manually set the .material.json file 1st, to get the desired result, then I will modify the JSON material exporter to follow that pattern.

knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: [Solved] Exporting materials for Ogre_V2 from Blender?

Post by knn217 »

I think I found the docs, but the color makes it really hard to read: https://ogrecave.github.io/ogre-next/ap ... ckref.html
There are also another page for Ogre 2.3 with better color but it doesn't have these parts

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5477
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1359

Re: [Solved] Exporting materials for Ogre_V2 from Blender?

Post by dark_sylinc »

What do you mean by colour makes it hard to read?

Could you upload a screenshot of how it looks on your browser? Thanks.

knn217
Halfling
Posts: 78
Joined: Wed Jan 25, 2023 9:04 am
x 5

Re: [Solved] Exporting materials for Ogre_V2 from Blender?

Post by knn217 »

dark_sylinc wrote: Tue Nov 07, 2023 1:18 am

Could you upload a screenshot of how it looks on your browser? Thanks.

Here's the screenshot: Image
I can adjust to dark mode but the text doesn't have enough contrast, so looking at the page too long gives me a headache. I've been using ctr+A to highlight all text.

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5477
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1359

Re: [Solved] Exporting materials for Ogre_V2 from Blender?

Post by dark_sylinc »

OMG that's horrible, and it doesn't look like that on my browser.

I had a better docs template for 4.0, but it seems I'll have to backport it to 3.0