(last?) changes for 0.7

This commit is contained in:
RodZill4 2019-11-24 18:47:21 +01:00
parent cab8020b4d
commit b153b3306f
6 changed files with 76 additions and 80 deletions

View File

@ -219,9 +219,9 @@ func update_spatial_material(m, file_prefix = null) -> void:
m.set_shader_param("albedo", parameters.albedo_color) m.set_shader_param("albedo", parameters.albedo_color)
m.set_shader_param("texture_albedo", get_generated_texture("albedo", file_prefix)) m.set_shader_param("texture_albedo", get_generated_texture("albedo", file_prefix))
m.set_shader_param("metallic", parameters.metallic) m.set_shader_param("metallic", parameters.metallic)
m.set_shader_param("roughness", parameters.roughness)
m.set_shader_param("texture_metallic", get_generated_texture("orm", file_prefix)) m.set_shader_param("texture_metallic", get_generated_texture("orm", file_prefix))
m.set_shader_param("metallic_texture_channel", PoolRealArray([0.0, 0.0, 1.0, 0.0])) m.set_shader_param("metallic_texture_channel", PoolRealArray([0.0, 0.0, 1.0, 0.0]))
m.set_shader_param("roughness", parameters.roughness)
m.set_shader_param("texture_roughness", get_generated_texture("orm", file_prefix)) m.set_shader_param("texture_roughness", get_generated_texture("orm", file_prefix))
m.set_shader_param("roughness_texture_channel", PoolRealArray([0.0, 1.0, 0.0, 0.0])) m.set_shader_param("roughness_texture_channel", PoolRealArray([0.0, 1.0, 0.0, 0.0]))
m.set_shader_param("emission_energy", parameters.emission_energy) m.set_shader_param("emission_energy", parameters.emission_energy)

View File

@ -0,0 +1,43 @@
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx,skip_vertex_transform;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform sampler2D texture_metallic : hint_white;
uniform vec4 metallic_texture_channel;
uniform sampler2D texture_roughness : hint_white;
uniform vec4 roughness_texture_channel;
uniform sampler2D texture_emission : hint_black_albedo;
uniform vec4 emission : hint_color;
uniform float emission_energy;
uniform sampler2D texture_normal : hint_normal;
uniform float normal_scale : hint_range(-16,16);
uniform sampler2D texture_depth : hint_white;
uniform float depth_scale : hint_range(0,1);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
void vertex() {
VERTEX = (MODELVIEW_MATRIX * vec4(VERTEX+NORMAL*depth_scale*(1.0-texture(texture_depth, UV).r), 1.0)).xyz;
UV=UV*uv1_scale.xy+uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
METALLIC = metallic_tex * metallic;
float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
SPECULAR = specular;
NORMALMAP = texture(texture_normal,base_uv).rgb;
NORMALMAP_DEPTH = normal_scale;
vec3 emission_tex = texture(texture_emission,base_uv).rgb;
EMISSION = (emission.rgb+emission_tex)*emission_energy;
}

View File

