This repository has been archived by the owner on Nov 2, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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