Skip to content
This repository was archived by the owner on Nov 2, 2021. It is now read-only.

Baking#16

Draft
dwlsalmeida wants to merge 8 commits intoGENIVI:masterfrom
dwlsalmeida:baking
Draft

Baking#16
dwlsalmeida wants to merge 8 commits intoGENIVI:masterfrom
dwlsalmeida:baking

Conversation

@dwlsalmeida
Copy link
Copy Markdown
Contributor

This exporter currently does not support materials at all, so all meshes are rendered as white pixels by default.

The simplest approach for materials is baking them, since baking is supported natively by Blender. Cycles baking is explained at length here and here.

Upsides:
a) natively supported (bpy.ops.object.bake)
b) easy to implement for the exporter
c) the same strategy is used in other problem domains (e.g. game development)

Downsides:
a) since lights are frozen in place, the technique is subpar for scenes with a lot of moving objects.
b) it takes a while to bake even in low resolutions

This patch:
a) switches the render engine to Cycles, reverting it after
b) creates an image node to receive the baked data, removing it after to avoid clutter
c) UV unwraps objects using the 'smart project' algorithm if needed, since only unwrapped objects can be baked. The extra UV layers are also removed after baking.
d) bakes MeshNodes to PNG files on disk

Still pending:
a) hook the baked data (PNG) to RAMSES
b) add tests

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant