1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-21 23:34:21 +00:00

Create custom nearest sampling material for island meshes

This commit is contained in:
Steffo 2023-01-08 00:03:34 +01:00
parent 5f729e6e15
commit 592a72b11b
Signed by: steffo
GPG key ID: 6965406171929D01
7 changed files with 80 additions and 31 deletions

View file

@ -40,6 +40,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0)
shape = SubResource("BoxShape3D_6ja5h")
[node name="Sprout" type="MeshInstance3D" parent="Plant"]
transform = Transform3D(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
mesh = SubResource("ArrayMesh_28cd1")
skeleton = NodePath("../../..")

10
island/GrassMaterial.tres Normal file
View file

@ -0,0 +1,10 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://bsjievied4u63"]
[ext_resource type="Texture2D" uid="uid://ebyf8q6s6yuj" path="res://assets/island_model/texture_0.png" id="1_lbuwo"]
[resource]
resource_name = "material0"
albedo_texture = ExtResource("1_lbuwo")
metallic = 1.0
texture_filter = 0
texture_repeat = false

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://bg88gc1w1gw5m"]
[gd_scene load_steps=14 format=3 uid="uid://bg88gc1w1gw5m"]
[ext_resource type="Shader" path="res://island/Sea.gdshader" id="1_agjfy"]
[ext_resource type="Texture2D" uid="uid://bdoifsf6k0qb8" path="res://assets/water_tile.png" id="1_w6ara"]
@ -9,23 +9,6 @@
[ext_resource type="PackedScene" uid="uid://bknwefv5ycc3u" path="res://island/PyramidSmolMesh.tscn" id="6_klmt8"]
[ext_resource type="PackedScene" uid="uid://cf35yl04qtru3" path="res://island/CropTile.tscn" id="8_4ooup"]
[sub_resource type="GDScript" id="GDScript_78lo3"]
script/source = "extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
for node in $World.get_children():
var material: Material = node.get_active_material(0)
if material is StandardMaterial3D:
material.texture_filter = BaseMaterial3D.TextureFilter.TEXTURE_FILTER_NEAREST
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3uyyi"]
render_priority = 0
shader = ExtResource("1_agjfy")
@ -53,7 +36,6 @@ background_mode = 2
sky = SubResource("Sky_j6hso")
[node name="Island" type="Node3D"]
script = SubResource("GDScript_78lo3")
[node name="World" type="Node3D" parent="."]

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,27 @@
[gd_scene load_steps=3 format=3 uid="uid://cxa5irr1atgke"]
[gd_scene load_steps=4 format=3 uid="uid://cxa5irr1atgke"]
[ext_resource type="ArrayMesh" uid="uid://bsv0f7c8nev8x" path="res://assets/island_model/pyramid_small.obj" id="1_0a7e0"]
[ext_resource type="Material" uid="uid://bsjievied4u63" path="res://island/GrassMaterial.tres" id="1_m8n53"]
[sub_resource type="ArrayMesh" id="ArrayMesh_ukixy"]
_surfaces = [{
"aabb": AABB(0, -3.33067e-16, -3, 3, 1.00001, 3),
"attribute_data": PackedByteArray(10, 215, 163, 62, 36, 73, 146, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62),
"format": 4119,
"index_count": 54,
"index_data": PackedByteArray(0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 6, 0, 8, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 16, 0, 18, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, 35, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, 0, 45, 0, 44, 0),
"material": ExtResource("1_m8n53"),
"name": "material0",
"primitive": 3,
"vertex_count": 48,
"vertex_data": PackedByteArray(0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 191, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 0, 0, 0, 0, 192, 165, 0, 0, 128, 36, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 128, 191, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 63, 0, 0, 192, 165, 0, 0, 128, 36, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 192, 165, 0, 0, 128, 36, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 191, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 191, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 128, 191, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 192, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 192, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 192, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 0, 192, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 64, 192, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 63, 0, 0, 0, 165, 0, 0, 64, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 0, 165, 0, 0, 64, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 0, 165, 0, 0, 64, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 0, 165, 0, 0, 64, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 64, 64, 0, 0, 192, 165, 0, 0, 128, 191, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 128, 191, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 192, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 64, 64, 0, 0, 0, 165, 0, 0, 0, 192, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 64, 64, 0, 0, 192, 165, 0, 0, 128, 191, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 192, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 64, 0, 0, 192, 165, 0, 0, 0, 0, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 192, 165, 0, 0, 128, 36, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 191, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 128, 191, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 192, 165, 0, 0, 0, 0, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 191, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 64, 64, 0, 0, 192, 165, 0, 0, 0, 0, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 192, 165, 0, 0, 0, 0, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 128, 191, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 64, 64, 0, 0, 192, 165, 0, 0, 128, 191, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 64, 64, 0, 0, 192, 165, 0, 0, 0, 0, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 128, 191, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 64, 64, 0, 0, 0, 165, 0, 0, 64, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 0, 165, 0, 0, 64, 192, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 64, 64, 0, 0, 0, 165, 0, 0, 0, 192, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 192, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 64, 64, 0, 0, 0, 165, 0, 0, 64, 192, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 0, 192, 255, 127, 255, 255, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 191, 255, 127, 255, 255, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 0, 192, 255, 127, 255, 255, 255, 255, 255, 191, 0, 0, 0, 64, 0, 0, 128, 63, 0, 0, 128, 191, 255, 127, 255, 255, 255, 255, 255, 191)
}]
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_emoh5"]
data = PackedVector3Array(1, 1, -1, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 1, 1, -1, 1, 1, -1, 0, 0, -1, 0, 0, -2, 1, 1, -2, 1, 1, -1, 0, 0, -2, 1, 1, -2, 0, 0, -2, 0, 0, -3, 1, 0, -3, 1, 1, -2, 0, 0, -3, 2, 1, -2, 1, 1, -2, 1, 0, -3, 2, 0, -3, 2, 1, -2, 1, 0, -3, 3, 0, -1, 2, 1, -1, 2, 1, -2, 3, 0, -2, 3, 0, -1, 2, 1, -2, 2, 0, 0, 1, 0, 0, 1, 1, -1, 2, 1, -1, 2, 0, 0, 1, 1, -1, 3, 0, 0, 2, 0, 0, 2, 1, -1, 3, 0, -1, 3, 0, 0, 2, 1, -1, 3, 0, -3, 2, 1, -2, 2, 0, -3, 3, 0, -2, 2, 1, -2, 3, 0, -3, 2, 1, -2, 1, 1, -1, 1, 1, -2, 2, 1, -1, 1, 1, -1, 2, 1, -2)
[node name="PyramidSmallMesh" type="MeshInstance3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -18, 0, 31)
mesh = ExtResource("1_0a7e0")
mesh = SubResource("ArrayMesh_ukixy")
skeleton = NodePath("../..")
[node name="StaticBody3D" type="StaticBody3D" parent="."]

View file

@ -1,13 +1,27 @@
[gd_scene load_steps=3 format=3 uid="uid://bknwefv5ycc3u"]
[gd_scene load_steps=4 format=3 uid="uid://bknwefv5ycc3u"]
[ext_resource type="ArrayMesh" uid="uid://c4ksctluio751" path="res://assets/island_model/pyramid_smol.obj" id="1_ceki5"]
[ext_resource type="Material" uid="uid://bsjievied4u63" path="res://island/GrassMaterial.tres" id="1_crvya"]
[sub_resource type="ArrayMesh" id="ArrayMesh_0ltt5"]
_surfaces = [{
"aabb": AABB(-1, -2.22045e-16, -1, 2, 1.00001, 2),
"attribute_data": PackedByteArray(10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 36, 73, 146, 62, 41, 92, 143, 62, 110, 219, 182, 62, 41, 92, 143, 62, 36, 73, 146, 62, 10, 215, 163, 62, 110, 219, 182, 62, 41, 92, 143, 62, 110, 219, 182, 62, 10, 215, 163, 62, 36, 73, 146, 62),
"format": 4119,
"index_count": 24,
"index_data": PackedByteArray(0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0),
"material": ExtResource("1_crvya"),
"name": "material0",
"primitive": 3,
"vertex_count": 24,
"vertex_data": PackedByteArray(0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 191, 0, 0, 128, 165, 0, 0, 0, 0, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 128, 191, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 128, 191, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 191, 0, 0, 128, 165, 0, 0, 128, 63, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 191, 0, 0, 128, 165, 0, 0, 0, 0, 255, 63, 255, 191, 255, 191, 255, 223, 0, 0, 128, 36, 0, 0, 128, 165, 0, 0, 128, 63, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 191, 0, 0, 128, 165, 0, 0, 128, 63, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 128, 165, 0, 0, 128, 63, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 36, 0, 0, 128, 165, 0, 0, 128, 63, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 127, 255, 191, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 128, 63, 0, 0, 128, 165, 0, 0, 128, 63, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 191, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 191, 255, 191, 255, 255, 255, 255, 255, 191, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 255, 191, 255, 191, 255, 191, 255, 159, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 191, 255, 191, 255, 191, 255, 191, 255, 159)
}]
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_lnxpp"]
data = PackedVector3Array(0, 1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 1, 0, -1, 0, -1, 0, 1, 0, -1, 0, 1, -1, 0, 0, 0, 0, 1, -1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 1, 0, 1, 0, -1)
[node name="PyramidSmolMesh" type="MeshInstance3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -21, 0, 30)
mesh = ExtResource("1_ceki5")
mesh = SubResource("ArrayMesh_0ltt5")
skeleton = NodePath("../..")
[node name="StaticBody3D" type="StaticBody3D" parent="."]