BlendLuxCore Development

Discussion related to the LuxCore functionality, implementations and API.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. »

Sharlybg wrote: Fri Feb 02, 2018 11:11 pm I also notice that render preview update each time i click on assign material no matter there is no more change .
It's the same in Cycles.
It's a Blender limitation, I can only access a "is_updated" member variable of the mesh/object and if it says "True" then I make an update.
And sometimes it says "True" even if there is no visible change.
It's the same if you enter/exit edit mode, which also updates the preview in Cycles.
User avatar
Sharlybg
Donor
Donor
Posts: 3104
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: BlendLuxCore Development

Post by Sharlybg »

Yanda :shock: . OK

Want to ask something also about cloth shader. Is there any possibility to get a bump map texture based on the procedural diffuse texture provided ?
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. »

I think it has an integrated bump mapping the shader itself, but I'm not sure.
Maybe Dade can explain further.

To get the diffuse/bump values used in the shader separately we would probably need to create a new texture. I don't know if it's possible to separate them, we would have to look at the implementation (and maybe also on the paper).
It's here: https://github.com/LuxCoreRender/LuxCor ... /cloth.cpp
User avatar
Sharlybg
Donor
Donor
Posts: 3104
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: BlendLuxCore Development

Post by Sharlybg »

also is there any possibility regarding blender api to let us get a correct material shading mod in viewport ?
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. »

I started to work on that a bit, see https://github.com/LuxCoreRender/BlendLuxCore/issues/38
But it's one of those areas where there exists nearly no documentation and I have to resort to a lot of trial & error which is time consuming and frustrating.
I'll try to fix more in this area in the future when I have more time.
User avatar
Sharlybg
Donor
Donor
Posts: 3104
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: BlendLuxCore Development

Post by Sharlybg »

B.Y.O.B. wrote: Sat Feb 03, 2018 11:55 am I started to work on that a bit, see https://github.com/LuxCoreRender/BlendLuxCore/issues/38
But it's one of those areas where there exists nearly no documentation and I have to resort to a lot of trial & error which is time consuming and frustrating.
I'll try to fix more in this area in the future when I have more time.
Aaah blender blender. Please let theses part of blender that slowing down us as you said. I'm progressing in my python course and start to understand why many people don't really write docs about software. it already annoying to write comment inside code ;)
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. »

Quick test.
rain.jpg
Sharlybg wrote: Sat Feb 03, 2018 12:08 pm it already annoying to write comment inside code ;)
General rule: comment why you are doing something, not how you are doing it.
If you follow it, you'll only comment parts of the code that may be unclear to others or future you, and you don't have to comment every single thing.
User avatar
Sharlybg
Donor
Donor
Posts: 3104
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: BlendLuxCore Development

Post by Sharlybg »

Thanks for the very nice advice.
Quick test.
more infos : rendermod render time version. you're thoughs about sobol sampler improvement ?
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. »

5min path sobol on my laptop.
Sharlybg wrote: Sat Feb 03, 2018 2:07 pm you're thoughs about sobol sampler improvement ?
I couldn't test it much yet but the artifacts are gone and the speedup looks good.
Philstix
Posts: 13
Joined: Sun Feb 04, 2018 8:48 pm
Location: Brisbane, Australia

Re: BlendLuxCore Development

Post by Philstix »

I'm not sure if this is the correct place to post this, or even if anyone is interested, but I've been messing about with the Blender python addon scripts re the material/texture nodes - just modifying the python files in the Blender addons directory for now - and I've created a utility node for IOR presets to plug into the glass material's IOR socket.

I've only put a few presets in it, at least until I find out if anyone wants me to continue, and because it's all in Python I've had to 'borrow' the export type definition of 'constfloat1' otherwise the binary complains about an unknown type.

I've run it in Blender 2.79a with version v2.0alpha3 OpenCL in Linux, and it seems to be working correctly - at least I'm not getting any errors in the console. Fair warning: I'm a mediocre programmer on a good day, so someone competent may look at it and fall off their chair laughing :lol: And I haven't got a clue how to do anything with the C++ source code.

Anyway, if people want this I'll put in more presets and enable it for volume nodes as well. Then, of course, I'll have to find out how to formally submit it. :?:

Implementing this required modifying the files 'addons/BlendLuxCore/nodes/materials/__init__.py' by inserting at line 130:

Code: Select all

        NodeItem("LuxCoreNodeIORPresets", label="IOR Preset"),
and 'addons/BlendLuxCore/nodes/textures/__init__.py' by inserting at line 43:

Code: Select all

from .ior_presets import LuxCoreNodeIORPresets
and creating the file 'addons/BlendLuxCore/nodes/textures/ior_presets.py':

Code: Select all

from bpy.props import FloatProperty, EnumProperty
from .. import LuxCoreNodeTexture

ior_values = {}
ior_values["vacuum"] = ["Vacuum", 1]
ior_values["glass_pyrex"] = ["Glass, Pyrex", 1.470]
ior_values["water_20C"] = ["Water @ 20C", 1.330]
ior_values["air_stp"] = ["Air @ STP", 1.000277]
ior_values["diamond"] = ["Diamond", 2.417]
ior_values["ethanol"] = ["Ethanol", 1.36]
ior_values["liquid_helium"] = ["Liquid Helium", 1.025]

class LuxCoreNodeIORPresets(LuxCoreNodeTexture):
    """Selection of IOR preset values"""
    bl_label = "IOR Preset"
    
    value = FloatProperty(name="IOR", description="Index of Refraction Preset")

    def update_preset(self, context):
        enabled = self.preset == "air_stp"
        
    ior_presets = []
        
    for v in sorted(ior_values.keys()):
        s = "{} ({:f})".format(ior_values[v][0], ior_values[v][1])
        ior_presets.append((v, s, s))

    preset = EnumProperty(name="IORPreset", items=ior_presets, default="air_stp", update=update_preset)

    def init(self, context):
        self.outputs.new("LuxCoreSocketIOR", "IOR")

    def draw_buttons(self, context, layout):
        layout.prop(self, "preset")

    def export(self, props, luxcore_name=None):
        definitions = {
            "type": "constfloat1",
            "value": ior_values[self.preset][1],
        }

        if self.preset != "air_stp":
            definitions["preset"] = self.preset

        return self.base_export(props, definitions, luxcore_name)
Post Reply