BlendLuxCore Development

Discussion related to the LuxCore functionality, implementations and API.
User avatar
Piita
Supporting Users
Posts: 64
Joined: Tue Dec 05, 2017 4:54 pm

Re: BlendLuxCore Development

Post by Piita »

Well that's excellent news :)
Piitas.blog
Librem 5 - The privacy focused smart phone
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. »

Currently crawling around in weird bgl OpenGL code trying to use modern OpenGL to draw the viewport render.
Somewhere in Blender I found this function which is supposed to create a NULL pointer when passed 0 as input:

Code: Select all

def gl_buffer_void_as_long(value):
    import ctypes
    a = (ctypes.c_byte * 1).from_address(value)
    return bgl.Buffer(bgl.GL_BYTE, 1, a)
Problem is it doesn't work :P
Blender crashes and I read somewhere that bgl.Buffer doesn't support null pointers.
Which in turn means I can't use the functions glVertexAttribPointer and glDrawElements which I need for modern OpenGL VBO drawing.

If someone wants to follow me on this quest, see issue 19.

At least OpenGL coding creates nice glitches when error handling is a bit lax (fixed by now):
Attachments
scrn_2017-12-18_21-54-19.png
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. »

Dade wrote: Sun Dec 17, 2017 6:44 pm I wouldn't be surprised if the old code iterate through all triangles (or something with like that)
Found out what it was: motion blur!
It steps through 2 (or 3?) frames when exporting each object (even when the object is not animated, apparently. maybe I can check that in the future).
Without motion blur it exports in 0.6 seconds. This is faster than BlendLuxCore, probably because BlendLuxCore does not have mesh caching yet so shared meshes are exported multiple times, or maybe because of other reasons.

But I have an optimization for future motion blur in mind: I read somewhere that someone refactored it from (pseudocode):

Code: Select all

for obj in objects:
    for i in blur_steps:
        set_frame(i)
        export(obj)
to:

Code: Select all

for i in blur_steps:
    set_frame(i)
    for obj in objects:
        export(obj)
which seems to have worked wonders. Probably because set_frame is expensive.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: BlendLuxCore Development

Post by Dade »

B.Y.O.B. wrote: Mon Dec 18, 2017 10:22 pm which seems to have worked wonders. Probably because set_frame is expensive.
Yes, I have seen the Blender code only a couple of times but I have no doubt that switching frame can be an extremely expansive (really, I mean, it could involve stuff like reading different texture maps, etc.).
Support LuxCoreRender project with salts and bounties
neo2068
Developer
Developer
Posts: 260
Joined: Tue Dec 05, 2017 6:06 pm
Location: Germany

Re: BlendLuxCore Development

Post by neo2068 »

I found the reason why the new exporter didn't work on my side. I tried to activate the new exporter beside the old one. When I deactivate the old one all work fine. :D The same happens if I try to activate the old exporter after activation of the new one but the other way around.
i7 5820K, 32 GB RAM, NVIDIA Geforce RTX 2080 SUPER + GTX 1080, Windows 10 64bit, Blender 2.83.5
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: BlendLuxCore Development

Post by B.Y.O.B. »

I would never have guessed that because on my machine it works fine.
Weird stuff. Maybe we will have to add a note about it to the first release.
User avatar
Piita
Supporting Users
Posts: 64
Joined: Tue Dec 05, 2017 4:54 pm

Re: BlendLuxCore Development

Post by Piita »

I would like to join in on developing blendluxcore. I have unfortunately no experience of collaborated development through github, and python is new to me too. I have made some small programs for myself over the years in free pascal using lazarus ide but nothing big.
I will start examining the blendluxcore code and try to learn how it all works.

Byob, can you think of any (easy) part of blendluxcore that I could start working on?
Piitas.blog
Librem 5 - The privacy focused smart phone
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. »

It's great that you're interested :D
However you have a lot on your plate. I'll try to write more beginner guides for the BlendLuxCore code.
This is a good opportunity to make the code as accessible to newcomers as possible.

To learn Python and the Blender API basics, I would suggest you start writing some simple Python scripts and addons in Blender first.
See https://docs.blender.org/api/2.79/ (there are some beginner guides linked in the first paragraph)

A task that's doable for a beginner would be to add more material nodes, however it's also a bit boring and tedious (if you're not super hyped to see that cool metal2 material you're implementing).
I think it might be better to think of a topic that interests you especially. Is there some LuxCore feature you want to see implemented as soon as possible?
Back when I started I did it because I came from V-Ray and wanted to use the power of AOVs. I think since I implemented AOVs I have used them two times or so in an actual project :P

About github and all that, I will quote the wiki:
If you want to contribute to LuxCore development or just submit a quick patch, the easiest way to start is to fork the repository on github.
You can then edit your fork, commit your changes and send us a pull request.
If you continue to contribute, we will eventually give you direct access to the repositories.
So your first step is to create a github account, go to https://github.com/LuxCoreRender/BlendLuxCore and press the "fork" button on the top right of the page.
I'll write a more detailed guide later.
User avatar
Piita
Supporting Users
Posts: 64
Joined: Tue Dec 05, 2017 4:54 pm

Re: BlendLuxCore Development

Post by Piita »

B.Y.O.B. wrote: Wed Dec 20, 2017 4:39 pm A task that's doable for a beginner would be to add more material nodes...
That sounds good, I'll start there.
Piitas.blog
Librem 5 - The privacy focused smart phone
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. »

You can have a look at this commit where I added the glass node: https://github.com/LuxCoreRender/BlendL ... 39fc780e82
It's a bit of a special case because it is really 3 materials (glass, roughglass and archglass) but it should show you which files to edit:
  • Create the file nodes/materials/thenewmaterial.py (e.g. glass.py or metal2.py)
  • import your new class in nodes/materials/__init__.py and add it as a NodeItem
  • If you need any new sockets for your material, add them to nodes/sockets.py
For an explanation what the node methods (like draw_buttons) do, open a text editor in Blender and open the menu templates > python > custom nodes.
Our nodes have only one custom method that's not part of the example, the "export" method.
scrn_2017-12-20_19-57-58.png
And if you have any questions, let me know.

edit: by the way, the IDE I use is Pycharm community edition.
If you tell me your OS I can also upload a fresh LuxCore build for you, or you can try to compile yourself: http://wiki.luxcorerender.org/Compiling_LuxCore
Post Reply