Bake height

This commit is contained in:
luboslenco
2019-12-07 21:08:55 +01:00
parent a1a620e5d0
commit 2f238c89c3
4 changed files with 35 additions and 27 deletions
+10 -7
View File
@@ -389,8 +389,11 @@ class RenderPathPaint {
if (Context.tool == ToolBake) {
if (Context.pdirty > 0) dilated = false;
if (UITrait.inst.bakeType == 2) { // Normal (Tangent)
UITrait.inst.bakeType = 3; // Bake high poly world normals
var isNormal = UITrait.inst.bakeType == 2;
var isHeight = UITrait.inst.bakeType == 4;
if (isNormal || isHeight) { // Normal (Tangent), Height
var _bakeType = UITrait.inst.bakeType;
UITrait.inst.bakeType = isNormal ? 3 : 5; // Bake high poly world normals / position
MaterialParser.parsePaintMaterial();
var _paintObject = Context.paintObject;
var highPoly = Project.paintObjects[UITrait.inst.bakeHighPoly];
@@ -402,12 +405,12 @@ class RenderPathPaint {
UITrait.inst.sub--;
if (pushUndoLast) History.paint();
UITrait.inst.bakeType = 2;
UITrait.inst.bakeType = _bakeType;
MaterialParser.parsePaintMaterial();
Context.selectPaintObject(_paintObject);
RenderPathPaint.commandsPaint();
}
else if (UITrait.inst.bakeType == 7) { // Object ID
else if (UITrait.inst.bakeType == 8) { // Object ID
var _layerFilter = UITrait.inst.layerFilter;
var _paintObject = Context.paintObject;
var isMerged = Context.mergedObject != null;
@@ -426,9 +429,9 @@ class RenderPathPaint {
}
#if kha_direct3d12
else if (UITrait.inst.bakeType == 0 || // AO (DXR)
UITrait.inst.bakeType == 8 || // Lightmap (DXR)
UITrait.inst.bakeType == 9 || // Bent Normal (DXR)
UITrait.inst.bakeType == 10) { // Thickness (DXR)
UITrait.inst.bakeType == 9 || // Lightmap (DXR)
UITrait.inst.bakeType == 10 || // Bent Normal (DXR)
UITrait.inst.bakeType == 11) { // Thickness (DXR)
RenderPathRaytrace.commandsBake();
}
#end
+4 -4
View File
@@ -316,10 +316,10 @@ class RenderPathRaytrace {
static function getBakeShaderName():String {
return
UITrait.inst.bakeType == 0 ? "raytrace_bake_ao.cso" :
UITrait.inst.bakeType == 8 ? "raytrace_bake_light.cso" :
UITrait.inst.bakeType == 9 ? "raytrace_bake_bent.cso" :
"raytrace_bake_thick.cso";
UITrait.inst.bakeType == 0 ? "raytrace_bake_ao.cso" :
UITrait.inst.bakeType == 9 ? "raytrace_bake_light.cso" :
UITrait.inst.bakeType == 10 ? "raytrace_bake_bent.cso" :
"raytrace_bake_thick.cso";
}
public static function draw() {