@ -6,17 +6,16 @@
[ext_resource path="res://addons/material_maker/preview/panoramas/epping_forest_01.hdr" type="Texture" id=4] [ext_resource path="res://addons/material_maker/preview/panoramas/epping_forest_01.hdr" type="Texture" id=4]
[ext_resource path="res://addons/material_maker/preview/panoramas/studio_sky.tres" type="Environment" id=5] [ext_resource path="res://addons/material_maker/preview/panoramas/studio_sky.tres" type="Environment" id=5]
[sub_resource type="PanoramaSky" id=3]
[sub_resource type="PanoramaSky" id=2]
resource_local_to_scene = true resource_local_to_scene = true
panorama = ExtResource( 2 ) panorama = ExtResource( 2 )
[sub_resource type="Environment" id=3] [sub_resource type="Environment" id=4]
resource_local_to_scene = true resource_local_to_scene = true
background_mode = 2 background_mode = 2
background_sky = SubResource( 2 ) background_sky = SubResource( 3 )
[sub_resource type="Animation" id=4] [sub_resource type="Animation" id=5]
loop = true loop = true
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/path = NodePath("Objects:rotation_degrees") tracks/0/path = NodePath("Objects:rotation_degrees")
@ -31,27 +30,27 @@ tracks/0/keys = {
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ] "values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ]
} }
[sub_resource type="PanoramaSky" id=5] [sub_resource type="PanoramaSky" id=1]
resource_local_to_scene = true resource_local_to_scene = true
panorama = ExtResource( 4 ) panorama = ExtResource( 4 )
[sub_resource type="Environment" id=6] [sub_resource type="Environment" id=2]
background_mode = 2 background_mode = 2
background_sky = SubResource( 5 ) background_sky = SubResource( 1 )
background_energy = 1.5 background_energy = 1.5
ambient_light_color = Color( 1, 1, 1, 1 ) ambient_light_color = Color( 1, 1, 1, 1 )
ambient_light_energy = 0.32 ambient_light_energy = 0.32
tonemap_mode = 2 tonemap_mode = 2
tonemap_white = 16.0 tonemap_white = 16.0
[sub_resource type="CylinderMesh" id=7] [sub_resource type="CylinderMesh" id=6]
top_radius = 5.0 top_radius = 5.0
bottom_radius = 5.0 bottom_radius = 5.0
height = 0.5 height = 0.5
[sub_resource type="SpatialMaterial" id=8] [sub_resource type="SpatialMaterial" id=7]
[sub_resource type="PlaneMesh" id=1] [sub_resource type="PlaneMesh" id=8]
size = Vector2( 1000, 1000 ) size = Vector2( 1000, 1000 )
subdivide_width = 10 subdivide_width = 10
subdivide_depth = 10 subdivide_depth = 10
@ -66,7 +65,7 @@ transform = Transform( 1, 0, 0, 0, 0.766044, 0.642788, 0, -0.642788, 0.766044, 0
[node name="Camera" type="Camera" parent="CameraPivot"] [node name="Camera" type="Camera" parent="CameraPivot"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3.5 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3.5 )
environment = SubResource( 3 ) environment = SubResource( 4 )
current = true current = true
[node name="RemoteTransform" type="RemoteTransform" parent="CameraPivot/Camera"] [node name="RemoteTransform" type="RemoteTransform" parent="CameraPivot/Camera"]
@ -75,7 +74,7 @@ remote_path = NodePath("../../../../../../ProjectsPane/BackgroundPreview/Viewpor
[node name="ObjectRotate" type="AnimationPlayer" parent="."] [node name="ObjectRotate" type="AnimationPlayer" parent="."]
autoplay = "rotate" autoplay = "rotate"
playback_speed = 0.1 playback_speed = 0.1
anims/rotate = SubResource( 4 ) anims/rotate = SubResource( 5 )
[node name="Environments" type="Spatial" parent="."] [node name="Environments" type="Spatial" parent="."]
@ -83,7 +82,7 @@ anims/rotate = SubResource( 4 )
editor/display_folded = true editor/display_folded = true
visible = false visible = false
script = ExtResource( 3 ) script = ExtResource( 3 )
environment = SubResource( 6 ) environment = SubResource( 2 )
[node name="DirectionalLight" type="DirectionalLight" parent="Environments/Epping Forest"] [node name="DirectionalLight" type="DirectionalLight" parent="Environments/Epping Forest"]
transform = Transform( 0.976272, -0.0494319, -0.21083, 0.216548, 0.222856, 0.950496, -8.69534e-009, -0.973597, 0.228272, -5.08826, 21.6274, 5.3744 ) transform = Transform( 0.976272, -0.0494319, -0.21083, 0.216548, 0.222856, 0.950496, -8.69534e-009, -0.973597, 0.228272, -5.08826, 21.6274, 5.3744 )
@ -93,14 +92,14 @@ shadow_enabled = true
[node name="MeshInstance" type="MeshInstance" parent="Environments/Epping Forest"] [node name="MeshInstance" type="MeshInstance" parent="Environments/Epping Forest"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.3343, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.3343, 0 )
visible = false visible = false
mesh = SubResource( 7 ) mesh = SubResource( 6 )
material/0 = SubResource( 8 ) material/0 = SubResource( 7 )
[node name="Moonless Golf" type="Spatial" parent="Environments"] [node name="Moonless Golf" type="Spatial" parent="Environments"]
editor/display_folded = true editor/display_folded = true
visible = false visible = false
script = ExtResource( 3 ) script = ExtResource( 3 )
environment = SubResource( 3 ) environment = SubResource( 4 )
[node name="DirectionalLight" type="DirectionalLight" parent="Environments/Moonless Golf"] [node name="DirectionalLight" type="DirectionalLight" parent="Environments/Moonless Golf"]
transform = Transform( 0.569388, 0.170928, 0.804103, 0.171359, -0.981336, 0.087263, 0.804011, 0.088104, -0.588051, 91.9658, 9.62053, -85.1176 ) transform = Transform( 0.569388, 0.170928, 0.804103, 0.171359, -0.981336, 0.087263, 0.804011, 0.088104, -0.588051, 91.9658, 9.62053, -85.1176 )
@ -118,5 +117,5 @@ shadow_enabled = true
[node name="GroundPlane" type="MeshInstance" parent="Environments/Studio"] [node name="GroundPlane" type="MeshInstance" parent="Environments/Studio"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.05186, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.05186, 0 )
mesh = SubResource( 1 ) mesh = SubResource( 8 )
material/0 = null material/0 = null

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=17 format=2] [gd_scene load_steps=17 format=2]
[ext_resource path="res://rodz_labs_logo.png" type="Texture" id=1] [ext_resource path="res://rodz_labs_logo.png" type="Texture" id=1]
[ext_resource path="res://addons/material_maker/import_plugin/tesselated.shader" type="Shader" id=2]
[sub_resource type="CubeMesh" id=1] [sub_resource type="CubeMesh" id=1]
@ -47,70 +48,23 @@ size = Vector2( 12, 12 )
albedo_texture = ExtResource( 1 ) albedo_texture = ExtResource( 1 )
uv1_scale = Vector3( 4, 4, 4 ) uv1_scale = Vector3( 4, 4, 4 )
[sub_resource type="Shader" id=14]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx,skip_vertex_transform;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform sampler2D texture_metallic : hint_white;
uniform vec4 metallic_texture_channel;
uniform sampler2D texture_roughness : hint_white;
uniform vec4 roughness_texture_channel;
uniform sampler2D texture_emission : hint_black_albedo;
uniform vec4 emission : hint_color;
uniform float emission_energy;
uniform sampler2D texture_normal : hint_normal;
uniform float normal_scale : hint_range(-16,16);
uniform sampler2D texture_depth : hint_white;
uniform float depth_scale : hint_range(0,1);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
void vertex() {
VERTEX = (MODELVIEW_MATRIX * vec4(VERTEX+NORMAL*depth_scale*(1.0-texture(texture_depth, UV).r), 1.0)).xyz;
UV=UV*uv1_scale.xy+uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
METALLIC = metallic_tex * metallic;
float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
SPECULAR = specular;
NORMALMAP = texture(texture_normal,base_uv).rgb;
NORMALMAP_DEPTH = normal_scale;
vec3 emission_tex = texture(texture_emission,base_uv).rgb;
EMISSION = (emission.rgb+emission_tex)*emission_energy;
}
"
[sub_resource type="ShaderMaterial" id=15] [sub_resource type="ShaderMaterial" id=15]
shader = SubResource( 14 ) shader = ExtResource( 2 )
shader_param/albedo = Color( 1, 1, 1, 1 ) shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.5 shader_param/specular = 0.5
shader_param/metallic = 0.0 shader_param/metallic = 0.0
shader_param/roughness = 1.0 shader_param/roughness = 1.0
shader_param/point_size = 1.0 shader_param/point_size = 1.0
shader_param/metallic_texture_channel = Plane( 1, 0, 0, 0 ) shader_param/metallic_texture_channel = Plane( 0, 0, 1, 0 )
shader_param/roughness_texture_channel = Plane( 1, 0, 0, 0 ) shader_param/roughness_texture_channel = Plane( 0, 1, 0, 0 )
shader_param/emission = Color( 0, 0, 0, 1 ) shader_param/emission = Color( 0, 0, 0, 1 )
shader_param/emission_energy = 1.0 shader_param/emission_energy = 1.0
shader_param/normal_scale = 1.0 shader_param/normal_scale = null
shader_param/depth_scale = null shader_param/depth_scale = 0.21
shader_param/uv1_scale = Vector3( 1, 1, 1 ) shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 ) shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 ) shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 ) shader_param/uv2_offset = Vector3( 0, 0, 0 )
shader_param/texture_albedo = ExtResource( 1 )
[node name="Objects" type="Spatial"] [node name="Objects" type="Spatial"]
transform = Transform( -0.685898, 0, 0.727691, 0, 1, 0, -0.727691, 0, -0.685898, 0, 0, 0 ) transform = Transform( -0.685898, 0, 0.727691, 0, 1, 0, -0.727691, 0, -0.685898, 0, 0, 0 )

File diff suppressed because one or more lines are too long

View File

@ -184,7 +184,7 @@ boot_splash/image="res://rodz_labs_logo.png"
boot_splash/fullsize=false boot_splash/fullsize=false
boot_splash/bg_color=Color( 0.0901961, 0.0941176, 0.141176, 1 ) boot_splash/bg_color=Color( 0.0901961, 0.0941176, 0.141176, 1 )
config/icon="res://icon.png" config/icon="res://icon.png"
config/release="0.7a1" config/release="0.7"
[autoload] [autoload]