A baking test scene

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: A baking test scene

Post by Dade »

Marcurion wrote: Wed Sep 30, 2020 4:16 pm I am new to LuxCore.
Could someone explain to me how I can get the light information baked to a texture for realtime graphics?
I already managed to set up everything in Blender :)
Unfortunately, baking is a feature that has not yet been exposed in BlendLuxCore. It has been developed, some time ago, for https://www.vectary.com.

I can explain you how to export the scene from blender, edit the scene files and to use command line tools to obtain the baked textures but it is a viable option only if you are something like a developer (i.e. it is going to be very annoying and confusing for a normal Blender user).
Support LuxCoreRender project with salts and bounties
Marcurion
Posts: 3
Joined: Wed Sep 30, 2020 10:09 am

Re: A baking test scene

Post by Marcurion »

Dade wrote: Wed Sep 30, 2020 8:04 pm
I can explain you how to export the scene from blender, edit the scene files and to use command line tools to obtain the baked textures but it is a viable option only if you are something like a developer (i.e. it is going to be very annoying and confusing for a normal Blender user).
Oh that is fine, I am a programer, please go ahead...
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: A baking test scene

Post by Dade »

Marcurion wrote: Wed Sep 30, 2020 8:48 pm
Dade wrote: Wed Sep 30, 2020 8:04 pm
I can explain you how to export the scene from blender, edit the scene files and to use command line tools to obtain the baked textures but it is a viable option only if you are something like a developer (i.e. it is going to be very annoying and confusing for a normal Blender user).
Oh that is fine, I am a programer, please go ahead...
The procedure to follow is described here: viewtopic.php?f=5&t=1577&start=50#p18250

You can also use test scenes available here with the above precedure: https://github.com/LuxCoreRender/LuxCor ... cenes/bake
Support LuxCoreRender project with salts and bounties
Marcurion
Posts: 3
Joined: Wed Sep 30, 2020 10:09 am

Re: A baking test scene

Post by Marcurion »

Dade wrote: Sat Oct 03, 2020 10:42 am
The procedure to follow is described here: viewtopic.php?f=5&t=1577&start=50#p18250

You can also use test scenes available here with the above precedure: https://github.com/LuxCoreRender/LuxCor ... cenes/bake
Hi Dade,

thank you for helping me out.
I am almost there. I encountered an issue with commas in my scene.cfg: viewtopic.php?t=330
And solved it by replacing them with nothing in the file.

Now there are basically two issues:

1) The luxcoreui crashes once it tries to bake the third object in my scene (the glass dice)

2) The floor texture which is baked before (it is flipped in x-Dimension currently) does not take into account the glass dice at all, not even as a shadow caster let alone for the nice light tracing effect I want to achieve :|
LightTracing.PNG
LightmapBaked.PNG
I attached my Blender scene and the LuxCore output, maybe you can have a look?
BakeTestDice.zip
(866.08 KiB) Downloaded 288 times
Kind regards,
Marcurion
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: A baking test scene

Post by Dade »

Marcurion wrote: Wed Oct 07, 2020 4:25 pm I am almost there. I encountered an issue with commas in my scene.cfg: viewtopic.php?t=330
This should not happen if you are using the under development v2.5, are you ?
Marcurion wrote: Wed Oct 07, 2020 4:25 pm And solved it by replacing them with nothing in the file.

Now there are basically two issues:

1) The luxcoreui crashes once it tries to bake the third object in my scene (the glass dice)
You .ply files a corrupted by "," inside numbers:

Code: Select all

format binary_little_endian 1.0
comment Created by LuxRays v2.4
element vertex 9,954
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float s
property float t
element face 18,432
property list uchar uint vertex_indices
end_header
Again, I assume you are using v2.4 :?:
Support LuxCoreRender project with salts and bounties
User avatar
u3dreal
Developer
Developer
Posts: 560
Joined: Tue Dec 03, 2019 3:23 pm
Location: Ulm
Contact:

Re: A baking test scene

Post by u3dreal »

Since I have a web 3D project I have been looking into texture baking.
And what can I say luxcore is a very good way to do it.

Thanks Dade !

Now that I figured out the workflow ..I have some problems with the exported gltf when importing into Blender.
Also it does not work in other programs. BabylonJS or Opencascade.

Code: Select all

