BlendLuxCore Development

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

Re: BlendLuxCore Development

Post by Piita » Mon Dec 18, 2017 3:56 am

Well that's excellent news :)

User avatar
B.Y.O.B.
Developer
Posts: 1738
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. » Mon Dec 18, 2017 10:11 pm

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
Support LuxCoreRender project with salts and bounties

User avatar
B.Y.O.B.
Developer
Posts: 1738
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. » Mon Dec 18, 2017 10:22 pm

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.
Support LuxCoreRender project with salts and bounties

User avatar
Dade
Developer
Posts: 1465
Joined: Mon Dec 04, 2017 8:36 pm

Re: BlendLuxCore Development

Post by Dade » Tue Dec 19, 2017 12:17 am

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
Posts: 86
Joined: Tue Dec 05, 2017 6:06 pm

Re: BlendLuxCore Development

Post by neo2068 » Tue Dec 19, 2017 9:43 pm

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 GTX 1080 + GTX 780, Windows 10 64bit, Blender 2.79b
Support LuxCoreRender project with salts and bounties

User avatar
B.Y.O.B.
Developer
Posts: 1738
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. » Tue Dec 19, 2017 9:50 pm

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.
Support LuxCoreRender project with salts and bounties

User avatar
Piita
Supporting Users
Posts: 23
Joined: Tue Dec 05, 2017 4:54 pm

Re: BlendLuxCore Development

Post by Piita » Wed Dec 20, 2017 4:23 pm

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?

User avatar
B.Y.O.B.
Developer
Posts: 1738
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. » Wed Dec 20, 2017 4:39 pm

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.
Support LuxCoreRender project with salts and bounties

User avatar
Piita
Supporting Users
Posts: 23
Joined: Tue Dec 05, 2017 4:54 pm

Re: BlendLuxCore Development

Post by Piita » Wed Dec 20, 2017 6:20 pm

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.

User avatar
B.Y.O.B.
Developer
Posts: 1738
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: BlendLuxCore Development

Post by B.Y.O.B. » Wed Dec 20, 2017 6:58 pm

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
Support LuxCoreRender project with salts and bounties

Post Reply