-Fixed height fog (was broken)
-Make sure materials are named in OBJ importer, so they can be saved outside as resources.
This commit is contained in:
parent
e1cf789593
commit
9738ebcda0
3 changed files with 6 additions and 2 deletions
|
@ -2048,7 +2048,7 @@ FRAGMENT_SHADER_CODE
|
||||||
|
|
||||||
if (fog_height_enabled) {
|
if (fog_height_enabled) {
|
||||||
float y = (camera_matrix * vec4(vertex,1.0)).y;
|
float y = (camera_matrix * vec4(vertex,1.0)).y;
|
||||||
fog_amount = max(fog_amount,pow(1.0-smoothstep(fog_height_min,fog_height_max,y),fog_height_curve));
|
fog_amount = max(fog_amount,pow(smoothstep(fog_height_min,fog_height_max,y),fog_height_curve));
|
||||||
}
|
}
|
||||||
|
|
||||||
float rev_amount = 1.0 - fog_amount;
|
float rev_amount = 1.0 - fog_amount;
|
||||||
|
|
|
@ -58,6 +58,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
|
||||||
|
|
||||||
current_name = l.replace("newmtl", "").strip_edges();
|
current_name = l.replace("newmtl", "").strip_edges();
|
||||||
current.instance();
|
current.instance();
|
||||||
|
current->set_name(current_name);
|
||||||
material_map[current_name] = current;
|
material_map[current_name] = current;
|
||||||
} else if (l.begins_with("Ka ")) {
|
} else if (l.begins_with("Ka ")) {
|
||||||
//uv
|
//uv
|
||||||
|
|
|
@ -952,7 +952,10 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
|
||||||
|
|
||||||
for (int i = 0; i < mesh->get_surface_count(); i++) {
|
for (int i = 0; i < mesh->get_surface_count(); i++) {
|
||||||
mat = mesh->surface_get_material(i);
|
mat = mesh->surface_get_material(i);
|
||||||
if (!mat.is_valid() || mat->get_name() == "")
|
|
||||||
|
if (!mat.is_valid())
|
||||||
|
continue;
|
||||||
|
if (mat->get_name() == "")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!p_materials.has(mat)) {
|
if (!p_materials.has(mat)) {
|
||||||
|
|
Loading…
Reference in a new issue