MaxToLux - 3ds Max Integration for LuxCoreRender

Discussion related to the LuxCore functionality, implementations and API.
User avatar
TAO
Developer
Posts: 163
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: MaxToLux - 3ds Max Integration for LuxCore

Post by TAO » Sat Nov 21, 2020 9:41 am

patro wrote:
Sat Nov 21, 2020 9:04 am
TAO wrote:
Sat Nov 21, 2020 1:29 am
I have been trying to build a compatible version for 3dsmax 2021 and there is a conflict between different versions of openimageIO and tbb.dll that already exist in 3dsmax 2021 and the one Luxcorerender need.
Until 3dsmax 2020 I manage to solve compatibility between openimageIO.dll and tbb.dll that works out for the best but in 3dsmax 2021 Arnold renderer needs a different version and the Luxcore always try to use Dll in the 3dsmax root directory.
How can I solve this without modifying the Luxcorerender code, because I don't want to modify the Luxcore source code every time that I need to update and build the Luxcorerender code?
Any suggestions here?

Should I ask this in another thread?
Hi, maybe Dade can tell you something about, or you can try to ask on https://forums.cgsociety.org/, there are lots of coders out there which handle with 3ds max and they really try to help.

Edited:
Did you check, if your problem is caused just by a change of the folder structure in 3ds max 2021. I needed to install a plugin, which is not updated anymore and i had to recreate the structure folder of the plugin inside 3ds max 2021 roots, to make it work.
Thank you.
Yes, I'm pretty sure, if I add the correct library in 3dsmax root it will work perfectly but Arnold will stop responding.
Omid Ghotbi (TAO)
Download link to last MaxToLux build.👇👇
viewtopic.php?f=5&t=1010&start=160#p22925

User avatar
Dade
Developer
Posts: 4817
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: MaxToLux - 3ds Max Integration for LuxCore

Post by Dade » Sat Nov 21, 2020 10:28 am

TBB is used by Intel Denoiser so even if may be solve the problem related to OpenImageIO versions by changing our sources, it can not be solved for TBB.

It may be possible to solve the problem with some Windows specific call: https://social.msdn.microsoft.com/Forum ... =vcgeneral

May be Acasta69 can look into the problem :?:
Support LuxCoreRender project with salts and bounties

User avatar
TAO
Developer
Posts: 163
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: MaxToLux - 3ds Max Integration for LuxCore

Post by TAO » Sat Nov 21, 2020 11:49 am

Dade wrote:
Sat Nov 21, 2020 10:28 am
TBB is used by Intel Denoiser so even if may be solve the problem related to OpenImageIO versions by changing our sources, it can not be solved for TBB.

It may be possible to solve the problem with some Windows specific call: https://social.msdn.microsoft.com/Forum ... =vcgeneral

May be Acasta69 can look into the problem :?:
Thank you, Dade.
I manage to fix TBB.dll compatibility.
The main problem is about OpenimageIO now.
I attached the openimageIO.dll that already exist in 3dsmax 2021.
Attachments
OpenImageIO.zip
(2.11 MiB) Downloaded 6 times
Omid Ghotbi (TAO)
Download link to last MaxToLux build.👇👇
viewtopic.php?f=5&t=1010&start=160#p22925

acasta69
Developer
Posts: 361
Joined: Tue Jan 09, 2018 3:45 pm

Re: MaxToLux - 3ds Max Integration for LuxCore

Post by acasta69 » Mon Nov 23, 2020 8:47 pm

Dade wrote:
Sat Nov 21, 2020 10:28 am
It may be possible to solve the problem with some Windows specific call: https://social.msdn.microsoft.com/Forum ... =vcgeneral

May be Acasta69 can look into the problem :?:
i am looking into this, with little success at the moment. I am trying to have LuxCoreUI loading OpenImageIO from different locations as described in the thread linked by Dade. A so called "side-by-side assembly" is recognized, but when I move the dll to a different location (subfolder) it is not found any more.
Hopefully I can test more in the coming days or week-end.
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87

