Texture generation tests

This commit is contained in:
Mark Hoekveen
2020-03-07 15:10:11 +01:00
parent 646f76af8b
commit ecfff780fa
12 changed files with 1334 additions and 77 deletions
@@ -0,0 +1,3 @@
source_md5="0a219d8eb959aff725a2075c22c1750b"
dest_md5="af651bf4bcc0864ae689d49735367f98"
+17 -1
View File
@@ -12,8 +12,24 @@ sun_latitude = 2.77
sun_longitude = -50.44
[sub_resource type="Environment" id=2]
background_mode = 2
background_mode = 1
background_sky = SubResource( 1 )
tonemap_mode = 2
ssao_radius = 0.3
ssao_intensity = 67.2
ssao_bias = 1.183
ssao_color = Color( 0.223529, 0.243137, 0.615686, 1 )
glow_levels/1 = true
glow_levels/2 = true
glow_levels/4 = true
glow_levels/6 = true
glow_levels/7 = true
glow_intensity = 3.75
glow_bloom = 0.26
glow_hdr_threshold = 1.57
glow_hdr_luminance_cap = 12.31
adjustment_enabled = true
adjustment_saturation = 0.87
[node name="Spatial" type="Spatial"]
script = ExtResource( 4 )
BIN
View File
Binary file not shown.
File diff suppressed because one or more lines are too long
+63
View File
@@ -0,0 +1,63 @@
tool
extends Spatial
var map = Image.new()
var rng = RandomNumberGenerator.new()
const N: int = 512
func set_points(n: int) -> void:
map.lock()
for i in range(0, n):
map.set_pixel(rng.randi_range(0, N), rng.randi_range(0, N), Color("#000000"))
map.unlock()
func rule(rule, p, c, n) -> bool:
# Rule 30
if (p && c && !n) || (p && !c && !n) || (!p && c && n) || (!p && !c && n):
# Rule 184
# if (p && c && n) || (p && !c && n) || (p && !c && !n) || (!p && c && n):
return true
return false
func set_ca_texture(rule: int) -> void:
map.lock()
var prev_row = []
var next_row = []
prev_row.resize(N+1)
for i in range(0, N):
if rng.randf() > 0.5:
prev_row[i] = true
#map.set_pixel(0, 256, Color("#000000"))
for i in range(0, N):
next_row.clear()
next_row.resize(N+1)
for j in range(0, N):
var p
var n
var c
c = prev_row[j]
if j >= 1 && j < N:
p = prev_row[j-1]
n = prev_row[j+1]
if j == 0:
p = prev_row[N]
if j == N:
n = prev_row[0]
if self.rule(rule, p, c, n):
next_row[j] = true;
map.set_pixel(j, i, Color("#000000"))
prev_row = next_row.duplicate()
map.unlock()
func _ready() -> void:
rng.randomize()
map.create(N, N, false, Image.FORMAT_RGB8)
map.fill(Color("#ffffff"))
self.set_ca_texture(100)
var text = ImageTexture.new()
text.create_from_image(map)
var mat = get_node("Thing").get_surface_material(0)
mat.set_texture(0, text)
+87 -76
View File
File diff suppressed because one or more lines are too long
+14
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://homunculus.glb" type="PackedScene" id=1]
[node name="homunculus" instance=ExtResource( 1 )]
[node name="Cube" parent="." index="0"]
use_in_baked_light = true
+6
View File
@@ -42,4 +42,10 @@ select_creature={
[rendering]
threads/thread_model=2
quality/directional_shadow/size=8192
quality/shadow_atlas/size=8192
quality/reflections/irradiance_max_size=256
quality/reflections/atlas_size=4096
quality/reflections/atlas_subdiv=16
quality/filters/msaa=3
environment/default_environment="res://default_env.tres"