Closed Lamoot closed 2 years ago
I've looked a bit more into the 1. issue and how various values appear in OpenMW. For <emission>
we should take the emission value of the principles BSDF material node or fall back to RGB(0, 0, 0) if the node is for some reason not available. For <ambient>
it should be simplest to take nelsson's proposal from Discord to use bpy.data.worlds["World"].color
and write it to <ambient>
.
And of course document all of this.
Testing, bpy.context.scene.world.color
works nicely here and is easy to access.
For the rest, I'm thinking of a workflow where we get all the required values from the Specular BSDF shader node. It's a shader based on the same legacy system that Collada uses and contains all the values we need.
This would work so that this shader node is REQUIRED in the material. Otherwise it defaults to some sane values. This node is the best way to mirror the Blender - Collada values in a way that it's clear to users.
bpy.data.materials["Material"].use_backface_culling
property in Blender.All of the mentioned issues have been fixed by https://github.com/OpenMW/collada-exporter/pull/14 so I'm closing the issue as resolved.
There are a few issues with how materials are set-up in Blender and what is then exported. The two I recently encountered are:
The material is exported with RGB(1, 1, 1)
<emission>
to offset how the shadowed sides of models are very dark. It works decently during daytime but breaks during night, when they objects don't look shaded enough Here we should have<emission>
at RGB(0, 0, 0) unless it's enabled in the material. For alleviating the initial dark shading issue we should hook up some Blender value to<ambient>
Texture paths in the exported file depend on the relative location of the source .blend file and .dds texture file. Currently I fix this manually by editing the .dae file and making sure the texture paths go from
../../../../../Tree/textures/leaves.dds
totextures/leaves.dds
To keep in mind is that the valid path can be different depending if the texture is intextures/
subfolders.