Scene texture maps resize policy

Discussion related to the LuxCore functionality, implementations and API.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Scene texture maps resize policy

Post by Dade »

juangea wrote: Tue Jun 15, 2021 12:01 pm Regarding the location of the TX files you asked before (I think), IMHO they should be located in the same folder as the original texture, so for example if you have a texture in your protect with the tax files already generated they will be used or regenerated if they are outdated, but we could store the tax files within the library and copy them over for a new project, that will avoid the need of regenerating them.
It is exactly as it is working now: if you use the image "c:\a\b\c\img.jpg", the file "c:\a\b\c\img.jpg.tx" is created (if it doesn't exist or it is outdated).
Support LuxCoreRender project with salts and bounties
juangea
Donor
Donor
Posts: 332
Joined: Thu Jan 02, 2020 6:23 pm

Re: Scene texture maps resize policy

Post by juangea »

Awesome, that allow us to store everything together with the project and our asset management system :)
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Scene texture maps resize policy

Post by B.Y.O.B. »

Dade wrote: Tue Jun 15, 2021 1:06 pm
B.Y.O.B. wrote: Tue Jun 15, 2021 10:40 am Could it be that I have to apply the policy settings somehow before building the scene, or so?
In BlendLuxCore, the luxcore_scene is built first, then the render config is created with renderconfig = pyluxcore.RenderConfig(config_props, luxcore_scene). In the logs it looks like all the image maps are already loaded before this step happens.
It sounds like you are creating the Scene without a resize policy because the resize policy is (after) defined in the render config.

I think, in your case, you have to pass the Resize policy properties to the scene constructor: https://github.com/LuxCoreRender/LuxCor ... ore.h#L772

See the Scene constructor has now an additional optional argument for them.
I tried to pass the properties like this:

Code: Select all

image_resize_policy_props = scene.luxcore.config.image_resize_policy.convert()
luxcore_scene = pyluxcore.Scene(image_resize_policy_props)

The properties are:
scene.images.resizepolicy.type = "MIPMAPMEM"
scene.images.resizepolicy.scale = 0.732143
scene.images.resizepolicy.minsize = 64
But the behaviour is still the same. Is the Python implementation working correctly?
It looks like the Python constructors (Properties/string) are different from the C++ constructors (Properties, Properties+Properties, filename + Properties):
https://github.com/LuxCoreRender/LuxCor ... .cpp#L1982
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Scene texture maps resize policy

Post by Dade »

I should have aligned the Python API with the C++ API. Note, due to some language difference, if you want to create an empty scene with a resize policy, you have to use something like :

Code: Select all

scene = pyluxcore.Scene(pyluxcore.Properties(), resizePolicyProps)
Support LuxCoreRender project with salts and bounties
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Scene texture maps resize policy

Post by B.Y.O.B. »

Thanks, it works now.

What does the scale parameter do when the auto-scaling policies are used? Is it a multiplier applied to the auto-detected optimal size?
E.g. auto-detection says a texture should be scaled from 100x100 to 50x50, scale parameter is set to 0.5, end result would be that the texture is scaled to 0.5 * 0.5 = 0.25 = 25x25, is that what happens?
bestman8
Posts: 16
Joined: Sat Jul 25, 2020 6:45 pm

Re: Scene texture maps resize policy

Post by bestman8 »

B.Y.O.B. wrote: Wed Jun 16, 2021 12:08 pm Thanks, it works now.

What does the scale parameter do when the auto-scaling policies are used? Is it a multiplier applied to the auto-detected optimal size?
E.g. auto-detection says a texture should be scaled from 100x100 to 50x50, scale parameter is set to 0.5, end result would be that the texture is scaled to 0.5 * 0.5 = 0.25 = 25x25, is that what happens?
would a user defined multiplier after like MINMEM be possible so if the result isn't perfect we can make it a bit larger or smaller if it wont matter that much. like for example it first runs MINMEM and then it would apply the user defined multiplier after that
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Scene texture maps resize policy

Post by Dade »

B.Y.O.B. wrote: Wed Jun 16, 2021 12:08 pm Is it a multiplier applied to the auto-detected optimal size?
E.g. auto-detection says a texture should be scaled from 100x100 to 50x50, scale parameter is set to 0.5, end result would be that the texture is scaled to 0.5 * 0.5 = 0.25 = 25x25, is that what happens?
Yes, exactly. <1.0 to save more memory, >1.0 to have less blurred image maps.
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Scene texture maps resize policy

Post by Dade »

bestman8 wrote: Wed Jun 16, 2021 1:43 pm
B.Y.O.B. wrote: Wed Jun 16, 2021 12:08 pm Thanks, it works now.

What does the scale parameter do when the auto-scaling policies are used? Is it a multiplier applied to the auto-detected optimal size?
E.g. auto-detection says a texture should be scaled from 100x100 to 50x50, scale parameter is set to 0.5, end result would be that the texture is scaled to 0.5 * 0.5 = 0.25 = 25x25, is that what happens?
would a user defined multiplier after like MINMEM be possible so if the result isn't perfect we can make it a bit larger or smaller if it wont matter that much. like for example it first runs MINMEM and then it would apply the user defined multiplier after that
It should already work in this way.
Support LuxCoreRender project with salts and bounties
juangea
Donor
Donor
Posts: 332
Joined: Thu Jan 02, 2020 6:23 pm

Re: Scene texture maps resize policy

Post by juangea »

I downloaded the build yesterday in the night and I can't find where to configure this, where is it?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Scene texture maps resize policy

Post by B.Y.O.B. »

Render properties, there's a new panel "Image Rescaling".
Post Reply