Merge pull request #52151 from CaptainProton42/fix-y-billboard-shear
Fix y billboard shear when rotating camera
This commit is contained in:
commit
9d43d49bfd
|
@ -790,12 +790,10 @@ void BaseMaterial3D::_update_shader() {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case BILLBOARD_FIXED_Y: {
|
case BILLBOARD_FIXED_Y: {
|
||||||
code += " MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0],WORLD_MATRIX[1],vec4(normalize(cross(CAMERA_MATRIX[0].xyz,WORLD_MATRIX[1].xyz)), 0.0),WORLD_MATRIX[3]);\n";
|
code += " MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(vec4(normalize(cross(vec3(0.0, 1.0, 0.0), CAMERA_MATRIX[2].xyz)),0.0),vec4(0.0, 1.0, 0.0, 0.0),vec4(normalize(cross(CAMERA_MATRIX[0].xyz, vec3(0.0, 1.0, 0.0))),0.0),WORLD_MATRIX[3]);\n";
|
||||||
|
|
||||||
if (flags[FLAG_BILLBOARD_KEEP_SCALE]) {
|
if (flags[FLAG_BILLBOARD_KEEP_SCALE]) {
|
||||||
code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(WORLD_MATRIX[0].xyz), 0.0, 0.0, 0.0),vec4(0.0, 1.0, 0.0, 0.0),vec4(0.0, 0.0, length(WORLD_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n";
|
code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(WORLD_MATRIX[0].xyz), 0.0, 0.0, 0.0),vec4(0.0, length(WORLD_MATRIX[1].xyz), 0.0, 0.0),vec4(0.0, 0.0, length(WORLD_MATRIX[2].xyz), 0.0),vec4(0.0, 0.0, 0.0, 1.0));\n";
|
||||||
} else {
|
|
||||||
code += " MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(1.0, 0.0, 0.0, 0.0),vec4(0.0, 1.0/length(WORLD_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0),vec4(0.0, 0.0, 0.0 ,1.0));\n";
|
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case BILLBOARD_PARTICLES: {
|
case BILLBOARD_PARTICLES: {
|
||||||
|
|
Loading…
Reference in New Issue