User avatar
TAO
Developer
Posts: 163
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: MaxToLux - 3ds Max Integration for LuxCore

Post by TAO » Mon Nov 23, 2020 11:10 pm

acasta69 wrote:
Mon Nov 23, 2020 8:47 pm
Dade wrote:
Sat Nov 21, 2020 10:28 am
It may be possible to solve the problem with some Windows specific call: https://social.msdn.microsoft.com/Forum ... =vcgeneral

May be Acasta69 can look into the problem :?:
i am looking into this, with little success at the moment. I am trying to have LuxCoreUI loading OpenImageIO from different locations as described in the thread linked by Dade. A so called "side-by-side assembly" is recognized, but when I move the dll to a different location (subfolder) it is not found any more.
Hopefully I can test more in the coming days or week-end.
That's the exact same issue as I have. LuxCoreRenderer always looking into the root directory or "path addresses" for Dll and will use the first Dll that exist
Omid Ghotbi (TAO)
Download link to last MaxToLux build.👇👇
viewtopic.php?f=5&t=1010&start=160#p22925

acasta69
Developer
Posts: 361
Joined: Tue Jan 09, 2018 3:45 pm

Re: MaxToLux - 3ds Max Integration for LuxCoreRender

Post by acasta69 » Tue Nov 24, 2020 8:09 pm

After some (a lot :shock: ) more testing I have something working now.
I came to the conclusion that, when I moved the files from the luxcoreui.exe location to a subfolder, they were not found any more because the previous location was remembered.
After some more googling I have found this:
http://csi-windows.com/blog/all/27-csi- ... ng-ignored
which seems to confirm the problem. "Touching" the executable makes everything work again after a file move.