Python: Traceback (most recent call last):
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/__init__.py", line 1050, in execute
    return self.import_gltf2(context)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/__init__.py", line 1064, in import_gltf2
    if self.unit_import(path, import_settings) == {'FINISHED'}:
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/__init__.py", line 1084, in unit_import
    BlenderGlTF.create(gltf_importer)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py", line 42, in create
    BlenderGlTF._create(gltf)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py", line 49, in _create
    BlenderScene.create(gltf)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_scene.py", line 40, in create
    BlenderNode.create_vnode(gltf, 'root')
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py", line 51, in create_vnode
    BlenderNode.create_vnode(gltf, child)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py", line 38, in create_vnode
    BlenderNode.create_object(gltf, vnode_id)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py", line 58, in create_object
    obj = BlenderNode.create_mesh_object(gltf, vnode)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_node.py", line 207, in create_mesh_object
    mesh = BlenderMesh.create(gltf, pynode.mesh, pynode.skin)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py", line 34, in create
    return create_mesh(gltf, mesh_idx, skin_idx)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py", line 52, in create_mesh
    do_primitives(gltf, mesh_idx, skin_idx, mesh, tmp_ob)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py", line 208, in do_primitives
    uvs = BinaryData.decode_accessor(gltf, prim.attributes['TEXCOORD_%d' % uv_i], cache=True)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/io/imp/gltf2_io_binary.py", line 82, in decode_accessor
    array = BinaryData.decode_accessor_obj(gltf, accessor)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/io/imp/gltf2_io_binary.py", line 102, in decode_accessor_obj
    buffer_data = BinaryData.get_buffer_view(gltf, accessor.buffer_view)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/io/imp/gltf2_io_binary.py", line 53, in get_buffer_view
    gltf.load_buffer(buffer_view.buffer)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/io/imp/gltf2_io_gltf.py", line 165, in load_buffer
    data = self.load_uri(buffer.uri)
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/scripts/addons/io_scene_gltf2/io/imp/gltf2_io_gltf.py", line 183, in load_uri
    return memoryview(base64.b64decode(data))
  File "/Users/drquader/Desktop/Blender.app/Contents/Resources/2.93/python/lib/python3.9/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

location: <unknown location>:-1

You can find the gltf exported from luxcoreui here
http://q3de.com/wp-content/uploads/2021/08/testbake.zip

It would be nice if you could have a look.
And how can I use Denoising ? will I have to add that manually to the bakeall.cfg ?

Using the textures manually in Blender works really well.

I also think this is a much underrated feature and thinking about integrating it into BlendLuxCore.

Here is the file exported from Blender with LuxCore textures in BabylonJS
Attachments
screenshot_21-8-14_0-53.png
check out my newest stuff http://q3de.com/research/
portfolio http://q3de.com/


MB Pro i7 2.3Ghz, IrisPro 1.5GB, GTX750m 2GB - BigSur
Xeon X5650@4Ghz, RX 5700 - BigSur , Windows 10, Ubuntu 20.04
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: A baking test scene

Post by Dade »

I will check, I was using official glTF file validator for checking LuxCore outputs (https://github.khronos.org/glTF-Validator/) so they should be correct.
Support LuxCoreRender project with salts and bounties
epilectrolytics
Donor
Donor
Posts: 790
Joined: Thu Oct 04, 2018 6:06 am

Re: A baking test scene

Post by epilectrolytics »

u3dreal wrote: Sun Aug 15, 2021 10:32 am I also think this is a much underrated feature and thinking about integrating it into BlendLuxCore.
Yes please :D
Thanks for your efforts!
User avatar
u3dreal
Developer
Developer
Posts: 560
Joined: Tue Dec 03, 2019 3:23 pm
Location: Ulm
Contact:

Re: A baking test scene

Post by u3dreal »

Dade wrote: Sun Aug 15, 2021 11:19 am I will check, I was using official glTF file validator for checking LuxCore outputs (https://github.khronos.org/glTF-Validator/) so they should be correct.
This site says there are errors in the asset container ...

the commandlinetool has no errors.

Thanks a lot !!

Getting the same error with windows and blender.

And how can I use Denoising ? will I have to add that manually to the bakeall.cfg ?

Denoising would be a great speedup.
Last edited by u3dreal on Sun Aug 15, 2021 1:52 pm, edited 1 time in total.
check out my newest stuff http://q3de.com/research/
portfolio http://q3de.com/


MB Pro i7 2.3Ghz, IrisPro 1.5GB, GTX750m 2GB - BigSur
Xeon X5650@4Ghz, RX 5700 - BigSur , Windows 10, Ubuntu 20.04
User avatar
u3dreal
Developer
Developer
Posts: 560
Joined: Tue Dec 03, 2019 3:23 pm
Location: Ulm
Contact:

Re: A baking test scene

Post by u3dreal »

Yes please :D
Thanks for your efforts!
Still thinking about how to do it. But the solution right now seems also really easy if the gltf export works correctly.
would be nice to have some settings for baking / denoising etc.
check out my newest stuff http://q3de.com/research/
portfolio http://q3de.com/


MB Pro i7 2.3Ghz, IrisPro 1.5GB, GTX750m 2GB - BigSur
Xeon X5650@4Ghz, RX 5700 - BigSur , Windows 10, Ubuntu 20.04
Post Reply