Bake up axis
This commit is contained in:
Binary file not shown.
@@ -10,7 +10,7 @@ struct Vertex {
|
||||
|
||||
struct RayGenConstantBuffer {
|
||||
float4 v0; // frame, strength, radius, offset
|
||||
float4 v1;
|
||||
float4 v1; // envstr, upaxis
|
||||
float4 v2;
|
||||
float4 v3;
|
||||
float4 v4;
|
||||
@@ -63,6 +63,8 @@ void raygeneration() {
|
||||
|
||||
accum = normalize(accum / SAMPLES) * 0.5 + 0.5;
|
||||
|
||||
if (constant_buffer.v1.y > 0) accum.xyz = float3(accum.x, accum.z, 1.0 - accum.y);
|
||||
|
||||
float3 color = float3(render_target[DispatchRaysIndex().xy].xyz);
|
||||
if (constant_buffer.v0.x == 0) {
|
||||
color = accum.xyz;
|
||||
|
||||
@@ -68,10 +68,16 @@ class MakeBake {
|
||||
else if (UITrait.inst.bakeType == 3) { // Normal (World)
|
||||
frag.n = true;
|
||||
frag.write('fragColor[0] = vec4(n * vec3(0.5, 0.5, 0.5) + vec3(0.5, 0.5, 0.5), 1.0);');
|
||||
if (UITrait.inst.bakeUpAxis == 1) { // Y up
|
||||
frag.write('fragColor[0].rgb = vec3(fragColor[0].r, fragColor[0].b, 1.0 - fragColor[0].g);');
|
||||
}
|
||||
}
|
||||
else if (UITrait.inst.bakeType == 4) { // Position
|
||||
frag.wposition = true;
|
||||
frag.write('fragColor[0] = vec4(wposition * vec3(0.5, 0.5, 0.5) + vec3(0.5, 0.5, 0.5), 1.0);');
|
||||
if (UITrait.inst.bakeUpAxis == 1) { // Y up
|
||||
frag.write('fragColor[0].rgb = vec3(fragColor[0].r, fragColor[0].b, 1.0 - fragColor[0].g);');
|
||||
}
|
||||
}
|
||||
else if (UITrait.inst.bakeType == 5) { // TexCoord
|
||||
frag.write('fragColor[0] = vec4(texCoord.xy, 0.0, 1.0);');
|
||||
|
||||
@@ -191,6 +191,7 @@ class RenderPathRaytrace {
|
||||
f32[2] = UITrait.inst.bakeAoRadius;
|
||||
f32[3] = UITrait.inst.bakeAoOffset;
|
||||
f32[4] = Scene.active.world.probe.raw.strength;
|
||||
f32[5] = UITrait.inst.bakeUpAxis;
|
||||
|
||||
var baketex2 = path.renderTargets.get("baketex2").image;
|
||||
Krom.raytraceDispatchRays(baketex2.renderTarget_, f32.buffer);
|
||||
|
||||
@@ -992,7 +992,7 @@ class UITrait {
|
||||
bakes.push("BentNormal (DXR)");
|
||||
#end
|
||||
bakeType = ui.combo(bakeHandle, bakes, "Bake");
|
||||
if (bakeType == 3 || bakeType == 4 || bakeType == 8) {
|
||||
if (bakeType == 3 || bakeType == 4 || bakeType == 9) {
|
||||
var bakeUpAxisHandle = Id.handle({position: bakeUpAxis});
|
||||
bakeUpAxis = ui.combo(bakeUpAxisHandle, ["Z", "Y"], "Up Axis");
|
||||
}
|
||||
@@ -1031,8 +1031,6 @@ class UITrait {
|
||||
}
|
||||
if (ui.changed) {
|
||||
MaterialParser.parsePaintMaterial();
|
||||
// Context.pdirty = 4;
|
||||
// pushUndo
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user