So, to recap, now I have LuxCoreUI using the correct version of OpenImageIO.dll, which is located in a subfolder, while in the executable folder a different version of the library is present (a newer version that could never work with LuxCore, so I am sure everything's ok).

To create the OpenImageIO assembly, I created a file named LuxCoreRender.DllOpenImageIO.manifest with this content:

Code: Select all

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity name="LuxCoreRender.DllOpenImageIO" processorArchitecture="amd64" version="1.0.0.0" type="win32" />
    <file name = "OpenImageIO.dll"/>
</assembly>
A manifest for LuxCoreUI to declare the dependency from the previous one can be this one, named luxcoreui.exe.manifest:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity name="LuxCoreRender.DllOpenImageIO" processorArchitecture="*" version="1.0.0.0" type="win32"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
It can be automatically generated with Visual Studio by specifying as additional manifest dependencies:

Code: Select all

name='LuxCoreRender.DllOpenImageIO' processorArchitecture='*' version='1.0.0.0' type='win32'"
The exe.manifest must be located next to the exe, while the DLL manifest must always be together with the DLL, and both of them can be in the same folder as the exe or in a subfolder named like the DLL assembly (in my test, LuxCoreRender.DllOpenImageIO).
I ran all this using LuxCoreUI.exe as a test case, but I think it should be possible to replicate everything for the 3dsMax plugin.

I hope I did not forget some important detail.
If anything is unclear or more tests are needed, just let me know.
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87

User avatar
TAO
Developer
Posts: 163
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: MaxToLux - 3ds Max Integration for LuxCoreRender

Post by TAO » Tue Nov 24, 2020 9:25 pm

acasta69 wrote:
Tue Nov 24, 2020 8:09 pm
After some (a lot :shock: ) more testing I have something working now.
I came to the conclusion that, when I moved the files from the luxcoreui.exe location to a subfolder, they were not found any more because the previous location was remembered.
After some more googling I have found this:
http://csi-windows.com/blog/all/27-csi- ... ng-ignored
which seems to confirm the problem. "Touching" the executable makes everything work again after a file move.

So, to recap, now I have LuxCoreUI using the correct version of OpenImageIO.dll, which is located in a subfolder, while in the executable folder a different version of the library is present (a newer version that could never work with LuxCore, so I am sure everything's ok).

To create the OpenImageIO assembly, I created a file named LuxCoreRender.DllOpenImageIO.manifest with this content:

Code: Select all

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity name="LuxCoreRender.DllOpenImageIO" processorArchitecture="amd64" version="1.0.0.0" type="win32" />
    <file name = "OpenImageIO.dll"/>
</assembly>
A manifest for LuxCoreUI to declare the dependency from the previous one can be this one, named luxcoreui.exe.manifest:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity name="LuxCoreRender.DllOpenImageIO" processorArchitecture="*" version="1.0.0.0" type="win32"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
It can be automatically generated with Visual Studio by specifying as additional manifest dependencies:

Code: Select all

name='LuxCoreRender.DllOpenImageIO' processorArchitecture='*' version='1.0.0.0' type='win32'"
The exe.manifest must be located next to the exe, while the DLL manifest must always be together with the DLL, and both of them can be in the same folder as the exe or in a subfolder named like the DLL assembly (in my test, LuxCoreRender.DllOpenImageIO).
I ran all this using LuxCoreUI.exe as a test case, but I think it should be possible to replicate everything for the 3dsMax plugin.

I hope I did not forget some important detail.
If anything is unclear or more tests are needed, just let me know.
Thank you for solution.
I tried it and it works perfectly with "exe" file that directly access Dll libraries, but with 3dsmax no luck what so ever.
Maybe i missed something or it's not work because of MaxToLux.dlr it's already a external library and wants to call another external library.
Not sure but i tried it in so many ways with no success so far.
Omid Ghotbi (TAO)
Download link to last MaxToLux build.👇👇
viewtopic.php?f=5&t=1010&start=160#p22925

acasta69
Developer
Posts: 361
Joined: Tue Jan 09, 2018 3:45 pm

Re: MaxToLux - 3ds Max Integration for LuxCoreRender

Post by acasta69 » Wed Nov 25, 2020 6:13 am

What kind of library is the MaxToLux.dlr?
Can it be a DLL, just with renamed extension?
The method should work also with DLLs, just the manifest name must be different - something like "DllName.dll.2.manifest", if I remember correctly.
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87

User avatar
TAO
Developer
Posts: 163
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: MaxToLux - 3ds Max Integration for LuxCoreRender

Post by TAO » Wed Nov 25, 2020 9:31 am

acasta69 wrote:
Wed Nov 25, 2020 6:13 am
What kind of library is the MaxToLux.dlr?
Can it be a DLL, just with renamed extension?
The method should work also with DLLs, just the manifest name must be different - something like "DllName.dll.2.manifest", if I remember correctly.
Yes exactly, it's basically a Dll that renamed to be recognized as a renderer.
I tried this method for dll as well but i get same error.
Remember it calls by loading dll itself dynamically inside of plugin. by calling HINSTANCE and LibraryCall, etc.
3dsmax manage to load side by side dlls from 2 different locations, the problem is, that any place it reads the ddls doesn't matter because as long as one library loaded the other one will be ignored and one of the plugins will crush.
Omid Ghotbi (TAO)
Download link to last MaxToLux build.👇👇
viewtopic.php?f=5&t=1010&start=160#p22925

acasta69
Developer
Posts: 361
Joined: Tue Jan 09, 2018 3:45 pm

Re: MaxToLux - 3ds Max Integration for LuxCoreRender

Post by acasta69 » Thu Nov 26, 2020 3:02 pm

TAO wrote:
Wed Nov 25, 2020 9:31 am
3dsmax manage to load side by side dlls from 2 different locations, the problem is, that any place it reads the ddls doesn't matter because as long as one library loaded the other one will be ignored and one of the plugins will crush.
I see, I admit that I don't now how to tackle this, it seems a bit out of our control.
Probably we can (or should) update to a more recent version of OpenImageIO after v2.5 is out, but, from what you say, it could very well cause similar problems in less recent versions.
Support LuxCoreRender project with salts and bounties

Windows 10 64 bits, i7-4770 3.4 GHz, RAM 16 GB, GTX 970 4GB v445.87

Post Reply