Compare commits
5 Commits
3c488b5d53
...
7f663969be
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f663969be | |||
| e53a377ff3 | |||
| a99162ae33 | |||
| d40609c9ee | |||
| 60471b44e6 |
@@ -6,3 +6,7 @@
|
||||
*.py text eol=lf
|
||||
*.ps1 text eol=crlf
|
||||
*.glb filter=lfs diff=lfs merge=lfs -text
|
||||
*.stl filter=lfs diff=lfs merge=lfs -text
|
||||
*.blend filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
/Demon_v0.19/reviews/infernal_v01/*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
**/*.bak
|
||||
**/__pycache__/
|
||||
**/*.pyc
|
||||
**/*.blend1
|
||||
/tools/godot/
|
||||
/tools/templates/
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://bp2h37q5xsbmh"
|
||||
path="res://.godot/imported/infernal_game.glb-784a16c52d1a54cac75b033abdf77181.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/succubus/infernal_v01/infernal_game.glb"
|
||||
dest_files=["res://.godot/imported/infernal_game.glb-784a16c52d1a54cac75b033abdf77181.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
|
After Width: | Height: | Size: 2.7 MiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://3ewf2ue5ec7x"
|
||||
path="res://.godot/imported/infernal_game_infernal_basecolor.png-176bfc5cb66a1a16f6a9562cbd0a57c2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "ec06996f35d03b5dff4ef74214143a93"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/succubus/infernal_v01/infernal_game_infernal_basecolor.png"
|
||||
dest_files=["res://.godot/imported/infernal_game_infernal_basecolor.png-176bfc5cb66a1a16f6a9562cbd0a57c2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 7.0 MiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dwy7syq0fx6th"
|
||||
path="res://.godot/imported/infernal_game_infernal_normal.png-2ffc28f6cf680dfae1d9df37d99308df.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "1fd5b6ab6d56b8a97cd3149923cfd9b1"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/succubus/infernal_v01/infernal_game_infernal_normal.png"
|
||||
dest_files=["res://.godot/imported/infernal_game_infernal_normal.png-2ffc28f6cf680dfae1d9df37d99308df.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 2.8 MiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://vn6snu2s5d24"
|
||||
path="res://.godot/imported/infernal_game_infernal_orm.png-5a89109bbf41773a273250e3f34517c8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "e403e04738838a82a634d99ad78bcb53"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/succubus/infernal_v01/infernal_game_infernal_orm.png"
|
||||
dest_files=["res://.godot/imported/infernal_game_infernal_orm.png-5a89109bbf41773a273250e3f34517c8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://bamstjlukbfa1"
|
||||
path="res://.godot/imported/intro_serafina.mp3-a51bcbb5fc574e842310b314086bb95b.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://audio/intro_serafina.mp3"
|
||||
dest_files=["res://.godot/imported/intro_serafina.mp3-a51bcbb5fc574e842310b314086bb95b.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -16,6 +16,10 @@ var initialized=false
|
||||
var moving=false
|
||||
var stride=1.55
|
||||
var last_direction=Vector3.ZERO
|
||||
var stride_min=1.25
|
||||
var stride_max=1.65
|
||||
var track_width=.065
|
||||
var swing_height=.15
|
||||
|
||||
func setup(owner_actor):
|
||||
actor=owner_actor;skeleton=actor.find_children("*","Skeleton3D",true,false)[0]
|
||||
@@ -67,7 +71,7 @@ func landing(f,progress,travel_direction):
|
||||
# Narrow catwalk track, with enough clearance for the boots to pass each other.
|
||||
var side=1.0 if f.side=="L" else -1.0
|
||||
var destination=actor.global_position+travel_direction*((1.0-progress)*stride+stride*.25)
|
||||
destination+=actor.global_basis.x.normalized()*side*.065*scale_y
|
||||
destination+=actor.global_basis.x.normalized()*side*track_width*scale_y
|
||||
destination.y=ground_height(f)
|
||||
return destination
|
||||
|
||||
@@ -81,7 +85,7 @@ func update(dt):
|
||||
var was_moving=moving;moving=distance>.00015 and dt>0
|
||||
var scale_y=actor.global_basis.get_scale().y
|
||||
# Longer steps at higher upgrade speeds; phase still follows the actual distance.
|
||||
stride=lerpf(1.25,1.65,clampf((last_speed/scale_y-1.3)/2.0,0,1))*scale_y
|
||||
stride=lerpf(stride_min,stride_max,clampf((last_speed/scale_y-1.3)/2.0,0,1))*scale_y
|
||||
walk_weight=move_toward(walk_weight,1.0 if moving else 0.0,dt*7)
|
||||
if moving:
|
||||
distance_walked+=distance;phase=fposmod(phase+distance/stride,1.0)
|
||||
@@ -103,7 +107,7 @@ func update(dt):
|
||||
var u=clampf((p-f.start_phase)/maxf(.01,1.0-f.start_phase),0,1)
|
||||
var ease=u*u*(3-2*u)
|
||||
f.target=f.start.lerp(f.landing,ease)
|
||||
f.target.y=ground_height(f)+sin(u*PI)*.15*scale_y
|
||||
f.target.y=ground_height(f)+sin(u*PI)*swing_height*scale_y
|
||||
else:
|
||||
if not f.grounded:
|
||||
f.anchor=f.landing;f.anchor.y=ground_height(f);f.yaw=actor.global_rotation.y;f.grounded=true
|
||||
@@ -146,7 +150,10 @@ func update(dt):
|
||||
skeleton.set_bone_pose_position(bones["root"],skeleton.to_local(root_position));skeleton.force_update_all_bone_transforms()
|
||||
for f in feet:
|
||||
leg(f,f.target)
|
||||
var yaw=f.yaw if f.grounded else actor.global_rotation.y
|
||||
var foot_rotation=Quaternion(Vector3.UP,yaw)*f.rotation
|
||||
if not f.grounded:foot_rotation=Quaternion(actor.global_basis.x.normalized(),sin(maxf(0,f.last_phase-.5)*TAU)*-.12)*foot_rotation
|
||||
set_rotation("foot."+f.side,foot_rotation)
|
||||
set_rotation("foot."+f.side,foot_orientation(f,dt))
|
||||
|
||||
func foot_orientation(f,_dt):
|
||||
var yaw=f.yaw if f.grounded else actor.global_rotation.y
|
||||
var orientation=Quaternion(Vector3.UP,yaw)*f.rotation
|
||||
if not f.grounded:orientation=Quaternion(actor.global_basis.x.normalized(),sin(maxf(0,f.last_phase-.5)*TAU)*-.12)*orientation
|
||||
return orientation
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
extends "res://catwalk.gd"
|
||||
# Approved Infernal locomotion: grounded heels and gentle secondary motion.
|
||||
var secondary_time=0.0
|
||||
|
||||
func _init():
|
||||
stride_min=.95;stride_max=1.15;track_width=.09;swing_height=.11
|
||||
|
||||
func ground_height(f):
|
||||
return actor.get_parent().global_position.y+f.rest.y*actor.global_basis.get_scale().y+.004
|
||||
|
||||
func update(dt):
|
||||
super.update(dt)
|
||||
secondary_time+=dt
|
||||
for side in ["L","R"]:
|
||||
var sign_x=1.0 if side=="L" else -1.0
|
||||
rotate_world("Wing."+side,actor.global_basis.y,sign_x*sin(phase*TAU-.7)*.035*walk_weight)
|
||||
rotate_world("Wing."+side,actor.global_basis.z,sign_x*sin(phase*TAU*2-.5)*.022*walk_weight)
|
||||
rotate_world("Wing."+side,actor.global_basis.y,sign_x*sin(secondary_time*.8)*.010)
|
||||
var tail_angle=sin(secondary_time*.95)*.012+sin(phase*TAU-.9)*.024*walk_weight
|
||||
rotate_world("Tail",actor.global_basis.y,tail_angle)
|
||||
rotate_world("Tail",actor.global_basis.x,sin(secondary_time*.7)*.006)
|
||||
|
||||
func foot_orientation(f,dt):
|
||||
var body_yaw=actor.global_rotation.y
|
||||
# The planted shoe may pivot, but the ankle must never remain twisted behind
|
||||
# a turning shin. Keep its heading within an anatomical range of the pelvis.
|
||||
var difference=wrapf(f.yaw-body_yaw,-PI,PI)
|
||||
if absf(difference)>deg_to_rad(22):f.yaw=body_yaw+clampf(difference,-deg_to_rad(22),deg_to_rad(22))
|
||||
var yaw=f.yaw if f.grounded else lerp_angle(f.yaw,body_yaw,minf(1,dt*18))
|
||||
if not f.grounded:f.yaw=yaw
|
||||
var orientation=Quaternion(Vector3.UP,yaw)*f.rotation
|
||||
# A high heel has a rigid arch. Lift the whole shoe with the leg rather than
|
||||
# sharply flexing its toe or rolling it onto the outer edge during swing.
|
||||
var roll=sin(clampf((f.last_phase-.5)*2,0,1)*PI)*-.045 if not f.grounded else 0.0
|
||||
return Quaternion(actor.global_basis.x.normalized(),roll)*orientation
|
||||
@@ -0,0 +1,91 @@
|
||||
extends Node
|
||||
|
||||
const RECORDING = preload("res://audio/intro_serafina.mp3")
|
||||
const LEAD = 2.0
|
||||
const TAIL = 2.0
|
||||
var g
|
||||
var voice: AudioStreamPlayer
|
||||
var active = false
|
||||
var suspended = false
|
||||
var elapsed = 0.0
|
||||
var tail_elapsed = -1.0
|
||||
var voice_started = false
|
||||
var saved_size = 20.0
|
||||
var saved_pan = Vector3.ZERO
|
||||
var tail_transform = Transform3D.IDENTITY
|
||||
|
||||
func setup(game):
|
||||
g=game
|
||||
voice=AudioStreamPlayer.new()
|
||||
add_child(voice)
|
||||
voice.stream=RECORDING
|
||||
voice.finished.connect(_voice_finished)
|
||||
|
||||
func begin():
|
||||
cancel()
|
||||
saved_size=g.camera.size
|
||||
saved_pan=g.orbit.pan
|
||||
g.orbit.stop();g.orbit.keys.clear()
|
||||
g.dialogue.stop();g.voice_player.stop()
|
||||
if is_instance_valid(g.life.hero_bubble):
|
||||
g.life.hero_bubble.queue_free();g.life.hero_bubble=null
|
||||
g.avatar.set_walking(false)
|
||||
g.avatar.cinematic_idle=true
|
||||
g.paused=true
|
||||
g.hud.hide()
|
||||
active=true;suspended=false;elapsed=0;tail_elapsed=-1;voice_started=false
|
||||
update(0)
|
||||
|
||||
func update(delta):
|
||||
if not active or suspended:return
|
||||
voice.volume_db=linear_to_db(maxf(g.voice_volume,.0001))
|
||||
elapsed+=delta
|
||||
if not voice_started and elapsed>=LEAD:
|
||||
voice_started=true
|
||||
voice.play()
|
||||
if tail_elapsed>=0:
|
||||
tail_elapsed+=delta
|
||||
var blend=smoothstep(0.0,1.0,minf(tail_elapsed/TAIL,1.0))
|
||||
var focus=g.orbit.base_focus()+saved_pan
|
||||
var offset=Vector3(sin(g.orbit.yaw)*cos(g.orbit.pitch),sin(g.orbit.pitch),cos(g.orbit.yaw)*cos(g.orbit.pitch))*30.0
|
||||
var destination=Transform3D(Basis.looking_at(-offset.normalized()),focus+offset)
|
||||
g.camera.global_transform=tail_transform.interpolate_with(destination,blend)
|
||||
g.camera.size=lerpf(4.6,saved_size,blend)
|
||||
if tail_elapsed>=TAIL:finish()
|
||||
else:
|
||||
var angle=g.orbit.yaw+TAU*minf(elapsed/(LEAD+RECORDING.get_length()),1.0)
|
||||
var target=g.player.global_position+Vector3(0,1.2,0)
|
||||
g.camera.global_position=target+Vector3(sin(angle)*3.5,1.0,cos(angle)*3.5)
|
||||
g.camera.look_at(target)
|
||||
g.camera.size=4.6
|
||||
g.architecture.update(g.camera)
|
||||
|
||||
func _voice_finished():
|
||||
if active and voice_started:
|
||||
tail_elapsed=0
|
||||
tail_transform=g.camera.global_transform
|
||||
|
||||
func suspend(value):
|
||||
suspended=value
|
||||
voice.stream_paused=value
|
||||
g.avatar.cinematic_idle=not value
|
||||
|
||||
func finish():
|
||||
_restore()
|
||||
g.paused=false
|
||||
g.hud.show()
|
||||
g.talk_clock=0
|
||||
|
||||
func cancel():
|
||||
if not active:return
|
||||
_restore()
|
||||
|
||||
func _restore():
|
||||
voice.stop();voice.stream_paused=false
|
||||
active=false;suspended=false
|
||||
g.avatar.cinematic_idle=false
|
||||
g.orbit.keys.clear()
|
||||
g.orbit.pan=saved_pan
|
||||
g.orbit.focus=g.orbit.base_focus()+saved_pan
|
||||
g.camera.size=saved_size
|
||||
g.orbit.update(0)
|
||||
@@ -0,0 +1,45 @@
|
||||
extends RefCounted
|
||||
|
||||
func run(g):
|
||||
AudioServer.set_bus_mute(0,true)
|
||||
g.start_game()
|
||||
g.intro.begin()
|
||||
var start=Time.get_ticks_msec()
|
||||
var position=g.player.position
|
||||
var coins=g.coins
|
||||
var camera_position=g.camera.position
|
||||
assert(g.paused and not g.hud.visible)
|
||||
await g.get_tree().create_timer(1.5).timeout
|
||||
assert(not g.intro.voice_started)
|
||||
assert(camera_position.distance_to(g.camera.position)>1)
|
||||
g.intro.suspend(true)
|
||||
var elapsed=g.intro.elapsed
|
||||
await g.get_tree().create_timer(.2).timeout
|
||||
assert(g.intro.elapsed==elapsed)
|
||||
g.intro.suspend(false)
|
||||
await g.get_tree().create_timer(.8).timeout
|
||||
assert(g.intro.voice_started and g.intro.voice.playing)
|
||||
await g.get_tree().process_frame
|
||||
g.get_viewport().get_texture().get_image().save_png("res://captures/intro-camera.png")
|
||||
for key in [KEY_F5,KEY_B,KEY_T,KEY_ESCAPE]:
|
||||
var event=InputEventKey.new();event.keycode=key;event.physical_keycode=key;event.pressed=true
|
||||
g._input(event);g._unhandled_input(event)
|
||||
assert(g.coins==coins and g.player.position==position)
|
||||
assert(not g.workshop.build_mode and not g.development.tree_panel.visible)
|
||||
while g.intro.tail_elapsed<0:
|
||||
assert(Time.get_ticks_msec()-start<22000)
|
||||
await g.get_tree().process_frame
|
||||
var end_of_voice=Time.get_ticks_msec()
|
||||
assert(g.intro.active and g.paused)
|
||||
await g.get_tree().create_timer(1.5).timeout
|
||||
assert(g.intro.active and g.paused)
|
||||
while g.intro.active:await g.get_tree().process_frame
|
||||
assert(Time.get_ticks_msec()-end_of_voice>=1950)
|
||||
assert(not g.paused and g.hud.visible and is_equal_approx(g.camera.size,20))
|
||||
assert(g.coins==coins and g.player.position==position)
|
||||
g.set_pause(true);g.start_game()
|
||||
assert(not g.intro.active)
|
||||
g.intro.begin();g.reset_shift()
|
||||
assert(not g.intro.active and not g.intro.voice.playing and not g.avatar.cinematic_idle)
|
||||
print("PASS: intro full recording, 2s lead/tail, input lock, camera restore, suspend, resume and reset (%d ms)" % (Time.get_ticks_msec()-start))
|
||||
g.get_tree().quit()
|
||||
@@ -49,6 +49,7 @@ var flames: Array = []
|
||||
var moving_gears: Array = []
|
||||
var wisps: Array = []
|
||||
var architecture = preload("res://endless.gd").new()
|
||||
var intro = preload("res://intro_cinematic.gd").new()
|
||||
var orbit = preload("res://orbit.gd").new()
|
||||
var dungeon = preload("res://dungeon.gd").new()
|
||||
var audio_player: AudioStreamPlayer
|
||||
@@ -85,7 +86,7 @@ var quips = ["Ещё один. Наверху сегодня скидки на
|
||||
|
||||
func _ready():
|
||||
var args=OS.get_cmdline_user_args()
|
||||
test_mode="--test-room-decor" in args or "--test-camera-controls" in args or "--test-rubies" in args or "--test-runtime-burn" in args or "--test-single-punishment" in args or "--test-expansion" in args or "--test-imps" in args or "--test-flight-camera" in args or "--test-maintenance" in args or "--test-castle" in args or "--test-building" in args or "--test-workflow" in args or "--test-roster" in args or "--test-priority" in args or "--test-mesh" in args or "--test-economy" in args or "--test-posture" in args or "--test-gait" in args or "--test-visuals" in args or "--test-mode" in args or "--test-exit" in args or "--test-ui" in args or "--test-audio" in args or "--test-sentences" in args or "--test-hud" in args
|
||||
test_mode="--test-intro" in args or "--test-room-decor" in args or "--test-camera-controls" in args or "--test-rubies" in args or "--test-runtime-burn" in args or "--test-single-punishment" in args or "--test-expansion" in args or "--test-imps" in args or "--test-flight-camera" in args or "--test-maintenance" in args or "--test-castle" in args or "--test-building" in args or "--test-workflow" in args or "--test-roster" in args or "--test-priority" in args or "--test-mesh" in args or "--test-economy" in args or "--test-posture" in args or "--test-gait" in args or "--test-visuals" in args or "--test-mode" in args or "--test-exit" in args or "--test-ui" in args or "--test-audio" in args or "--test-sentences" in args or "--test-hud" in args
|
||||
capture_mode="--capture-workflow" in args or "--capture-roster" in args or "--capture-economy" in args or "--capture-posture" in args or "--capture-gait" in args or "--capture" in args or "--capture-workshop" in args
|
||||
if FileAccess.file_exists("res://build_info.json"):
|
||||
var stamp=JSON.parse_string(FileAccess.get_file_as_string("res://build_info.json"))
|
||||
@@ -135,13 +136,16 @@ func _ready():
|
||||
workshop=preload("res://workshop.gd").new()
|
||||
add_child(workshop)
|
||||
workshop.setup(self)
|
||||
add_child(intro)
|
||||
intro.setup(self)
|
||||
if not test_mode and not capture_mode: ambience_player.play()
|
||||
paused=true
|
||||
hud.visible=false
|
||||
say("Первый день. Последняя надежда на отпуск.")
|
||||
refresh_ui()
|
||||
if automatic: build_auto_arm()
|
||||
if "--test-exit" in args: call_deferred("test_exit")
|
||||
if "--test-intro" in args:call_deferred("run_intro_tests")
|
||||
elif "--test-exit" in args: call_deferred("test_exit")
|
||||
elif "--test-audio" in args: call_deferred("run_audio_tests")
|
||||
elif "--test-ui" in args: call_deferred("run_ui_tests")
|
||||
elif "--test-room-decor" in args:call_deferred("run_room_decor_tests")
|
||||
@@ -304,6 +308,7 @@ func set_pause(value: bool):
|
||||
else: menu.show_page("")
|
||||
|
||||
func start_game():
|
||||
var new_shift=menu.current_page=="main" or not game_started
|
||||
if menu.current_page=="main":reset_shift()
|
||||
if not game_started:
|
||||
game_started=true
|
||||
@@ -313,9 +318,11 @@ func start_game():
|
||||
hud.visible=true
|
||||
set_pause(false)
|
||||
if workshop:workshop.message("240 золота на обустройство. [B] — строительство, [T] — развитие.");workshop.refresh()
|
||||
say("Новая смена. Обустрой свой цех.")
|
||||
if new_shift and not test_mode and not capture_mode:intro.begin()
|
||||
else:say("Новая смена. Обустрой свой цех.")
|
||||
|
||||
func reset_shift():
|
||||
intro.cancel()
|
||||
if workshop:workshop.reset()
|
||||
for soul in souls:
|
||||
if is_instance_valid(soul.node):soul.node.queue_free()
|
||||
@@ -341,6 +348,7 @@ func reset_shift():
|
||||
refresh_ui()
|
||||
|
||||
func return_to_main_menu():
|
||||
intro.cancel()
|
||||
set_pause(true)
|
||||
hud.visible=false
|
||||
menu.show_main()
|
||||
@@ -513,10 +521,14 @@ func floating(text: String, p: Vector3, c: Color):
|
||||
popups.append({"node":l,"ttl":1.15})
|
||||
|
||||
func _input(event):
|
||||
if intro.active:
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
if workshop:workshop.track_pointer(event)
|
||||
orbit.input(event)
|
||||
|
||||
func _unhandled_input(event):
|
||||
if intro.active:return
|
||||
if workshop and workshop.input(event):return
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
if event.keycode==KEY_F5 or event.physical_keycode==KEY_F5:
|
||||
@@ -554,6 +566,9 @@ func _process(delta):
|
||||
var dt=minf(delta,0.05)
|
||||
ambience_fade=minf(1.0,ambience_fade+delta/1.5)
|
||||
update_audio_levels()
|
||||
if intro.active:
|
||||
intro.update(delta)
|
||||
return
|
||||
time+=dt
|
||||
for gear in moving_gears: gear.rotation.z+=dt*0.65
|
||||
if workshop:
|
||||
@@ -689,6 +704,9 @@ func build_auto_arm():
|
||||
cylinder(self,STATION+Vector3(1.1,0.9,-0.5),0.15,1.8,Color("8c7186"))
|
||||
|
||||
func _notification(what):
|
||||
if is_instance_valid(intro) and intro.active and not test_mode and not capture_mode:
|
||||
if what==NOTIFICATION_APPLICATION_FOCUS_OUT:intro.suspend(true)
|
||||
elif what==NOTIFICATION_APPLICATION_FOCUS_IN:intro.suspend(false)
|
||||
if what==NOTIFICATION_APPLICATION_FOCUS_OUT:
|
||||
orbit.stop();orbit.keys.clear()
|
||||
if workshop and workshop.build_mode and (workshop.drag.active or workshop.drag.index>=0):workshop.cancel_placement()
|
||||
@@ -742,7 +760,7 @@ func update_audio_levels():
|
||||
if dialogue:dialogue.update()
|
||||
if voice_player:voice_player.volume_db=linear_to_db(maxf(voice_volume,0.0001))
|
||||
if audio_player: audio_player.volume_db=-3.0+linear_to_db(maxf(whip_volume,0.0001))
|
||||
if ambience_player: ambience_player.volume_db=linear_to_db(maxf(ambience_volume*ambience_fade,0.0001))
|
||||
if ambience_player: ambience_player.volume_db=linear_to_db(maxf(ambience_volume*ambience_fade*(.25 if intro.active else 1.0),0.0001))
|
||||
|
||||
func save_settings():
|
||||
if test_mode or capture_mode: return
|
||||
@@ -990,3 +1008,6 @@ func run_camera_controls_tests():
|
||||
|
||||
func run_room_decor_tests():
|
||||
await preload("res://room_decor_tests.gd").new().run(self)
|
||||
|
||||
func run_intro_tests():
|
||||
await preload("res://intro_tests.gd").new().run(self)
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# Предварительный комплект суккубы — на согласование
|
||||
|
||||
Этот первый образец сохранён для истории. После его подготовки пользователь
|
||||
дал новый основной референс с трёх сторон: чёрный комплект, высокий хвост волос
|
||||
и низкие коричневые крылья. Красный комплект не был утверждён.
|
||||
|
||||
Статус: образец для выбора, в основной игре пока остаётся `succubus_v02.glb`
|
||||
и прежняя походка. Новые модели, движения и параметры включены только в этой
|
||||
отдельной сцене. Общая модель используется героиней и помощницами после согласования.
|
||||
|
||||
- Чёрные ботфорты: острый носок, широкий высокий каблук со скошенными гранями,
|
||||
отдельная изогнутая подошва с просветом под сводом. Обувь жёстко привязана
|
||||
к стопе, исключён изгиб вместе с костями пальцев.
|
||||
- Суставы стоп подняты на 8 см в координатах модели, обновлены inverse bind
|
||||
matrices и трансляции в исходных клипах. Сустав соответствует поднятой пятке,
|
||||
а не старой босой стопе. Ходьба использует более короткий шаг, отдельные
|
||||
дорожки ног и ограничение поворота опорной стопы до 22° относительно таза.
|
||||
- Красный кожаный корсет: фигурный верх/низ, воротник с кольцами спереди и
|
||||
пряжками сзади, ремни, пояс, задняя шнуровка, небольшие наплечники-крылья.
|
||||
Края материалов разрезаны по треугольникам, вместо назначения целых граней.
|
||||
- Большие крылья: изогнутые рёбра, провисающая бордовая перепонка, гладкие
|
||||
нормали. Привязаны к имеющимся независимым `Wing.L/R`. При ходьбе вторичное
|
||||
покачивание около 2,3° с задержкой; при остановке оно затухает.
|
||||
|
||||
GIF: `walking.gif` — ходьба, поворот и остановка; `boots.gif` — обувь сбоку;
|
||||
`outfit.gif` — обзор спереди и сзади. Это рендер настоящей 3D-модели в Godot.
|
||||
|
||||
Воспроизведение из корня репозитория (Python с NumPy, Godot 4.3):
|
||||
|
||||
```powershell
|
||||
python tools/preview_succubus_heels.py
|
||||
godot --headless --editor --path Demon_v0.19 --import
|
||||
godot --path Demon_v0.19 --script res://reviews/heels_v01/review_tests.gd
|
||||
godot --path Demon_v0.19 res://reviews/heels_v01/review.tscn
|
||||
python tools/encode_succubus_review.py --ffmpeg PATH_TO_FFMPEG
|
||||
```
|
||||
|
||||
Проверены размеры героини/помощницы, четыре скорости, 30/60 fps, поворот на 90°,
|
||||
остановка, контакт с полом, достижимость IK и ограничение разворота стопы.
|
||||
Регрессия основной походки: героиня и три помощницы, пять скоростей, повороты,
|
||||
остановки, плеть, пауза и телепорт. Все проверки проходят. При импорте остаётся
|
||||
предупреждение о вырожденной нормали при генерации LOD у исходной геометрии.
|
||||
|
After Width: | Height: | Size: 4.6 MiB |
|
After Width: | Height: | Size: 11 MiB |
@@ -0,0 +1,80 @@
|
||||
extends Node3D
|
||||
var paused=false
|
||||
var actors=[]
|
||||
var camera: Camera3D
|
||||
var folder="res://captures/heels-v01"
|
||||
var max_yaw=0.0
|
||||
var max_error=0.0
|
||||
var headers=[]
|
||||
|
||||
func _ready():call_deferred("run")
|
||||
func block(at,size,color):
|
||||
var node=MeshInstance3D.new();add_child(node);node.position=at
|
||||
node.mesh=BoxMesh.new();node.mesh.size=size
|
||||
var mat=StandardMaterial3D.new();mat.albedo_color=color;mat.roughness=.75;node.material_override=mat
|
||||
return node
|
||||
func lighting():
|
||||
var world=WorldEnvironment.new();add_child(world);world.environment=Environment.new()
|
||||
world.environment.background_mode=Environment.BG_COLOR;world.environment.background_color=Color("282d34")
|
||||
world.environment.ambient_light_source=Environment.AMBIENT_SOURCE_COLOR;world.environment.ambient_light_color=Color("b6c6d7");world.environment.ambient_light_energy=.65
|
||||
world.environment.tonemap_mode=Environment.TONE_MAPPER_FILMIC
|
||||
for at in [Vector3(-4,6,5),Vector3(5,4,-3)]:
|
||||
var light=OmniLight3D.new();add_child(light);light.position=at;light.light_energy=4;light.omni_range=24;light.shadow_enabled=true
|
||||
block(Vector3(0,-.08,12),Vector3(80,.15,80),Color("41464d"))
|
||||
camera=Camera3D.new();add_child(camera);camera.projection=Camera3D.PROJECTION_ORTHOGONAL;camera.current=true
|
||||
var layer=CanvasLayer.new();add_child(layer)
|
||||
for i in range(2):
|
||||
var label=Label.new();layer.add_child(label);label.text="СЕЙЧАС" if i==0 else "КАБЛУКИ · ОБРАЗЕЦ"
|
||||
label.position=Vector2(260+i*770,32);label.add_theme_font_size_override("font_size",28)
|
||||
headers.append(label)
|
||||
|
||||
func create_actors():
|
||||
for i in range(2):
|
||||
var carrier=Node3D.new();add_child(carrier);carrier.position=Vector3(-1.1+i*2.2,0,0)
|
||||
var actor=preload("res://succubus_actor.gd").new(preload("res://reviews/heels_v01/succubus_heels.glb") if i==1 else null)
|
||||
carrier.add_child(actor);actor.rotation=Vector3.ZERO
|
||||
if i==1:actor.gait=preload("res://reviews/heels_v01/review_gait.gd").new()
|
||||
actor.configure(self);actor.set_process(false);actors.append(actor)
|
||||
|
||||
func advance(dt,direction,speed):
|
||||
for actor in actors:
|
||||
actor.get_parent().position+=direction*speed*dt
|
||||
if direction.length_squared()>.1:actor.rotation.y=lerp_angle(actor.rotation.y,atan2(direction.x,direction.z),minf(1,dt*10))
|
||||
actor._process(dt)
|
||||
for f in actors[1].gait.feet:
|
||||
max_yaw=maxf(max_yaw,absf(wrapf(f.yaw-actors[1].global_rotation.y,-PI,PI)))
|
||||
max_error=maxf(max_error,actors[1].gait.point("foot."+f.side).distance_to(f.target))
|
||||
|
||||
func reset():
|
||||
for i in range(actors.size()):
|
||||
var actor=actors[i];actor.restore_animation_pose();actor.get_parent().position=Vector3(-1.1+i*2.2,0,0);actor.rotation=Vector3.ZERO;actor.reset_gait()
|
||||
|
||||
func shot(name,close=false):
|
||||
var focus=actors[1].get_parent().position+Vector3(0,.57 if close else 1.28,0)
|
||||
camera.size=1.65 if close else 3.15;camera.position=focus+(Vector3(5,.7,2.1) if close else Vector3(2.2,1.0,7));camera.look_at(focus)
|
||||
await RenderingServer.frame_post_draw
|
||||
var error=get_viewport().get_texture().get_image().save_png(folder+"/"+name+".png")
|
||||
assert(error==OK)
|
||||
|
||||
func run():
|
||||
DirAccess.make_dir_recursive_absolute(folder+"/full");DirAccess.make_dir_recursive_absolute(folder+"/feet");DirAccess.make_dir_recursive_absolute(folder+"/outfit")
|
||||
lighting();create_actors();await get_tree().process_frame
|
||||
actors[0].get_parent().hide();headers[0].hide();headers[1].position=Vector2(320,32);headers[1].text="ОБРАЗЕЦ · КРАСНЫЙ КОРСЕТ / ЧЁРНЫЕ БОТФОРТЫ"
|
||||
for frame in range(72):
|
||||
var direction=Vector3.BACK if frame<48 else Vector3(0.7,0,.7).normalized()
|
||||
advance(1.0/24,direction,2.5 if frame<60 else 0)
|
||||
await shot("full/%03d"%frame)
|
||||
reset()
|
||||
actors[0].get_parent().hide();headers[0].hide();headers[1].position=Vector2(500,32);headers[1].text="КАБЛУКИ · КРУПНЫЙ ПЛАН"
|
||||
for frame in range(48):
|
||||
advance(1.0/24,Vector3.BACK,2.5)
|
||||
await shot("feet/%03d"%frame,true)
|
||||
reset();headers[1].position=Vector2(410,32);headers[1].text="КОРСЕТ И КРЫЛЬЯ · ВИД СПЕРЕДИ И СЗАДИ"
|
||||
for frame in range(96):
|
||||
advance(1.0/24,Vector3.ZERO,0)
|
||||
var focus=actors[1].get_parent().position+Vector3(0,1.52,0);var angle=TAU*frame/96
|
||||
camera.size=1.95;camera.position=focus+Vector3(sin(angle)*5,.45,cos(angle)*5);camera.look_at(focus)
|
||||
await RenderingServer.frame_post_draw
|
||||
get_viewport().get_texture().get_image().save_png(folder+"/outfit/%03d.png"%frame)
|
||||
print("HEELS REVIEW METRICS ",JSON.stringify({"max_heading_twist_degrees":rad_to_deg(max_yaw),"max_ankle_target_error":max_error,"production_model_unchanged":true}))
|
||||
get_tree().quit()
|
||||
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://reviews/heels_v01/review.gd" id="1"]
|
||||
|
||||
[node name="HeelsApprovalStudio" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
@@ -0,0 +1,29 @@
|
||||
extends "res://catwalk.gd"
|
||||
# Approval-only settings: the default heroine and helpers still use catwalk.gd.
|
||||
func _init():
|
||||
stride_min=.95;stride_max=1.28;track_width=.09;swing_height=.11
|
||||
|
||||
func ground_height(f):return super.ground_height(f)-.016*actor.global_basis.get_scale().y
|
||||
|
||||
func update(dt):
|
||||
super.update(dt)
|
||||
# Secondary motion follows the travelled step cycle with a small phase delay.
|
||||
# Both wing roots remain attached to the upper back; no active flight flaps.
|
||||
for side in ["L","R"]:
|
||||
var sign_x=1 if side=="L" else -1
|
||||
rotate_world("Wing."+side,actor.global_basis.y,sign_x*sin(phase*TAU-.7)*.035*walk_weight)
|
||||
rotate_world("Wing."+side,actor.global_basis.z,sign_x*sin(phase*TAU*2-.5)*.022*walk_weight)
|
||||
|
||||
func foot_orientation(f,dt):
|
||||
var body_yaw=actor.global_rotation.y
|
||||
# The planted shoe may pivot, but the ankle must never remain twisted behind
|
||||
# a turning shin. Keep its heading within an anatomical range of the pelvis.
|
||||
var difference=wrapf(f.yaw-body_yaw,-PI,PI)
|
||||
if absf(difference)>deg_to_rad(22):f.yaw=body_yaw+clampf(difference,-deg_to_rad(22),deg_to_rad(22))
|
||||
var yaw=f.yaw if f.grounded else lerp_angle(f.yaw,body_yaw,minf(1,dt*18))
|
||||
if not f.grounded:f.yaw=yaw
|
||||
var orientation=Quaternion(Vector3.UP,yaw)*f.rotation
|
||||
# A high heel has a rigid arch. Lift the whole shoe with the leg rather than
|
||||
# sharply flexing its toe or rolling it onto the outer edge during swing.
|
||||
var roll=sin(clampf((f.last_phase-.5)*2,0,1)*PI)*-.045 if not f.grounded else 0.0
|
||||
return Quaternion(actor.global_basis.x.normalized(),roll)*orientation
|
||||
@@ -0,0 +1,33 @@
|
||||
extends SceneTree
|
||||
var failures=[]
|
||||
func _initialize():call_deferred("run")
|
||||
func check(ok,label):
|
||||
if not ok and not label in failures:failures.append(label);push_error("HEEL REVIEW QA: "+label)
|
||||
func run():
|
||||
var max_error=0.0;var max_twist=0.0;var max_wing=0.0
|
||||
for scale_y in [1.0,.82]:
|
||||
var carrier=Node3D.new();root.add_child(carrier)
|
||||
var actor=preload("res://succubus_actor.gd").new(preload("res://reviews/heels_v01/succubus_heels.glb"));carrier.add_child(actor);actor.scale=Vector3.ONE*scale_y;actor.rotation=Vector3.ZERO
|
||||
actor.gait=preload("res://reviews/heels_v01/review_gait.gd").new();actor.configure(self);actor.set_process(false)
|
||||
for speed in [1.0,2.5,3.3,5.775]:
|
||||
for fps in [30,60]:
|
||||
actor.restore_animation_pose();carrier.position=Vector3.ZERO;actor.rotation=Vector3.ZERO;actor.reset_gait()
|
||||
for frame in range(fps*3):
|
||||
var direction=Vector3.BACK if frame<fps else Vector3.RIGHT
|
||||
carrier.position+=direction*speed/fps;actor.rotation.y=lerp_angle(actor.rotation.y,atan2(direction.x,direction.z),minf(1,10.0/fps));actor._process(1.0/fps)
|
||||
for f in actor.gait.feet:
|
||||
max_error=maxf(max_error,actor.gait.point("foot."+f.side).distance_to(f.target))
|
||||
max_twist=maxf(max_twist,absf(wrapf(f.yaw-actor.global_rotation.y,-PI,PI)))
|
||||
check(actor.gait.point("foot."+f.side).y>=actor.gait.ground_height(f)-.003,"ankles above floor")
|
||||
var wi=actor.skeleton.find_bone("Wing.L");var wing=actor.skeleton.get_bone_pose_rotation(wi)
|
||||
max_wing=maxf(max_wing,wing.angle_to(actor.animation_pose[wi].basis.get_rotation_quaternion()))
|
||||
for frame in range(fps):actor._process(1.0/fps)
|
||||
for f in actor.gait.feet:check(f.grounded,"stopping settles both shoes")
|
||||
check(actor.gait.track_width>.065,"separate paths keep wide heels apart")
|
||||
carrier.queue_free();await process_frame
|
||||
check(max_error<.005,"IK reaches both shoes at both scales and four speeds")
|
||||
check(max_twist<=deg_to_rad(22.01),"ankle heading never twists more than 22 degrees")
|
||||
check(max_wing>.01 and max_wing<.10,"wings sway gently instead of active flapping")
|
||||
print("HEEL REVIEW METRICS ",JSON.stringify({"max_ik_error":max_error,"max_heading_twist_degrees":rad_to_deg(max_twist),"max_wing_pose_angle":max_wing,"failures":failures}))
|
||||
if failures.is_empty():print("ALL HEEL REVIEW TESTS PASSED: heroine/helper scales, four speeds, two frame rates, right-angle turns, stop, reach and ankle heading")
|
||||
quit(0 if failures.is_empty() else 1)
|
||||
@@ -0,0 +1,36 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b40ohu0qjf1kh"
|
||||
path="res://.godot/imported/succubus_heels.glb-400939aa4ad09f07f701f179acd4c508.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/heels_v01/succubus_heels.glb"
|
||||
dest_files=["res://.godot/imported/succubus_heels.glb-400939aa4ad09f07f701f179acd4c508.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
|
After Width: | Height: | Size: 6.3 MiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dwi03n3bee5by"
|
||||
path="res://.godot/imported/succubus_heels_skin_basecolor.png-7e90812c18107351d58bd3920434c30d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "6c375995b2643c42ccbe28db0302aae3"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/heels_v01/succubus_heels_skin_basecolor.png"
|
||||
dest_files=["res://.godot/imported/succubus_heels_skin_basecolor.png-7e90812c18107351d58bd3920434c30d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 6.5 MiB |
@@ -0,0 +1,81 @@
|
||||
# INFERNAL — STL-образец на согласование
|
||||
|
||||
Основа — предоставленная пользователем `infernal.zip`; исходная сетка сохранена
|
||||
без изменений в `tools/model_sources/infernal.stl`. Покраска по переданной схеме:
|
||||
красная кожа, чёрные волосы, корсет, сапоги, рога, крылья и хвост. STL не содержал
|
||||
цветов, UV или скелета: материалы и UV подготовлены заново.
|
||||
|
||||
Модель **согласована и подключена** к героине и помощницам. Игровая копия:
|
||||
`art/succubus/infernal_v01/infernal_game.glb`, походка — `infernal_gait.gd`.
|
||||
Игровая копия GLB идентична этому образцу. Старый succubus_v02 сохранён.
|
||||
|
||||
## Содержимое
|
||||
|
||||
- `infernal_game.glb`: 45 493 вершины / 90 801 треугольник тела, 166 костей,
|
||||
Idle / Walk / Whip; дополнительный хлыст со старыми анимированными формами.
|
||||
- `infernal_basecolor.png`, `infernal_normal.png`, `infernal_orm.png`: 4096×4096,
|
||||
материалы и детали исходного скульпта; всё также встроено в GLB.
|
||||
- `walking.gif`: 6 секунд, ходьба, поворот и остановка.
|
||||
- `turntable.gif`: 5 секунд, полный оборот, лёгкие движения крыльев и хвоста.
|
||||
- `whip.gif`: 4 секунды, перенесённый удар; радиус шнура увеличен на 8 мм
|
||||
в координатах модели, сохранены старые волны хлыста.
|
||||
- `face.gif`: 3 секунды, лицо крупным планом.
|
||||
- `manifest.json`, `validation.json`: фактические параметры и результаты QA.
|
||||
- `review.tscn`: отдельная сцена Godot для просмотра и записи кадров.
|
||||
- `tools/model_sources/infernal_game.blend`: редактируемая игровая сетка,
|
||||
скелет, анимации и упакованные текстуры. Исходный STL и схема покраски рядом.
|
||||
|
||||
## Исправления
|
||||
|
||||
Подставка срезана на 0,150 м исходной нормализованной модели, подошвы закрыты.
|
||||
Контакты рук с одеждой отделены и очищены. Соединённые при печати ботинки
|
||||
разрезаны и закрыты по отдельности; у каждой стопы собственная жёсткая привязка.
|
||||
Плечи, локти и запястья подогнаны к скульпту. Idle, Walk и Whip перенесены
|
||||
с предыдущего скелета относительно его позы Idle.
|
||||
|
||||
В образце используется прежняя походка с коротким шагом, раздельными дорожками
|
||||
для обуви, фиксацией опорной стопы и разворотом до 22°. Крылья покачиваются
|
||||
без активных взмахов; хвост и крылья сохраняют слабое движение в покое.
|
||||
|
||||
Границы корсета, фигурного подола, воротника и сапог обведены по рельефу
|
||||
исходной сетки, включая переданную пользователем оранжевую обводку
|
||||
`tools/model_sources/approved_paint_boundary.png`. Контуры хранятся в
|
||||
`tools/infernal_seams.py`; проекция учитывает глубину и скрытую изнанку складок.
|
||||
Крупные планы — paint-front/hem/boots/back.png.
|
||||
|
||||
Исправлены координаты глаз/губ и граница воротника. Открытые руки используют
|
||||
отдельный материал кожи, чтобы при близких поверхностях в них не запекалась
|
||||
чёрная одежда. Карта нормалей сохраняет нейтральную нормаль для пустых лучей.
|
||||
|
||||
## Проверки
|
||||
|
||||
Godot 4.3: импорт PASS; `review_tests.gd` PASS — два масштаба, четыре скорости,
|
||||
30/60 fps, поворот на 90°, остановка, контакт с полом. Ошибка IK <0,000003 м,
|
||||
разворот стоп ≤22°, углы крыльев <0,05 рад, хвоста <0,013 рад.
|
||||
|
||||
Blender: `validate_infernal.py` PASS — три клипа, нормализованные веса,
|
||||
конечные координаты, отсутствие подставки, защищённый материал рук, три карты
|
||||
4K. Проверяются кадры клипов с шагом 4; максимальный прирост ребра: Idle
|
||||
0,00234 м, Walk 0,03596 м, Whip 0,06717 м. Результаты — в validation.json.
|
||||
|
||||
GIF сняты с настоящей 3D-модели в Godot, 24 fps. Это образец для визуального
|
||||
согласования покраски, пропорций и движений. После согласования включена
|
||||
идентичная игровая копия. Генератор по-прежнему пишет новый кандидат в reviews;
|
||||
при дальнейшей переработке игровую копию обновлять после проверки.
|
||||
|
||||
## Воспроизведение
|
||||
|
||||
Из корня репозитория, Blender 5.0.1 / Godot 4.3 / FFmpeg:
|
||||
|
||||
```powershell
|
||||
& 'C:/Program Files/Blender Foundation/Blender 5.0/blender.exe' --background --python-exit-code 1 --python tools/build_infernal.py -- --bake
|
||||
& 'C:/Program Files/Blender Foundation/Blender 5.0/blender.exe' --background --python-exit-code 1 --python tools/validate_infernal.py
|
||||
& $godot --headless --editor --path Demon_v0.19 --import --quit
|
||||
& $godot --path Demon_v0.19 --script res://reviews/infernal_v01/review_tests.gd
|
||||
& $godot --path Demon_v0.19 --resolution 1280x900 res://reviews/infernal_v01/review.tscn
|
||||
& $python tools/encode_infernal_review.py --ffmpeg $ffmpeg
|
||||
```
|
||||
|
||||
`finish_infernal.py` позволяет повторить покраску из локального checkpoint,
|
||||
созданного build_infernal.py в игнорируемом captures. Для чистого клона
|
||||
использовать полный build с `--bake`. Большие STL/BLEND/GLB хранятся в Git LFS.
|
||||
|
After Width: | Height: | Size: 2.7 MiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://h11gmfuc3yid"
|
||||
path="res://.godot/imported/infernal_basecolor.png-350d9c43584265a4600dd1c2f5d415d2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/infernal_basecolor.png"
|
||||
dest_files=["res://.godot/imported/infernal_basecolor.png-350d9c43584265a4600dd1c2f5d415d2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,2 @@
|
||||
extends "res://infernal_gait.gd"
|
||||
# The approval studio uses the same gait as the live heroine and helpers.
|
||||
@@ -0,0 +1,36 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://dnwqqu4x1yixr"
|
||||
path="res://.godot/imported/infernal_game.glb-6448dfcc6ac429989645a3e78a7b85df.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/infernal_game.glb"
|
||||
dest_files=["res://.godot/imported/infernal_game.glb-6448dfcc6ac429989645a3e78a7b85df.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
|
After Width: | Height: | Size: 2.7 MiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c2y84kbnraj7y"
|
||||
path="res://.godot/imported/infernal_game_infernal_basecolor.png-34717ecb9e7b45d91a837b43ba01b8bd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "ec06996f35d03b5dff4ef74214143a93"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/infernal_game_infernal_basecolor.png"
|
||||
dest_files=["res://.godot/imported/infernal_game_infernal_basecolor.png-34717ecb9e7b45d91a837b43ba01b8bd.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 7.0 MiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://iafy125bmvbe"
|
||||
path="res://.godot/imported/infernal_game_infernal_normal.png-c2c19f73bb1372ea42fa568379419c76.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "1fd5b6ab6d56b8a97cd3149923cfd9b1"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/infernal_game_infernal_normal.png"
|
||||
dest_files=["res://.godot/imported/infernal_game_infernal_normal.png-c2c19f73bb1372ea42fa568379419c76.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 2.8 MiB |
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://8x13rikdlqpq"
|
||||
path="res://.godot/imported/infernal_game_infernal_orm.png-e6dc5617699cdf651dbb650ff9bbb2c5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
generator_parameters={
|
||||
"md5": "e403e04738838a82a634d99ad78bcb53"
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/infernal_game_infernal_orm.png"
|
||||
dest_files=["res://.godot/imported/infernal_game_infernal_orm.png-e6dc5617699cdf651dbb650ff9bbb2c5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 7.0 MiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://i1dvwa6ay77q"
|
||||
path="res://.godot/imported/infernal_normal.png-7a0a668238a6788bfc68b37824ded72f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/infernal_normal.png"
|
||||
dest_files=["res://.godot/imported/infernal_normal.png-7a0a668238a6788bfc68b37824ded72f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 2.8 MiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://sbsfb7x1x01q"
|
||||
path="res://.godot/imported/infernal_orm.png-8c10a8117721c2a05d861c9d6b1776fd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/infernal_orm.png"
|
||||
dest_files=["res://.godot/imported/infernal_orm.png-8c10a8117721c2a05d861c9d6b1776fd.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"source_triangles": 1569740,
|
||||
"source_after_pedestal_cut": 1402834,
|
||||
"game_vertices": 45493,
|
||||
"game_triangles": 90801,
|
||||
"bones": 166,
|
||||
"clips": {
|
||||
"Idle": 73,
|
||||
"Walk": 33,
|
||||
"Whip": 65
|
||||
},
|
||||
"pedestal_removed": true,
|
||||
"cut_height": 0.15,
|
||||
"textures_4k": true,
|
||||
"animated_whip": true,
|
||||
"facial_paint": "aligned to sculpt: eyes z1.889, lips z1.817",
|
||||
"paint_boundary_reference": "tools/model_sources/approved_paint_boundary.png",
|
||||
"whip_radius_added_m": 0.008,
|
||||
"approval_status": "approved_and_enabled",
|
||||
"runtime_model": "res://art/succubus/infernal_v01/infernal_game.glb",
|
||||
"runtime_gait": "res://infernal_gait.gd"
|
||||
}
|
||||
|
After Width: | Height: | Size: 696 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://blesb51kvusas"
|
||||
path="res://.godot/imported/paint-back.png-a9ecbf6915faebfe58909fd12c6363ce.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/paint-back.png"
|
||||
dest_files=["res://.godot/imported/paint-back.png-a9ecbf6915faebfe58909fd12c6363ce.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 295 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://06tag3t032oa"
|
||||
path="res://.godot/imported/paint-boots.png-6d85a81d17c643f0e201c560d04ba238.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/paint-boots.png"
|
||||
dest_files=["res://.godot/imported/paint-boots.png-6d85a81d17c643f0e201c560d04ba238.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 585 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cim7cnd0p0uh4"
|
||||
path="res://.godot/imported/paint-face.png-144ee864f8e0242f5f2ebb3984669832.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/paint-face.png"
|
||||
dest_files=["res://.godot/imported/paint-face.png-144ee864f8e0242f5f2ebb3984669832.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 680 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dwn1rr45e0eqt"
|
||||
path="res://.godot/imported/paint-front.png-69e7570935f7f102d4b9601a605accad.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/paint-front.png"
|
||||
dest_files=["res://.godot/imported/paint-front.png-69e7570935f7f102d4b9601a605accad.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 556 KiB |
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ch4ecfxchsjc6"
|
||||
path="res://.godot/imported/paint-hem.png-4928b89f31d8671d9797b385ca440e97.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://reviews/infernal_v01/paint-hem.png"
|
||||
dest_files=["res://.godot/imported/paint-hem.png-4928b89f31d8671d9797b385ca440e97.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -0,0 +1,87 @@
|
||||
extends Node3D
|
||||
var paused=false
|
||||
var actor
|
||||
var carrier
|
||||
var camera: Camera3D
|
||||
var heading: Label
|
||||
var folder="res://captures/infernal"
|
||||
var max_error=0.0
|
||||
var max_yaw=0.0
|
||||
|
||||
func _ready():call_deferred("run")
|
||||
|
||||
func setup_studio():
|
||||
var world=WorldEnvironment.new();add_child(world);world.environment=Environment.new()
|
||||
world.environment.background_mode=Environment.BG_COLOR;world.environment.background_color=Color("242932")
|
||||
world.environment.ambient_light_source=Environment.AMBIENT_SOURCE_COLOR;world.environment.ambient_light_color=Color("d1d9e5");world.environment.ambient_light_energy=.7
|
||||
world.environment.tonemap_mode=Environment.TONE_MAPPER_FILMIC
|
||||
for at in [Vector3(-3,5,5),Vector3(4,3,2),Vector3(0,4,-4)]:
|
||||
var light=OmniLight3D.new();add_child(light);light.position=at;light.light_energy=3.5;light.omni_range=30;light.shadow_enabled=true
|
||||
var floor_node=MeshInstance3D.new();add_child(floor_node);floor_node.mesh=BoxMesh.new();floor_node.mesh.size=Vector3(80,.08,80);floor_node.position=Vector3(0,-.045,10)
|
||||
var material=StandardMaterial3D.new();material.albedo_color=Color("454b55");material.roughness=.85;floor_node.material_override=material
|
||||
camera=Camera3D.new();add_child(camera);camera.projection=Camera3D.PROJECTION_ORTHOGONAL;camera.current=true
|
||||
var layer=CanvasLayer.new();add_child(layer);heading=Label.new();layer.add_child(heading);heading.position=Vector2(30,22);heading.add_theme_font_size_override("font_size",24)
|
||||
carrier=Node3D.new();add_child(carrier)
|
||||
actor=preload("res://succubus_actor.gd").new(preload("res://reviews/infernal_v01/infernal_game.glb"));carrier.add_child(actor);actor.rotation=Vector3.ZERO
|
||||
actor.gait=preload("res://reviews/infernal_v01/infernal_gait.gd").new();actor.configure(self);actor.set_process(false)
|
||||
|
||||
func advance(direction,speed):
|
||||
carrier.position+=direction*speed/24.0
|
||||
if direction.length_squared()>.1:actor.rotation.y=lerp_angle(actor.rotation.y,atan2(direction.x,direction.z),10.0/24)
|
||||
actor._process(1.0/24)
|
||||
for foot in actor.gait.feet:
|
||||
max_error=maxf(max_error,actor.gait.point("foot."+foot.side).distance_to(foot.target))
|
||||
max_yaw=maxf(max_yaw,absf(wrapf(foot.yaw-actor.global_rotation.y,-PI,PI)))
|
||||
|
||||
func reset():
|
||||
actor.restore_animation_pose();carrier.position=Vector3.ZERO;actor.rotation=Vector3.ZERO;actor.striking=false;actor.animator.play(actor.clips["Idle"],0.0,1.0);actor.animator.seek(0,true);actor.remember_animation_pose();actor.reset_gait()
|
||||
|
||||
func save_frame(sequence,frame):
|
||||
await RenderingServer.frame_post_draw
|
||||
assert(get_viewport().get_texture().get_image().save_png(folder+"/"+sequence+"/%03d.png"%frame)==OK)
|
||||
|
||||
func run():
|
||||
for sequence in ["full","outfit","action","portrait"]:DirAccess.make_dir_recursive_absolute(folder+"/"+sequence)
|
||||
setup_studio();await get_tree().process_frame
|
||||
if "--qa-stills" in OS.get_cmdline_user_args():
|
||||
DirAccess.make_dir_recursive_absolute(folder+"/still")
|
||||
for index in range(4):
|
||||
advance(Vector3.ZERO,0)
|
||||
var angle=index*PI/2;var focus=Vector3(0,1.25,0);camera.size=3.0;camera.position=focus+Vector3(sin(angle)*5,.25,cos(angle)*5);camera.look_at(focus)
|
||||
heading.text="ПОКРАСКА · ПРОВЕРКА СТОРОН";await save_frame("still",index)
|
||||
var focus=Vector3(0,2.1,0);camera.size=.92;camera.position=focus+Vector3(0,.07,5);camera.look_at(focus)
|
||||
heading.text="ЛИЦО · ПРОВЕРКА ПОКРАСКИ";await save_frame("still",4)
|
||||
actor.strike(1.8)
|
||||
for frame in range(24):advance(Vector3.ZERO,0)
|
||||
focus=Vector3(0,1.25,0);camera.size=3.15;camera.position=focus+Vector3(2,.6,7);camera.look_at(focus)
|
||||
heading.text="WHIP · ПРОВЕРКА";await save_frame("still",5)
|
||||
reset()
|
||||
for detail in [[6,1.56,1.15,0.0,"КОРСЕТ И ВОРОТНИК · ПО ЛИНИЯМ СКУЛЬПТА"],[7,1.32,.70,0.0,"НИЖНЯЯ КРОМКА КОРСЕТА"],[8,.32,.80,0.0,"САПОГИ · КРАЙ ПО ОБОДКУ"],[9,1.56,1.15,PI,"КОРСЕТ · ВИД СЗАДИ"]]:
|
||||
advance(Vector3.ZERO,0)
|
||||
var detail_focus=Vector3(0,detail[1],0);camera.size=detail[2];camera.position=detail_focus+Vector3(sin(detail[3])*5,.02,cos(detail[3])*5);camera.look_at(detail_focus)
|
||||
heading.text=detail[4];await save_frame("still",detail[0])
|
||||
get_tree().quit();return
|
||||
heading.text="INFERNAL / STL · ХОДЬБА, ПОВОРОТ И ОСТАНОВКА"
|
||||
for frame in range(144):
|
||||
var direction=Vector3.BACK if frame<72 else Vector3(.7,0,.7).normalized()
|
||||
advance(direction,2.5 if frame<110 else 0)
|
||||
var focus=carrier.position+Vector3(0,1.25,0);camera.size=3.15;camera.position=focus+Vector3(2.0,.7,7);camera.look_at(focus)
|
||||
await save_frame("full",frame)
|
||||
reset();heading.text="ПОКРАСКА · КРАСНАЯ КОЖА / ЧЁРНЫЙ КОМПЛЕКТ"
|
||||
for frame in range(120):
|
||||
advance(Vector3.ZERO,0)
|
||||
var focus=Vector3(0,1.25,0);var angle=TAU*frame/120;camera.size=3.0;camera.position=focus+Vector3(sin(angle)*5,.25,cos(angle)*5);camera.look_at(focus)
|
||||
await save_frame("outfit",frame)
|
||||
reset();heading.text="ПЕРЕНОС АНИМАЦИИ · WHIP"
|
||||
for frame in range(96):
|
||||
if frame==12:actor.strike(1.8)
|
||||
advance(Vector3.ZERO,0)
|
||||
var focus=Vector3(0,1.25,0);camera.size=3.15;camera.position=focus+Vector3(2,.6,7);camera.look_at(focus)
|
||||
await save_frame("action",frame)
|
||||
reset();heading.text="ЛИЦО · КРУПНЫЙ ПЛАН"
|
||||
for frame in range(72):
|
||||
advance(Vector3.ZERO,0)
|
||||
var focus=Vector3(0,2.10,0);var angle=sin(TAU*frame/72)*.22;camera.size=.92;camera.position=focus+Vector3(sin(angle)*5,.07,cos(angle)*5);camera.look_at(focus)
|
||||
await save_frame("portrait",frame)
|
||||
print("INFERNAL REVIEW METRICS ",JSON.stringify({"max_ik_error":max_error,"max_ankle_twist_degrees":rad_to_deg(max_yaw)}))
|
||||
get_tree().quit()
|
||||
@@ -0,0 +1,4 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
[ext_resource type="Script" path="res://reviews/infernal_v01/review.gd" id="1"]
|
||||
[node name="InfernalApprovalStudio" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
@@ -0,0 +1,37 @@
|
||||
extends SceneTree
|
||||
var failures=[]
|
||||
func _initialize():call_deferred("run")
|
||||
func check(ok,label):
|
||||
if not ok and not label in failures:failures.append(label);push_error("INFERNAL REVIEW QA: "+label)
|
||||
func run():
|
||||
var max_error=0.0;var max_twist=0.0;var max_wing=0.0;var max_tail=0.0
|
||||
for scale_y in [1.0,.82]:
|
||||
var carrier=Node3D.new();root.add_child(carrier)
|
||||
var actor=preload("res://succubus_actor.gd").new(preload("res://reviews/infernal_v01/infernal_game.glb"));carrier.add_child(actor);actor.scale=Vector3.ONE*scale_y;actor.rotation=Vector3.ZERO
|
||||
check(actor.clips.has("Idle") and actor.clips.has("Walk") and actor.clips.has("Whip"),"all three transferred animations imported")
|
||||
actor.gait=preload("res://reviews/infernal_v01/infernal_gait.gd").new();actor.configure(self);actor.set_process(false)
|
||||
for speed in [1.0,2.5,3.3,5.775]:
|
||||
for fps in [30,60]:
|
||||
actor.restore_animation_pose();carrier.position=Vector3.ZERO;actor.rotation=Vector3.ZERO;actor.reset_gait()
|
||||
for frame in range(fps*3):
|
||||
var direction=Vector3.BACK if frame<fps else Vector3.RIGHT
|
||||
carrier.position+=direction*speed/fps;actor.rotation.y=lerp_angle(actor.rotation.y,atan2(direction.x,direction.z),minf(1,10.0/fps));actor._process(1.0/fps)
|
||||
for f in actor.gait.feet:
|
||||
max_error=maxf(max_error,actor.gait.point("foot."+f.side).distance_to(f.target))
|
||||
max_twist=maxf(max_twist,absf(wrapf(f.yaw-actor.global_rotation.y,-PI,PI)))
|
||||
check(actor.gait.point("foot."+f.side).y>=actor.gait.ground_height(f)-.003,"ankles above floor")
|
||||
var wi=actor.skeleton.find_bone("Wing.L");var wing=actor.skeleton.get_bone_pose_rotation(wi)
|
||||
max_wing=maxf(max_wing,wing.angle_to(actor.animation_pose[wi].basis.get_rotation_quaternion()))
|
||||
for frame in range(fps):actor._process(1.0/fps)
|
||||
var tail_id=actor.skeleton.find_bone("Tail")
|
||||
max_tail=maxf(max_tail,actor.skeleton.get_bone_pose_rotation(tail_id).angle_to(actor.animation_pose[tail_id].basis.get_rotation_quaternion()))
|
||||
for f in actor.gait.feet:check(f.grounded,"stopping settles both shoes")
|
||||
check(actor.gait.track_width>.065,"separate paths keep wide heels apart")
|
||||
carrier.queue_free();await process_frame
|
||||
check(max_tail>.001 and max_tail<.06,"tail moves gently with a fixed root")
|
||||
check(max_error<.005,"IK reaches both shoes at both scales and four speeds")
|
||||
check(max_twist<=deg_to_rad(22.01),"ankle heading never twists more than 22 degrees")
|
||||
check(max_wing>.01 and max_wing<.10,"wings sway gently instead of active flapping")
|
||||
print("INFERNAL REVIEW METRICS ",JSON.stringify({"max_ik_error":max_error,"max_heading_twist_degrees":rad_to_deg(max_twist),"max_wing_pose_angle":max_wing,"max_tail_pose_angle":max_tail,"failures":failures}))
|
||||
if failures.is_empty():print("ALL INFERNAL REVIEW TESTS PASSED: heroine/helper scales, four speeds, two frame rates, right-angle turns, stop, reach and ankle heading")
|
||||
quit(0 if failures.is_empty() else 1)
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"status": "PASS",
|
||||
"mesh_vertices": 45493,
|
||||
"mesh_triangles": 90801,
|
||||
"bones": 166,
|
||||
"floor_min_z": -3.110424222541042e-05,
|
||||
"pedestal_removed": true,
|
||||
"skin_material_protected": true,
|
||||
"pbr_maps": "4096x4096 basecolor / normal / ORM",
|
||||
"clips": {
|
||||
"Idle": {
|
||||
"frames": 73,
|
||||
"max_vertex_travel_m": 0.05229,
|
||||
"max_edge_growth_m": 0.00234
|
||||
},
|
||||
"Walk": {
|
||||
"frames": 33,
|
||||
"max_vertex_travel_m": 0.63687,
|
||||
"max_edge_growth_m": 0.03596
|
||||
},
|
||||
"Whip": {
|
||||
"frames": 65,
|
||||
"max_vertex_travel_m": 0.85563,
|
||||
"max_edge_growth_m": 0.06717
|
||||
}
|
||||
},
|
||||
"glb_bytes": 19143820
|
||||
}
|
||||
@@ -1,19 +1,20 @@
|
||||
extends Node3D
|
||||
var game
|
||||
var animator: AnimationPlayer
|
||||
var cinematic_idle=false
|
||||
var walking=false
|
||||
var striking=false
|
||||
var clips={}
|
||||
var gait=preload("res://catwalk.gd").new()
|
||||
var gait=preload("res://infernal_gait.gd").new()
|
||||
var animation_pose: Array[Transform3D]=[]
|
||||
var skeleton: Skeleton3D
|
||||
|
||||
|
||||
func _init():
|
||||
func _init(review_model: PackedScene=null):
|
||||
name="ApprovedSuccubus"
|
||||
set_meta("approved_model","succubus_v01")
|
||||
set_meta("wardrobe_revision","corset_thigh_boots_v02")
|
||||
var model=preload("res://art/succubus/succubus_v02.glb").instantiate()
|
||||
set_meta("approved_model","infernal_v01")
|
||||
set_meta("wardrobe_revision","infernal_sculpt_painted_v01")
|
||||
var model=(review_model if review_model else preload("res://art/succubus/infernal_v01/infernal_game.glb")).instantiate()
|
||||
add_child(model)
|
||||
model.scale=Vector3.ONE*1.20
|
||||
for node in model.find_children("*","AnimationPlayer",true,false):
|
||||
@@ -64,7 +65,7 @@ func reset_gait():
|
||||
if gait.initialized:gait.reset()
|
||||
|
||||
func _process(delta):
|
||||
if game and game.paused:return
|
||||
if game and game.paused and not cinematic_idle:return
|
||||
var dt=minf(delta,.05)
|
||||
restore_animation_pose()
|
||||
animator.advance(dt)
|
||||
|
||||
@@ -28,7 +28,7 @@ func prepare_work(g):
|
||||
func run(g):
|
||||
check(g.paused and not g.game_started and not g.hud.visible)
|
||||
check(g.menu.current_page=="main" and g.souls.is_empty())
|
||||
check(g.avatar.get_meta("approved_model")=="succubus_v01")
|
||||
check(g.avatar.get_meta("approved_model")=="infernal_v01")
|
||||
check(g.avatar.clips.size()==3)
|
||||
var skeleton=g.avatar.find_children("*","Skeleton3D",true,false)[0]
|
||||
check(skeleton.get_bone_count()==166)
|
||||
|
||||
@@ -15,6 +15,99 @@
|
||||
|
||||
## Последние выполненные задачи
|
||||
|
||||
- **Вступление (готово):** новая смена запускает облёт главной героини.
|
||||
Через 2 секунды проигрывается целиком пользовательская запись Serafina
|
||||
(`audio/intro_serafina.mp3`, исходный ElevenLabs MP3 от 2026-10-28 18:59:40,
|
||||
13,087 с). После сигнала AudioStreamPlayer.finished ещё 2 секунды камера
|
||||
плавно возвращается, затем включается HUD и управление. Симуляция и ввод
|
||||
во время сцены заблокированы; Idle героини продолжает работать.
|
||||
Громкость соответствует настройке голоса, фон приглушён. Потеря фокуса
|
||||
приостанавливает голос и камеру вместе. Продолжение из паузы без повтора.
|
||||
Код: intro_cinematic.gd, интеграция main.gd и cinematic_idle в succubus_actor.
|
||||
- Проверки вступления: импорт Godot 4.3 PASS; `--test-intro` PASS (полная запись,
|
||||
lead/tail, блокировка F5/B/T/Esc, неизменность денег/позиции, движение и возврат
|
||||
камеры, suspend/resume, отмена при reset, продолжение из паузы). После правки
|
||||
очистки при shutdown лог без SCRIPT ERROR. `--test-camera-controls` PASS.
|
||||
Кадр `captures/intro-camera.png` просмотрен: героиня в центре, HUD скрыт.
|
||||
Запускать «Новая игра»; существующий EXE не пересобирался.
|
||||
- Вступление коммитится отдельно от незавершённой переработки STL ниже.
|
||||
Push origin/main выполнен и заблокирован авторизацией GCM/OAuth:
|
||||
`Missing code in response; could not read Username`. Локальный коммит
|
||||
сохранён, вступление ещё не опубликовано в origin.
|
||||
|
||||
- **STL INFERNAL: согласован пользователем и включён в игру.**
|
||||
Коммит образца сохранён локально. Push этой задачи также заблокирован
|
||||
авторизацией GCM/OAuth: `Missing code in response; could not read Username`.
|
||||
В origin новые изменения ещё не опубликованы.
|
||||
`reviews/infernal_v01/` содержит GLB, три карты 4K, GIF ходьбы/оборота/удара/лица,
|
||||
manifest, validation и отдельную сцену просмотра. По просьбе «добавляй и запусти»
|
||||
игровая копия включена в art/succubus/infernal_v01/infernal_game.glb; SHA256
|
||||
совпадает с согласованным образцом. succubus_actor.gd использует её по умолчанию
|
||||
для героини и помощниц, с модельной меткой infernal_v01.
|
||||
infernal_gait.gd содержит согласованную походку, стопы, крылья и хвост;
|
||||
игровой код не зависит от сцен просмотра. Старые модели сохранены.
|
||||
- Сохранены пользовательские исходники `tools/model_sources/infernal.stl`
|
||||
(1 569 740 треугольников; байты сверены с infernal.zip), color_reference.png,
|
||||
SOURCES.json, редактируемый infernal_game.blend. Новая игровая сетка:
|
||||
45 493 вершины / 90 801 треугольник, 166 костей; подставка удалена, подошвы
|
||||
закрыты. Печатные контакты рук и соединение ботинок разделены. Idle (73),
|
||||
Walk (33), Whip (65 кадров) перенесены со старого скелета, 24 fps.
|
||||
- Покраска: красная кожа, чёрный комплект, волосы, крылья, рога и хвост.
|
||||
По замечанию пользователя исправлено попадание чёрного цвета на открытую
|
||||
кожу: отдельный материал рук, непрерывные маски, уменьшены лучи запекания.
|
||||
По дополнительной просьбе пользователя контуры перерисованы по реальным
|
||||
швам скульпта: чашки, фигурный подол, воротник, ободки сапог. Присланная
|
||||
оранжевая обводка сохранена как tools/model_sources/approved_paint_boundary.png.
|
||||
Проекция по глубине отделяет ткань от руки за ней; скрытые складки получают
|
||||
окраску по соседней поверхности. Контуры — infernal_seams.py.
|
||||
Глаза/губы выровнены по скульпту; воротник заканчивается ниже подбородка.
|
||||
Плеть сохранена со старыми morph-анимациями, добавлен радиус шнура 8 мм.
|
||||
- У крыльев и хвоста лёгкое вторичное движение в покое и при ходьбе. Походка
|
||||
образца: короткий шаг, раздельные дорожки стоп, IK, ограничение разворота 22°.
|
||||
Результаты Godot: PASS, ошибка IK <0,000003 м; два масштаба, четыре скорости,
|
||||
30/60 fps, поворот/остановка, мягкие движения крыльев и хвоста.
|
||||
- `tools/validate_infernal.py` PASS: три клипа с шагом 4 кадра, нормализованные
|
||||
веса, конечные координаты, отсутствие подставки, защищённый материал кожи,
|
||||
три карты 4096²; max edge growth Idle .00234 / Walk .03596 / Whip .06717 м.
|
||||
GIF сняты заново с окончательного GLB в Godot; дальнейшая правка должна
|
||||
повторять запись, а не использовать кадры от прежних вариантов.
|
||||
- Проверки включения в игровую сцену: импорт Godot 4.3 PASS, `--test-gait`
|
||||
PASS (героиня + три помощницы, пять скоростей, повороты, остановка, удары,
|
||||
пауза, телепорт). `--test-intro` PASS с новой героиней и полной записью.
|
||||
Кадр облёта просмотрен. Запускается актуальный проект, EXE не пересобирался.
|
||||
- Сборка: tools/build_infernal.py -- --bake, модули infernal_skinning/surface/
|
||||
facepaint/bake/whip/seams.py. Локально finish_infernal.py повторяет покраску из
|
||||
checkpoint в captures. encode_infernal_review.py кодирует GIF. Полные команды
|
||||
в reviews/infernal_v01/README.md. Исходники STL/BLEND/GLB через LFS.
|
||||
- captures/.gdignore исключает технические большие BLEND и кадры из импорта.
|
||||
Перечисленные ниже модели красного комплекта и реконструкция по картинкам
|
||||
являются историческими вариантами; их заменил запрос на пользовательский STL.
|
||||
|
||||
- Подготовлен **образец на согласование**, ещё не включённый в игровую сцену:
|
||||
`Demon_v0.19/reviews/heels_v01`. Пользователь запросил каблуки и исправление
|
||||
стоп при ходьбе, затем уточнил чёрные остроносые ботфорты на широком каблуке,
|
||||
красный кожаный корсет с воротником/кольцами, ремнями, задней шнуровкой,
|
||||
наплечниками-крыльями и большие крылья с лёгким покачиванием при ходьбе.
|
||||
`walking.gif`, `boots.gif`, `outfit.gif` показывают настоящий 3D-образец.
|
||||
Этот исторический образец заменён текущим STL; в игровую сцену не включён. Исходный `art/succubus/succubus_v02.glb` не менялся.
|
||||
- В образце стопы перепривязаны: сустав поднят на 8 см в координатах модели,
|
||||
исправлены inverse bind matrices и трансляции клипов; подошва жёсткая,
|
||||
отдельно от каблука, не деформируется пальцами. Предварительная походка:
|
||||
короче шаг, больше зазор между обувью, разворот опорной стопы ограничен 22°.
|
||||
Крылья на существующих `Wing.L/R` покачиваются примерно на 2,3° с фазовой
|
||||
задержкой и затухают при остановке. Сам образец воспроизводится скриптами
|
||||
`tools/preview_succubus_heels.py`, `succubus_review_outfit.py`,
|
||||
`review_mesh_cut.py`, `encode_succubus_review.py`.
|
||||
- Проверки образца `reviews/heels_v01/review_tests.gd`: PASS, размеры героини
|
||||
и помощницы, 4 скорости, 30/60 fps, поворот 90°, остановка, IK, высота стоп,
|
||||
ограничение разворота и малая амплитуда крыльев. Максимальная ошибка IK
|
||||
менее 0,000005 м. `--test-gait`: PASS для прежней основной походки, героини
|
||||
и трёх помощниц на пяти скоростях, с поворотами, паузой, плетью и телепортом.
|
||||
Общий `catwalk.gd` получил настраиваемые параметры и метод ориентации стопы
|
||||
с прежними значениями по умолчанию; `succubus_actor.gd` — необязательную
|
||||
подстановку PackedScene для отдельной review-сцены. Обычная игра использует
|
||||
прежние настройки. Остаётся старое предупреждение LOD о вырожденной нормали.
|
||||
|
||||
- Туман после последних уточнений опущен ниже колен, ближе к полу:
|
||||
`knee_fog.gdshader`, `density=.38675` (ещё -30% от `.5525`),
|
||||
`surface_height=.45` м вместо `.78`. Объём по высоте уменьшен до `.9` м.
|
||||
@@ -92,6 +185,17 @@
|
||||
|
||||
## Дальнейшая работа
|
||||
|
||||
Пользователь подтвердил 2026-10-28: дальнейшую разработку вести в клоне
|
||||
`Diabolo/Demon_v0.19`, полученном из Git, и сохранять/отправлять все дальнейшие
|
||||
изменения в репозиторий. Историческая папка `../Demon_v0.19` больше не является
|
||||
рабочей версией на этом компьютере.
|
||||
|
||||
Клон получен с `origin/main` на коммите `3c488b5`; все 27 объектов LFS загружены.
|
||||
Первичный импорт ресурсов завершён, повторный импорт Godot 4.3 прошёл без
|
||||
ошибок. Игра запущена из клона с обычным рендерером Vulkan; стартовый лог без
|
||||
ошибок. Игровой код при получении и запуске не менялся; полный набор тестов
|
||||
повторно не запускался.
|
||||
|
||||
Постоянное правило пользователя: после каждой завершённой задачи коммитить
|
||||
все изменения по задаче и отправлять в `origin`, обновляя этот handoff в том же
|
||||
коммите. Повторное подтверждение обычного commit/push не требуется.
|
||||
|
||||
@@ -0,0 +1,323 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
||||
"""Adapt the supplied sculpture, retain its detail and retarget the existing rig.
|
||||
Run with Blender 5: blender --background --python tools/build_infernal.py [-- --bake]
|
||||
"""
|
||||
import bpy,bmesh,math,json,sys,heapq
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
from mathutils import Vector,Matrix
|
||||
from mathutils.kdtree import KDTree
|
||||
|
||||
ROOT=Path(__file__).resolve().parent.parent
|
||||
OUT=ROOT/'Demon_v0.19/reviews/infernal_v01';OUT.mkdir(parents=True,exist_ok=True)
|
||||
QA=ROOT/'Demon_v0.19/captures/infernal';QA.mkdir(parents=True,exist_ok=True)
|
||||
CUT=.150
|
||||
BAKE='--bake' in sys.argv
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
bpy.context.preferences.view.use_translate_new_dataname=False
|
||||
scene=bpy.context.scene;scene.render.fps=24
|
||||
|
||||
def active(obj):
|
||||
bpy.ops.object.select_all(action='DESELECT');obj.select_set(True);bpy.context.view_layer.objects.active=obj
|
||||
def log(*args):print('INFERNAL',*args,flush=True)
|
||||
def color_role(p,hint=None):
|
||||
x,y,z=p;z+=CUT;a=abs(x)
|
||||
if hint in [4,5]:return 2 if z<1.025 and a>.245 else 0
|
||||
# The outer membranes and spars are behind the exposed arms.
|
||||
wing=(a>.39 and z>.54) or (a>.215 and y>.102 and z>1.12) or (a>.22 and z>1.72)
|
||||
tail=(z<1.27 and y>.085 and a<.40 and (z<.70 or a>.17 or y>.185))
|
||||
hair=(a<.19 and z>1.968-(.85 if x<0 else .55)*a) or (a<.17 and y>.075 and z>1.30) or (.065<a<.18 and y<.045 and z>1.52)
|
||||
horn=z>1.96
|
||||
if hint in [1,2,3] or wing or tail:return 3
|
||||
if hair or horn:return 2
|
||||
if z<.615:return 1
|
||||
top=1.545+.080*min(a/.12,1);bottom=1.10+.13*min(a/.19,1)
|
||||
width=float(np.interp(z,[1.1,1.25,1.4,1.55,1.63],[.18,.205,.17,.185,.17]))
|
||||
if a<width and bottom<z<top:return 1
|
||||
if a<.080 and 1.635<z<1.705:return 1
|
||||
if a>.245 and z<1.025:return 2
|
||||
return 0
|
||||
|
||||
PALETTE=[('Crimson skin',(.42,.013,.024),.47,0),('Black leather corset and boots',(.012,.016,.019),.30,.12),('Black hair and horns',(.009,.010,.014),.41,.02),('Dark bat wings and armoured tail',(.018,.019,.023),.52,.04),('Amber eyes',(.32,.18,.02),.25,.10),('Dark red lips',(.045,.002,.008),.33,0)]
|
||||
materials=[]
|
||||
for name,color,rough,metal in PALETTE:
|
||||
m=bpy.data.materials.new(name);m.diffuse_color=(*color,1);m.use_nodes=True
|
||||
shader=next(n for n in m.node_tree.nodes if n.type=='BSDF_PRINCIPLED');shader.inputs['Base Color'].default_value=(*color,1);shader.inputs['Roughness'].default_value=rough;shader.inputs['Metallic'].default_value=metal
|
||||
materials.append(m)
|
||||
|
||||
# Preserve the supplied geometry as the bake source, cutting only the pedestal.
|
||||
bpy.ops.wm.stl_import(filepath=str(ROOT/'tools/model_sources/infernal.stl'))
|
||||
high=bpy.context.object;high.name='Infernal_High_Source_No_Pedestal';high.scale*=2.2/high.dimensions.z
|
||||
bpy.context.view_layer.update();corners=[high.matrix_world@Vector(c) for c in high.bound_box]
|
||||
lo=Vector(tuple(min(p[i] for p in corners) for i in range(3)));hi=Vector(tuple(max(p[i] for p in corners) for i in range(3)))
|
||||
high.location-=Vector(((lo.x+hi.x)/2,(lo.y+hi.y)/2,lo.z));active(high);bpy.ops.object.transform_apply(location=True,rotation=True,scale=True)
|
||||
before=len(high.data.polygons);bm=bmesh.new();bm.from_mesh(high.data)
|
||||
result=bmesh.ops.bisect_plane(bm,geom=list(bm.verts)+list(bm.edges)+list(bm.faces),plane_co=(0,0,CUT),plane_no=(0,0,1),clear_inner=True,dist=.000001)
|
||||
boundary=[e for e in result['geom_cut'] if isinstance(e,bmesh.types.BMEdge) and e.is_boundary and all(abs(v.co.z-CUT)<.00001 for v in e.verts)]
|
||||
if boundary:bmesh.ops.holes_fill(bm,edges=boundary,sides=0)
|
||||
for v in bm.verts:v.co.z-=CUT
|
||||
bmesh.ops.triangulate(bm,faces=list(bm.faces));bm.to_mesh(high.data);bm.free();high.data.update()
|
||||
for m in materials:high.data.materials.append(m)
|
||||
for p in high.data.polygons:p.use_smooth=True;p.material_index=color_role(p.center)
|
||||
log('pedestal removed',before,'->',len(high.data.polygons),'triangles')
|
||||
|
||||
# Real-time topology; the fine sculpt is retained in the baked normal texture.
|
||||
low=high.copy();low.data=high.data.copy();scene.collection.objects.link(low);low.name='Infernal_Game_Mesh'
|
||||
active(low);modifier=low.modifiers.new('Game topology','DECIMATE');modifier.ratio=.065;modifier.use_collapse_triangulate=True
|
||||
bpy.ops.object.modifier_apply(modifier=modifier.name)
|
||||
for p in low.data.polygons:p.use_smooth=True;p.material_index=color_role(p.center)
|
||||
log('game topology',len(low.data.vertices),'vertices',len(low.data.polygons),'triangles')
|
||||
|
||||
# Use surface connectivity to distinguish the tail and wing tips from nearby
|
||||
# hands and boots. A spatial box alone stretches the sculpture when arms move.
|
||||
coords=np.empty(len(low.data.vertices)*3,dtype=np.float64);low.data.vertices.foreach_get('co',coords);coords=coords.reshape(-1,3)
|
||||
graph=[[] for _ in coords]
|
||||
for edge in low.data.edges:
|
||||
a,b=edge.vertices;length=float(np.linalg.norm(coords[a]-coords[b]));graph[a].append((b,length));graph[b].append((a,length))
|
||||
tail_path=np.array([(0,.21,1.25),(.20,.21,1.05),(.33,.17,.85),(.36,.11,.65),(.30,.12,.43),(.12,.15,.26),(-.13,.15,.25),(-.30,.13,.37),(-.33,.12,.52),(-.23,.10,.60)])
|
||||
arm_path=np.array([(.150,.015,1.70),(.170,.025,1.57),(.190,.035,1.40),(.235,.005,1.25),(.257,-.015,1.10),(.270,-.035,1.00)])
|
||||
def path_distance(p,path):
|
||||
result=np.inf
|
||||
for start,end in zip(path[:-1],path[1:]):
|
||||
segment=end-start;t=np.clip(np.dot(p-start,segment)/np.dot(segment,segment),0,1);result=min(result,float(np.linalg.norm(p-(start+t*segment))))
|
||||
return result
|
||||
seeds=[];owner=np.full(len(coords),-1,dtype=np.int8);distance=np.full(len(coords),np.inf)
|
||||
for i,(x,y,z) in enumerate(coords):
|
||||
zo=z+CUT;a=abs(x);label=-1
|
||||
arm_distance=path_distance(np.array([a,y,zo]),arm_path)
|
||||
if (a<.105 and y<.08 and 1.05<zo<1.80) or (a<.17 and zo>1.75) or (a<.14 and y<.07 and zo<1.08):label=0
|
||||
if 1.12<zo<1.34 and a<.185 and (y<-.095 or y>.130):label=0
|
||||
if .98<zo<1.68 and -.080<y<.085 and arm_distance<.030:label=4 if x>0 else 5
|
||||
if a>.50 and zo>.65:label=1 if x>0 else 2
|
||||
if a>.23 and zo>1.33 and y>.135:label=1 if x>0 else 2
|
||||
if a>.32 and zo>1.15 and y>.12:label=1 if x>0 else 2
|
||||
p=np.array([x,y,zo]);tail_distance=path_distance(p,tail_path)
|
||||
if tail_distance<.028 and y>.075 and zo<1.27:label=3
|
||||
if label>=0:owner[i]=label;distance[i]=0;heapq.heappush(seeds,(0.,i,label))
|
||||
while seeds:
|
||||
d,i,label=heapq.heappop(seeds)
|
||||
if d>distance[i]:continue
|
||||
for j,length in graph[i]:
|
||||
nd=d+length
|
||||
if nd<distance[j]:distance[j]=nd;owner[j]=label;heapq.heappush(seeds,(nd,j,label))
|
||||
owner[owner<0]=0
|
||||
# Build separate closed surface pieces at printing contacts. Each piece owns
|
||||
# its boundary vertices, so capping cannot join a hand back to the corset.
|
||||
vertices=[];faces=[];labels=[];mapping={};old_coords=coords.copy()
|
||||
for face in low.data.polygons:
|
||||
roles=[int(owner[i]) for i in face.vertices];role=max(set(roles),key=roles.count)
|
||||
indices=[]
|
||||
for index in face.vertices:
|
||||
key=(role,index)
|
||||
if key not in mapping:
|
||||
mapping[key]=len(vertices);vertices.append(tuple(old_coords[index]));labels.append(role)
|
||||
indices.append(mapping[key])
|
||||
faces.append(indices)
|
||||
partition=bpy.data.meshes.new('Infernal separated printable contacts');partition.from_pydata(vertices,[],faces);partition.update()
|
||||
low.data=partition
|
||||
for material in materials:low.data.materials.append(material)
|
||||
bm=bmesh.new();bm.from_mesh(low.data);bm.verts.ensure_lookup_table();layer=bm.verts.layers.int.new('SemanticRegion')
|
||||
for vertex in bm.verts:vertex[layer]=labels[vertex.index]
|
||||
for role in range(6):
|
||||
boundary=[edge for edge in bm.edges if edge.is_boundary and all(v[layer]==role for v in edge.verts)]
|
||||
if boundary:bmesh.ops.holes_fill(bm,edges=boundary,sides=0)
|
||||
bmesh.ops.triangulate(bm,faces=list(bm.faces));bm.to_mesh(low.data);bm.free();low.data.validate(clean_customdata=False);low.data.update()
|
||||
coords=np.empty(len(low.data.vertices)*3);low.data.vertices.foreach_get('co',coords);coords=coords.reshape(-1,3)
|
||||
owner=np.array([v.value for v in low.data.attributes['SemanticRegion'].data],dtype=np.int8)
|
||||
for face in low.data.polygons:face.use_smooth=True
|
||||
log('separated and capped semantic surfaces',len(coords),'vertices')
|
||||
region_tree=KDTree(len(coords))
|
||||
for i,p in enumerate(coords):region_tree.insert(p,i)
|
||||
region_tree.balance()
|
||||
for p in low.data.polygons:
|
||||
labels=[int(owner[i]) for i in p.vertices];label=max(set(labels),key=labels.count);p.material_index=color_role(p.center,label)
|
||||
for p in high.data.polygons:
|
||||
_,index,_=region_tree.find(p.center);p.material_index=color_role(p.center,int(owner[index]))
|
||||
log('geodesic regions',{str(label):int((owner==label).sum()) for label in range(6)})
|
||||
|
||||
# Import and sample the exact old clips before changing any bind transforms.
|
||||
existing=set(scene.objects)
|
||||
bpy.ops.import_scene.gltf(filepath=str(ROOT/'Demon_v0.19/art/succubus/succubus_v02.glb'))
|
||||
imported=set(scene.objects)-existing;source=next(o for o in imported if o.type=='ARMATURE')
|
||||
body=next(o for o in imported if o.type=='MESH' and 'Succubus' in o.name)
|
||||
source_tracks={t.name:t.strips[0].action for t in source.animation_data.nla_tracks if len(t.strips)}
|
||||
for t in source.animation_data.nla_tracks:t.mute=True
|
||||
source.animation_data.action=source_tracks['Idle'];scene.frame_set(1);bpy.context.view_layer.update()
|
||||
names=[b.name for b in source.data.bones];base={b.name:source.pose.bones[b.name].matrix.copy() for b in source.data.bones}
|
||||
old_head={name:base[name].translation.copy() for name in names}
|
||||
sampled={}
|
||||
for clip in ['Idle','Walk','Whip']:
|
||||
action=source_tracks[clip];source.animation_data.action=action;frames=[]
|
||||
for f in range(1,int(action.frame_range[1])+1):
|
||||
scene.frame_set(f);bpy.context.view_layer.update();frames.append({n:source.pose.bones[n].matrix.copy() for n in names})
|
||||
sampled[clip]=frames
|
||||
log('sampled original clips',[(key,len(value)) for key,value in sampled.items()])
|
||||
|
||||
def warp(p):
|
||||
x,y,z=p;a=abs(x)
|
||||
if a>.155 and .78<z<1.48:
|
||||
zz=float(np.interp(z,[.78,.97,1.124,1.363,1.48],[.66,.91,1.15,1.56,1.66]))
|
||||
xx=x*float(np.interp(z,[.78,.97,1.124,1.363,1.48],[.80,.84,.95,1.02,1.02]));yy=y*.20+.010
|
||||
else:
|
||||
zz=float(np.interp(z,[0,.026,.072,.494,.89,1.10,1.36,1.575,1.72,2.0],[0,.022,.115,.605,1.055,1.30,1.56,1.69,1.88,2.16]))
|
||||
if z<.95:
|
||||
xx=x*float(np.interp(z,[0,.072,.494,.89,.95],[.42,.42,.65,1.05,1.05]))
|
||||
yy=(y+.03)*.85+.04 if z<.1 else y*.4+float(np.interp(z,[.1,.5,.9],[.05,.02,.02]))
|
||||
else:xx=x*1.01;yy=y*.7+.015
|
||||
return Vector((xx,yy,zz))
|
||||
|
||||
target_data=bpy.data.armatures.new('Infernal_Retargeted_166');rig=bpy.data.objects.new('INFERNAL_RIG',target_data);scene.collection.objects.link(rig)
|
||||
active(rig);bpy.ops.object.mode_set(mode='EDIT')
|
||||
for name in names:
|
||||
src=source.data.bones[name];b=target_data.edit_bones.new(name)
|
||||
b.head=warp(base[name].translation);b.tail=warp(base[name]@Vector((0,src.length,0)))
|
||||
if (b.tail-b.head).length<.001:b.tail=b.head+Vector((0,0,.008))
|
||||
b.align_roll(base[name].to_3x3().col[2])
|
||||
if name.startswith('Wing.'):
|
||||
sign=1 if name.endswith('L') else -1;b.head=(sign*.18,.12,1.43);b.tail=(sign*.32,.15,1.58)
|
||||
if name=='Tail':b.head=(0,.17,1.09);b.tail=(.07,.22,.96)
|
||||
# Match the sculpture's elbow height rather than stretching its upper arm.
|
||||
arm_heads=[(.153,.015,1.54),(.170,.025,1.42),(.194,.035,1.25),(.228,.005,1.09),(.257,-.020,.93)]
|
||||
arm_bones=['upperarm01','upperarm02','lowerarm01','lowerarm02','wrist']
|
||||
for side,sign in [('L',1),('R',-1)]:
|
||||
for index,name in enumerate(arm_bones):
|
||||
bone=target_data.edit_bones[name+'.'+side];head=Vector(arm_heads[index]);head.x*=sign;delta=head-bone.head
|
||||
bone.head=head
|
||||
if index<len(arm_heads)-1:
|
||||
end=Vector(arm_heads[index+1]);end.x*=sign;bone.tail=end
|
||||
else:bone.tail+=delta
|
||||
for bone in target_data.edit_bones:
|
||||
if bone.name.endswith('.'+side) and any(key in bone.name for key in ['finger','metacarpal']):bone.head.z+=.021;bone.tail.z+=.021
|
||||
for name in names:
|
||||
if source.data.bones[name].parent:target_data.edit_bones[name].parent=target_data.edit_bones[source.data.bones[name].parent.name]
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
rest={b.name:b.matrix_local.copy() for b in rig.data.bones}
|
||||
|
||||
# Transfer from the posed human surface, not from a T-pose or a distance grid.
|
||||
source.animation_data.action=source_tracks['Idle'];scene.frame_set(1);bpy.context.view_layer.update()
|
||||
evaluated=body.evaluated_get(bpy.context.evaluated_depsgraph_get());evaluated_mesh=evaluated.to_mesh()
|
||||
body_materials={i for i,m in enumerate(body.data.materials) if m and any(s in m.name for s in ['Succubus skin','Bare thighs','Thigh high'])}
|
||||
body_ids=set(i for p in body.data.polygons if p.material_index in body_materials for i in p.vertices)
|
||||
transforms={n:rest[n]@base[n].inverted() for n in names};samples=[];sample_weights=[]
|
||||
for i in sorted(body_ids):
|
||||
weights=[(body.vertex_groups[g.group].name,g.weight) for g in body.data.vertices[i].groups if body.vertex_groups[g.group].name in transforms and g.weight>.001]
|
||||
if not weights:continue
|
||||
p=body.matrix_world@evaluated_mesh.vertices[i].co;total=sum(w for _,w in weights);at=Vector((0,0,0))
|
||||
for name,w in weights:at+=(transforms[name]@p)*(w/total)
|
||||
samples.append(at);sample_weights.append(weights)
|
||||
evaluated.to_mesh_clear();tree=KDTree(len(samples))
|
||||
for i,p in enumerate(samples):tree.insert(p,i)
|
||||
tree.balance();log('skin transfer samples',len(samples))
|
||||
def arm_name(name):return any(key in name for key in ['upperarm','lowerarm','wrist','finger','metacarpal'])
|
||||
part_trees={}
|
||||
for part in ['core','L','R']:
|
||||
ids=[]
|
||||
for i,weights in enumerate(sample_weights):
|
||||
amount=sum(w for name,w in weights if arm_name(name) and (part=='core' or name.endswith('.'+part)))
|
||||
if (part=='core' and amount<.01) or (part!='core' and amount>.4):ids.append(i)
|
||||
kd=KDTree(len(ids))
|
||||
for i in ids:kd.insert(samples[i],i)
|
||||
kd.balance();part_trees[part]=kd
|
||||
for name in names:low.vertex_groups.new(name=name)
|
||||
for vertex in low.data.vertices:
|
||||
x,y,z=vertex.co;zo=z+CUT;a=abs(x);weights={}
|
||||
label=int(owner[vertex.index])
|
||||
arm=label in [4,5]
|
||||
if label in [1,2]:
|
||||
wing_weight=float(np.clip((a-.16)/.16,0,1));weights={'Wing.L' if label==1 else 'Wing.R':wing_weight,'spine02':1-wing_weight}
|
||||
elif label==3:
|
||||
tail_weight=float(np.clip((Vector((x,y,z))-Vector((0,.17,1.09))).length/.16,0,1));weights={'Tail':tail_weight,'spine05':1-tail_weight}
|
||||
elif z<.15:weights={'foot.L' if x>0 else 'foot.R':1.0}
|
||||
elif arm and zo<1.12:weights={'wrist.L' if x>0 else 'wrist.R':1.0}
|
||||
else:
|
||||
shoulder=.13<a<.28 and 1.48<zo<1.74 and y<.065
|
||||
kd=tree if shoulder else part_trees[('L' if x>0 else 'R') if arm else 'core']
|
||||
for _,index,distance in kd.find_n(vertex.co,4):
|
||||
factor=1/max(.0001,distance)**2
|
||||
for name,w in sample_weights[index]:
|
||||
if not shoulder and not arm and arm_name(name):continue
|
||||
if not shoulder and arm and not (arm_name(name) or 'clavicle' in name):continue
|
||||
if z<.95 and abs(x)>.025 and (name.endswith('.L') if x<0 else name.endswith('.R')):continue
|
||||
weights[name]=weights.get(name,0)+w*factor
|
||||
if y>.10 and zo>1.45 and a<.17:
|
||||
blend=float(np.clip((zo-1.45)/.45,.25,1));weights={'head':blend,'spine02':1-blend}
|
||||
pairs=sorted(weights.items(),key=lambda p:-p[1])[:4];total=sum(w for _,w in pairs)
|
||||
for name,w in pairs:low.vertex_groups[name].add([vertex.index],w/total,'REPLACE')
|
||||
# Smooth weights on connected surface regions without smearing hands into clothes.
|
||||
weights_array=np.zeros((len(coords),len(names)),dtype=np.float32)
|
||||
name_index={name:i for i,name in enumerate(names)}
|
||||
for vertex in low.data.vertices:
|
||||
for group in vertex.groups:weights_array[vertex.index,group.group]=group.weight
|
||||
edges=np.array([tuple(e.vertices) for e in low.data.edges],dtype=np.int32)
|
||||
edges=edges[owner[edges[:,0]]==owner[edges[:,1]]]
|
||||
first=np.concatenate((edges[:,0],edges[:,1]));second=np.concatenate((edges[:,1],edges[:,0]))
|
||||
counts=np.maximum(np.bincount(first,minlength=len(coords)),1)
|
||||
for iteration in range(6):
|
||||
average=np.zeros_like(weights_array)
|
||||
for column in range(len(names)):
|
||||
average[:,column]=np.bincount(first,weights=weights_array[second,column],minlength=len(coords))/counts
|
||||
weights_array=weights_array*.45+average*.55
|
||||
shoulder_seams={}
|
||||
for index,point in enumerate(coords):
|
||||
if 1.48<point[2]+CUT<1.74:
|
||||
key=tuple(np.round(point,6));shoulder_seams.setdefault(key,[]).append(index)
|
||||
for indices in shoulder_seams.values():
|
||||
if len(indices)>1:weights_array[indices]=weights_array[indices].mean(axis=0)
|
||||
for vertex in low.data.vertices:
|
||||
weights=weights_array[vertex.index];indices=np.argsort(weights)[-4:];total=float(weights[indices].sum())
|
||||
for group in list(vertex.groups):low.vertex_groups[group.group].remove([vertex.index])
|
||||
for index in indices:
|
||||
if weights[index]>.00001:low.vertex_groups[int(index)].add([vertex.index],float(weights[index])/total,'REPLACE')
|
||||
from infernal_skinning import refine_weights
|
||||
refine_weights(low)
|
||||
log('weights smoothed with semantic boundaries')
|
||||
modifier=low.modifiers.new('Transferred skeleton','ARMATURE');modifier.object=rig;low.parent=rig
|
||||
|
||||
# Retarget world-space animation deltas relative to the old Idle bind pose.
|
||||
rig.animation_data_create()
|
||||
for clip,frames in sampled.items():
|
||||
action=bpy.data.actions.new('Infernal / '+clip);rig.animation_data.action=action
|
||||
for f,frame in enumerate(frames,1):
|
||||
desired={}
|
||||
for name in names:
|
||||
bone=rig.data.bones[name];parent=bone.parent
|
||||
head=(desired[parent.name]@(rest[parent.name].inverted()@rest[name]).translation) if parent else rest[name].translation+(frame[name].translation-base[name].translation)
|
||||
q=frame[name].to_quaternion()@base[name].to_quaternion().inverted()@rest[name].to_quaternion()
|
||||
matrix=Matrix.LocRotScale(head,q,Vector((1,1,1)));desired[name]=matrix
|
||||
kwargs={'matrix':matrix,'matrix_local':rest[name],'invert':True}
|
||||
if parent:kwargs.update(parent_matrix=desired[parent.name],parent_matrix_local=rest[parent.name])
|
||||
basis=bone.convert_local_to_pose(**kwargs);pb=rig.pose.bones[name];pb.rotation_mode='QUATERNION';pb.rotation_quaternion=basis.to_quaternion();pb.location=basis.translation
|
||||
pb.keyframe_insert('rotation_quaternion',frame=f,group=name);pb.keyframe_insert('location',frame=f,group=name)
|
||||
rig.animation_data.action=None;track=rig.animation_data.nla_tracks.new();track.name=clip;strip=track.strips.new(clip,1,action);strip.frame_end=len(frames)
|
||||
track.mute=True
|
||||
log('retargeted',len(names),'bones')
|
||||
|
||||
bpy.data.orphans_purge(do_recursive=True)
|
||||
bpy.context.preferences.filepaths.save_version=0
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(QA/'retarget_checkpoint.blend'))
|
||||
|
||||
if BAKE:
|
||||
from infernal_bake import bake
|
||||
bake(scene,high,low,materials,PALETTE,OUT,log)
|
||||
|
||||
from infernal_whip import transfer_whip
|
||||
whip=transfer_whip(scene,source,rig)
|
||||
|
||||
# Export only the new game mesh and retargeted rig; leave the old asset intact.
|
||||
for track in rig.animation_data.nla_tracks:track.mute=False
|
||||
rig.animation_data.action=None;scene.frame_set(1)
|
||||
for bone in rig.pose.bones:bone.matrix_basis.identity()
|
||||
active(low);rig.select_set(True)
|
||||
if whip:whip.select_set(True)
|
||||
bpy.ops.export_scene.gltf(filepath=str(OUT/'infernal_game.glb'),export_format='GLB',use_selection=True,export_animations=True,export_animation_mode='NLA_TRACKS',export_nla_strips=True,export_force_sampling=True,export_frame_range=False,export_skins=True,export_materials='EXPORT',export_yup=True)
|
||||
report={'source_triangles':before,'source_after_pedestal_cut':len(high.data.polygons),'game_vertices':len(low.data.vertices),'game_triangles':len(low.data.polygons),'bones':len(names),'clips':{k:len(v) for k,v in sampled.items()},'pedestal_removed':True,'cut_height':CUT,'textures_4k':BAKE}
|
||||
report.update(paint_boundary_reference='tools/model_sources/approved_paint_boundary.png',whip_radius_added_m=.008,approval_status='awaiting_visual_approval')
|
||||
(OUT/'manifest.json').write_text(json.dumps(report,indent=2));log('GAME ASSET READY',json.dumps(report))
|
||||
# Keep an editable optimized source without copying the entire high-poly statue.
|
||||
for obj in list(scene.objects):
|
||||
if obj not in [rig,low,whip]:bpy.data.objects.remove(obj,do_unlink=True)
|
||||
bpy.data.orphans_purge(do_recursive=True)
|
||||
bpy.context.preferences.filepaths.save_version=0
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/'tools/model_sources/infernal_game.blend'))
|
||||
@@ -0,0 +1,8 @@
|
||||
"""Encode actual Godot captures for STL model approval."""
|
||||
from pathlib import Path
|
||||
import argparse,subprocess
|
||||
parser=argparse.ArgumentParser();parser.add_argument('--ffmpeg',required=True);args=parser.parse_args()
|
||||
r=Path(__file__).resolve().parent.parent;project=r/'Demon_v0.19';out=project/'reviews/infernal_v01'
|
||||
for sequence,count,name in [('full',144,'walking'),('outfit',120,'turntable'),('action',96,'whip'),('portrait',72,'face')]:
|
||||
subprocess.run([args.ffmpeg,'-hide_banner','-loglevel','error','-y','-framerate','24','-i',str(project/'captures/infernal'/sequence/'%03d.png'),'-filter_complex','[0:v]scale=1000:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=192[p];[b][p]paletteuse=dither=sierra2_4a','-frames:v',str(count),'-loop','0',str(out/(name+'.gif'))],check=True)
|
||||
print(name,count,'frames',flush=True)
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Encode the exact frame ranges; ignore older surplus capture frames."""
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
parser=argparse.ArgumentParser()
|
||||
parser.add_argument('--ffmpeg',required=True)
|
||||
args=parser.parse_args()
|
||||
root=Path(__file__).resolve().parent.parent
|
||||
project=root/'Demon_v0.19'
|
||||
out=project/'reviews/heels_v01'
|
||||
for sequence,count,name in [('full',72,'walking'),('feet',48,'boots'),('outfit',96,'outfit')]:
|
||||
subprocess.run([args.ffmpeg,'-hide_banner','-loglevel','error','-y','-framerate','24',
|
||||
'-i',str(project/'captures/heels-v01'/sequence/'%03d.png'),
|
||||
'-filter_complex','[0:v]scale=1120:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=192[p];[b][p]paletteuse=dither=sierra2_4a',
|
||||
'-frames:v',str(count),'-loop','0',str(out/(name+'.gif'))],check=True)
|
||||
print(name,count,'frames',flush=True)
|
||||
@@ -0,0 +1,40 @@
|
||||
"""Finish paint from the rig checkpoint without repeating geometry conversion."""
|
||||
import sys,json,bpy
|
||||
from pathlib import Path
|
||||
from mathutils import Matrix
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
||||
from infernal_bake import bake
|
||||
from infernal_skinning import refine_weights
|
||||
from infernal_whip import transfer_whip
|
||||
r=Path(__file__).resolve().parent.parent;out=r/'Demon_v0.19/reviews/infernal_v01';qa=r/'Demon_v0.19/captures/infernal'
|
||||
bpy.ops.wm.open_mainfile(filepath=str(qa/'retarget_checkpoint.blend'))
|
||||
scene=bpy.context.scene;low=bpy.data.objects['Infernal_Game_Mesh'];rig=bpy.data.objects['INFERNAL_RIG'];high=bpy.data.objects['Infernal_High_Source_No_Pedestal']
|
||||
source=next(o for o in scene.objects if o.type=='ARMATURE' and o!=rig)
|
||||
materials=list(high.data.materials);palette=[(m.name,tuple(m.diffuse_color[:3]),next(n for n in m.node_tree.nodes if n.type=='BSDF_PRINCIPLED').inputs['Roughness'].default_value,next(n for n in m.node_tree.nodes if n.type=='BSDF_PRINCIPLED').inputs['Metallic'].default_value) for m in materials]
|
||||
def log(*args):print('INFERNAL',*args,flush=True)
|
||||
refine_weights(low)
|
||||
# Keep exposed arms red; the hair mask must not paint forearms black.
|
||||
from mathutils.kdtree import KDTree
|
||||
kd=KDTree(len(low.data.vertices))
|
||||
for vertex in low.data.vertices:kd.insert(vertex.co,vertex.index)
|
||||
kd.balance();regions=low.data.attributes['SemanticRegion'].data
|
||||
for face in high.data.polygons:
|
||||
_,index,_=kd.find(face.center)
|
||||
if regions[index].value in [4,5]:face.material_index=2 if face.center.z+.15<1.025 and abs(face.center.x)>.245 else 0
|
||||
bake(scene,high,low,materials,palette,out,log)
|
||||
whip=transfer_whip(scene,source,rig)
|
||||
for track in rig.animation_data.nla_tracks:track.mute=False
|
||||
rig.animation_data.action=None;scene.frame_set(1)
|
||||
for bone in rig.pose.bones:bone.matrix_basis=Matrix.Identity(4)
|
||||
bpy.ops.object.select_all(action='DESELECT');low.select_set(True);rig.select_set(True)
|
||||
if whip:whip.select_set(True)
|
||||
bpy.context.view_layer.objects.active=low
|
||||
bpy.ops.export_scene.gltf(filepath=str(out/'infernal_game.glb'),export_format='GLB',use_selection=True,export_animations=True,export_animation_mode='NLA_TRACKS',export_nla_strips=True,export_force_sampling=True,export_frame_range=False,export_skins=True,export_materials='EXPORT',export_yup=True)
|
||||
report=json.loads((out/'manifest.json').read_text());report.update(textures_4k=True,animated_whip=whip is not None,facial_paint='aligned to sculpt: eyes z1.889, lips z1.817',game_vertices=len(low.data.vertices),game_triangles=len(low.data.polygons))
|
||||
report.update(paint_boundary_reference='tools/model_sources/approved_paint_boundary.png',whip_radius_added_m=.008,approval_status='awaiting_visual_approval')
|
||||
(out/'manifest.json').write_text(json.dumps(report,indent=2));log('FINISHED',report)
|
||||
for obj in list(scene.objects):
|
||||
if obj not in [rig,low,whip]:bpy.data.objects.remove(obj,do_unlink=True)
|
||||
bpy.data.orphans_purge(do_recursive=True)
|
||||
bpy.context.preferences.filepaths.save_version=0
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(r/'tools/model_sources/infernal_game.blend'))
|
||||
@@ -0,0 +1,73 @@
|
||||
import bpy,math,numpy as np
|
||||
from mathutils import Matrix
|
||||
|
||||
def active(obj):
|
||||
bpy.ops.object.select_all(action="DESELECT");obj.select_set(True);bpy.context.view_layer.objects.active=obj
|
||||
|
||||
def bake(scene,high,low,materials,palette,out,log):
|
||||
rig=low.parent
|
||||
from infernal_surface import prepare_surface
|
||||
materials=prepare_surface(high,low)
|
||||
# Bake colour, sculpt detail and material response into actual 4K maps.
|
||||
for o in [o for o in scene.objects if o not in [high,low]]:o.hide_render=True
|
||||
high.hide_render=False;low.hide_render=False
|
||||
scene.render.engine='CYCLES';scene.cycles.samples=8
|
||||
try:
|
||||
preferences=bpy.context.preferences.addons['cycles'].preferences;preferences.compute_device_type='OPTIX';preferences.get_devices()
|
||||
for device in preferences.devices:device.use=device.type!='CPU'
|
||||
scene.cycles.device='GPU'
|
||||
except Exception as error:log('CPU bake fallback',str(error))
|
||||
active(low);bpy.ops.object.mode_set(mode='EDIT');bpy.ops.mesh.select_all(action='SELECT');bpy.ops.uv.smart_project(angle_limit=math.radians(66),island_margin=.003);bpy.ops.object.mode_set(mode='OBJECT')
|
||||
final=bpy.data.materials.new('Infernal 4K PBR');final.use_nodes=True;low.data.materials.clear();low.data.materials.append(final)
|
||||
for p in low.data.polygons:p.material_index=0
|
||||
scene.render.bake.use_selected_to_active=True;scene.render.bake.cage_extrusion=.004;scene.render.bake.max_ray_distance=.010;scene.render.bake.margin=10
|
||||
for bone in rig.pose.bones:bone.matrix_basis=Matrix.Identity(4)
|
||||
low.modifiers['Transferred skeleton'].show_render=False;low.modifiers['Transferred skeleton'].show_viewport=False
|
||||
for kind,filename in [('DIFFUSE','infernal_basecolor.png'),('NORMAL','infernal_normal.png'),('EMIT','infernal_orm.png')]:
|
||||
image=bpy.data.images.new(filename,width=4096,height=4096,alpha=False)
|
||||
if kind!='DIFFUSE':image.colorspace_settings.name='Non-Color'
|
||||
node=final.node_tree.nodes.new('ShaderNodeTexImage');node.image=image;final.node_tree.nodes.active=node
|
||||
if kind=='DIFFUSE':scene.render.bake.use_pass_direct=False;scene.render.bake.use_pass_indirect=False;scene.render.bake.use_pass_color=True
|
||||
if kind=='EMIT':
|
||||
for material in materials:
|
||||
nodes=material.node_tree.nodes;links=material.node_tree.links
|
||||
shader=next(n for n in nodes if n.type=='BSDF_PRINCIPLED')
|
||||
combine=nodes.new('ShaderNodeCombineColor');combine.inputs[0].default_value=1
|
||||
for key,index in [('Roughness',1),('Metallic',2)]:
|
||||
socket=shader.inputs[key]
|
||||
if socket.is_linked:links.new(socket.links[0].from_socket,combine.inputs[index])
|
||||
else:combine.inputs[index].default_value=socket.default_value
|
||||
emission=nodes.new('ShaderNodeEmission');links.new(combine.outputs[0],emission.inputs['Color']);links.new(emission.outputs[0],next(n for n in nodes if n.type=='OUTPUT_MATERIAL').inputs['Surface'])
|
||||
bpy.ops.object.select_all(action='DESELECT');high.select_set(True);low.select_set(True);bpy.context.view_layer.objects.active=low
|
||||
bpy.ops.object.bake(type=kind)
|
||||
if kind=='NORMAL':
|
||||
pixels=np.array(image.pixels[:],dtype=np.float32).reshape(-1,4)
|
||||
empty=np.max(pixels[:,:3],axis=1)<.001
|
||||
pixels[empty,:3]=(.5,.5,1)
|
||||
image.pixels.foreach_set(pixels.ravel())
|
||||
image.filepath_raw=str(out/filename);image.file_format='PNG';image.save();image.pack();log('baked',filename)
|
||||
shader=next(n for n in final.node_tree.nodes if n.type=='BSDF_PRINCIPLED')
|
||||
if kind=='DIFFUSE':final.node_tree.links.new(node.outputs['Color'],shader.inputs['Base Color'])
|
||||
if kind=='NORMAL':
|
||||
normal=final.node_tree.nodes.new('ShaderNodeNormalMap');final.node_tree.links.new(node.outputs['Color'],normal.inputs['Color']);final.node_tree.links.new(normal.outputs['Normal'],shader.inputs['Normal'])
|
||||
if kind=='EMIT':
|
||||
separate=final.node_tree.nodes.new('ShaderNodeSeparateColor');final.node_tree.links.new(node.outputs['Color'],separate.inputs[0]);final.node_tree.links.new(separate.outputs['Green'],shader.inputs['Roughness']);final.node_tree.links.new(separate.outputs['Blue'],shader.inputs['Metallic'])
|
||||
low.modifiers['Transferred skeleton'].show_render=True;low.modifiers['Transferred skeleton'].show_viewport=True
|
||||
|
||||
|
||||
# Exposed arms use a dedicated skin material, so rays through close printed
|
||||
# contacts can never copy black clothing or hair onto their albedo.
|
||||
skin=final.copy();skin.name='Infernal exposed arm skin'
|
||||
shader=next(n for n in skin.node_tree.nodes if n.type=='BSDF_PRINCIPLED')
|
||||
for key,value in [('Base Color',(.36,.012,.022,1)),('Roughness',.58),('Metallic',0.0)]:
|
||||
socket=shader.inputs[key]
|
||||
for link in list(socket.links):skin.node_tree.links.remove(link)
|
||||
socket.default_value=value
|
||||
from infernal_seams import cloth_at_point
|
||||
low.data.materials.append(skin);region=low.data.attributes['SemanticRegion'].data
|
||||
for face in low.data.polygons:
|
||||
p=face.center
|
||||
zo=p.z+.15;a=abs(p.x)
|
||||
boundary=float(np.interp(zo,[1.,1.12,1.30,1.40,1.50,1.70],[.21,.21,.205,.15,.135,.135]))
|
||||
anatomical_arm=.96<zo<1.70 and a>boundary and a<.30 and -.075<p.y<.095
|
||||
if (all(region[index].value in [4,5] for index in face.vertices) or anatomical_arm) and not (zo>1.65 and p.y>.025 and a>.19) and not cloth_at_point(p):face.material_index=1
|
||||
@@ -0,0 +1,47 @@
|
||||
"""Continuous facial paint aligned to the supplied sculpt's actual landmarks."""
|
||||
import bpy,numpy as np
|
||||
|
||||
def apply_facepaint(material):
|
||||
size=1024
|
||||
xx=np.linspace(-.085,.085,size,dtype=np.float32)
|
||||
zz=np.linspace(1.76,1.98,size,dtype=np.float32)
|
||||
x,z=np.meshgrid(xx,zz);a=np.abs(x)
|
||||
pixels=np.zeros((size,size,4),dtype=np.float32)
|
||||
def paint(mask,color):
|
||||
pixels[mask,:3]=color;pixels[mask,3]=1
|
||||
eye_z=1.889+.20*(a-.031)
|
||||
ellipse=((a-.031)/.019)**2+((z-eye_z)/.0057)**2
|
||||
paint(ellipse<1.30,(.012,.003,.007))
|
||||
paint(ellipse<.90,(.32,.27,.16))
|
||||
iris=((a-.031)/.0057)**2+((z-eye_z)/.0064)**2
|
||||
paint((ellipse<.90)&(iris<1),(.18,.080,.005))
|
||||
paint((ellipse<.90)&(iris<.60),(.45,.24,.018))
|
||||
paint((ellipse<.90)&(abs(a-.031)<.0016),(.003,.002,.002))
|
||||
glint=((a-.029)/.0012)**2+((z-eye_z-.0022)/.0012)**2
|
||||
paint((ellipse<.90)&(glint<1),(.9,.85,.65))
|
||||
eyebrow_z=1.911+.22*(a-.030)-3.0*(a-.030)**2
|
||||
paint((abs(a-.031)<.024)&(abs(z-eyebrow_z)<.0025*(1-abs(a-.031)/.029)),(.010,.002,.005))
|
||||
lips=(x/.026)**2+((z-1.817)/.0080)**2
|
||||
paint(lips<1,(.075,.0025,.012))
|
||||
paint((lips<.75)&(z<1.817),(.15,.005,.025))
|
||||
line_z=1.819-.0018*np.cos(x/.026*np.pi)
|
||||
paint((lips<1)&(abs(z-line_z)<.00065),(.020,.001,.003))
|
||||
paint((lips<.5)&(z<1.815)&(z>1.814),(.22,.015,.035))
|
||||
image=bpy.data.images.new('Infernal aligned facial paint',width=size,height=size,alpha=True)
|
||||
image.colorspace_settings.name='Non-Color';image.pixels.foreach_set(pixels.ravel());image.pack()
|
||||
nodes=material.node_tree.nodes;links=material.node_tree.links
|
||||
geometry=nodes.new('ShaderNodeNewGeometry');split=nodes.new('ShaderNodeSeparateXYZ');links.new(geometry.outputs['Position'],split.inputs[0])
|
||||
def math_node(operation,socket,value):
|
||||
node=nodes.new('ShaderNodeMath');node.operation=operation;links.new(socket,node.inputs[0]);node.inputs[1].default_value=value;return node.outputs[0]
|
||||
u=math_node('MULTIPLY_ADD',split.outputs['X'],1/.17)
|
||||
# MULTIPLY_ADD has a separate add input.
|
||||
u.node.inputs[2].default_value=.5
|
||||
v=math_node('MULTIPLY_ADD',split.outputs['Z'],1/.22);v.node.inputs[2].default_value=-1.61/.22
|
||||
vector=nodes.new('ShaderNodeCombineXYZ');links.new(u,vector.inputs['X']);links.new(v,vector.inputs['Y'])
|
||||
texture=nodes.new('ShaderNodeTexImage');texture.image=image;texture.extension='CLIP';links.new(vector.outputs[0],texture.inputs['Vector'])
|
||||
front=math_node('LESS_THAN',split.outputs['Y'],.015)
|
||||
alpha=nodes.new('ShaderNodeMath');alpha.operation='MULTIPLY';links.new(front,alpha.inputs[0]);links.new(texture.outputs['Alpha'],alpha.inputs[1])
|
||||
shader=next(n for n in nodes if n.type=='BSDF_PRINCIPLED')
|
||||
mix=nodes.new('ShaderNodeMixRGB');mix.blend_type='MIX';mix.inputs[1].default_value=shader.inputs['Base Color'].default_value
|
||||
if shader.inputs['Base Color'].is_linked:links.new(shader.inputs['Base Color'].links[0].from_socket,mix.inputs[1])
|
||||
links.new(alpha.outputs[0],mix.inputs[0]);links.new(texture.outputs['Color'],mix.inputs[2]);links.new(mix.outputs[0],shader.inputs['Base Color'])
|
||||
@@ -0,0 +1,126 @@
|
||||
"""Paint contours traced from orthographic renders of the actual supplied sculpt.
|
||||
Body guides: 1400 px, ortho .96 m, focus original Z 1.45.
|
||||
Boot guides: 1400 px, ortho .62 m, focus original Z .42.
|
||||
"""
|
||||
import bpy,numpy as np
|
||||
from pathlib import Path
|
||||
from mathutils import Vector
|
||||
from mathutils.kdtree import KDTree
|
||||
_FILL_CLOTH=None
|
||||
_FILL_SKIN=None
|
||||
_MASKS={}
|
||||
_DEPTHS={}
|
||||
|
||||
FRONT=[(525,416),(550,420),(570,432),(590,436),(602,458),(620,469),(630,486),(648,499),(663,520),(679,542),(690,550),(700,542),(710,554),(729,528),(746,503),(761,485),(775,465),(790,451),(806,435),(823,423),(839,418),(862,406),(884,443),(905,480),(919,528),(917,567),(907,610),(889,627),(866,690),(860,758),(875,820),(914,866),(1007,931),(1020,937),(1012,964),(994,980),(967,993),(948,1008),(920,1019),(897,1025),(883,1052),(867,1045),(853,1022),(826,1040),(805,1037),(792,1065),(777,1090),(753,1119),(731,1145),(713,1170),(700,1185),(688,1184),(673,1164),(648,1142),(628,1115),(609,1094),(591,1069),(578,1041),(568,1043),(557,1034),(547,1007),(532,1000),(509,1023),(498,1013),(486,988),(464,978),(444,1009),(429,1007),(415,977),(405,947),(387,939),(397,918),(430,902),(464,880),(492,863),(503,844),(510,798),(514,745),(512,707),(506,668),(499,630),(476,612),(461,583),(458,549),(464,505),(478,465),(496,434)]
|
||||
COLLAR=[(622,201),(641,207),(663,215),(683,227),(700,237),(720,226),(741,214),(774,199),(775,231),(777,263),(784,284),(814,303),(782,314),(782,340),(767,320),(746,325),(737,344),(718,353),(713,376),(700,403),(685,376),(680,352),(658,344),(650,323),(631,321),(621,334),(620,320),(596,324),(612,301),(621,275),(621,234)]
|
||||
BACK=[(548,380),(852,380),(863,550),(862,730),(883,808),(913,861),(950,901),(980,934),(1000,965),(982,994),(964,1005),(944,1007),(935,979),(916,995),(899,1013),(881,1012),(875,974),(854,991),(844,1025),(824,1028),(817,1007),(811,1052),(794,1102),(778,1143),(764,1168),(745,1158),(750,1120),(755,1080),(739,1052),(713,1037),(686,1037),(661,1050),(637,1079),(614,1112),(590,1141),(569,1156),(554,1135),(558,1095),(572,1055),(588,1025),(574,1006),(565,1029),(549,1026),(539,1006),(524,1026),(506,1019),(503,992),(485,986),(478,1009),(462,1015),(449,998),(434,985),(419,995),(408,979),(414,951),(432,919),(465,888),(488,866),(510,844),(520,798),(527,740),(531,648),(536,533)]
|
||||
BOOT_FRONT=[(0,301),(392,298),(420,302),(450,301),(464,296),(465,278),(480,270),(510,264),(550,261),(590,261),(620,263),(640,269),(644,284),(659,290),(681,291),(699,282),(718,294),(745,303),(750,280),(770,271),(806,264),(847,262),(885,264),(921,270),(938,279),(938,298),(964,303),(1009,299),(1400,301),(1400,1400),(0,1400)]
|
||||
BOOT_BACK=[(0,303),(395,299),(425,290),(465,280),(507,272),(548,264),(586,264),(620,267),(660,277),(700,285),(734,276),(780,268),(818,264),(850,264),(890,269),(938,281),(982,293),(1009,303),(1400,303),(1400,1400),(0,1400)]
|
||||
|
||||
def mask_image(name,polygons):
|
||||
if name in _MASKS:return bpy.data.images[name]
|
||||
size=2048;pixels=np.zeros((size,size,4),dtype=np.float32)
|
||||
for polygon in polygons:
|
||||
vertices=np.array(polygon,dtype=np.float64)*size/1400
|
||||
for row in range(size):
|
||||
yy=row+.5;cross=[]
|
||||
for a,b in zip(vertices,np.roll(vertices,-1,axis=0)):
|
||||
if (a[1]<=yy<b[1]) or (b[1]<=yy<a[1]):cross.append(a[0]+(yy-a[1])*(b[0]-a[0])/(b[1]-a[1]))
|
||||
cross.sort()
|
||||
for a,b in zip(cross[::2],cross[1::2]):
|
||||
lo=max(0,int(np.floor(a)));hi=min(size,int(np.ceil(b)))
|
||||
if hi>lo:pixels[size-1-row,lo:hi,:3]=1
|
||||
pixels[:,:,3]=1
|
||||
image=bpy.data.images.new(name,width=size,height=size,alpha=True);image.colorspace_settings.name='Non-Color';image.pixels.foreach_set(pixels.ravel());image.pack();_MASKS[name]=pixels;return image
|
||||
|
||||
def add_sculpt_seams(nodes,links,x,y,z):
|
||||
def math(operation,socket,value):
|
||||
n=nodes.new('ShaderNodeMath');n.operation=operation;links.new(socket,n.inputs[0])
|
||||
if isinstance(value,(int,float)):n.inputs[1].default_value=value
|
||||
else:links.new(value,n.inputs[1])
|
||||
return n.outputs[0]
|
||||
def sample(name,polygons,width,bottom,back=False):
|
||||
xx=math('MULTIPLY',x,-1) if back else x
|
||||
u=math('MULTIPLY_ADD',xx,1/width);u.node.inputs[2].default_value=.5
|
||||
v=math('MULTIPLY_ADD',z,1/width);v.node.inputs[2].default_value=-bottom/width
|
||||
vector=nodes.new('ShaderNodeCombineXYZ');links.new(u,vector.inputs['X']);links.new(v,vector.inputs['Y'])
|
||||
tex=nodes.new('ShaderNodeTexImage');tex.image=polygons if isinstance(polygons,bpy.types.Image) else mask_image(name,polygons);tex.extension='CLIP';links.new(vector.outputs[0],tex.inputs['Vector']);return tex.outputs['Color']
|
||||
side=math('MULTIPLY_ADD',y,12);side.node.inputs[2].default_value=.5
|
||||
side=math('MAXIMUM',math('MINIMUM',side,1),0)
|
||||
def blend(front,back):
|
||||
mix=nodes.new('ShaderNodeMixRGB');links.new(side,mix.inputs[0]);links.new(front,mix.inputs[1]);links.new(back,mix.inputs[2]);return mix.outputs[0]
|
||||
def visible(mask,depth):
|
||||
delta=math('SUBTRACT',math('ADD',y,.5),depth)
|
||||
near=math('LESS_THAN',math('ABSOLUTE',delta,0),.018)
|
||||
return math('MULTIPLY',mask,near)
|
||||
front=sample('Sculpt garment front',[FRONT,COLLAR],.96,.97)
|
||||
back=sample('Sculpt garment back',[BACK,COLLAR],.96,.97,True)
|
||||
front_depth=sample('Front depth',_DEPTHS['front'][0],.96,.97)
|
||||
back_depth=sample('Back depth',_DEPTHS['back'][0],.96,.97,True)
|
||||
body=math('MAXIMUM',visible(front,front_depth),visible(back,back_depth))
|
||||
boots=blend(sample('Sculpt boot rim front',[BOOT_FRONT],.62,.11),sample('Sculpt boot rim back',[BOOT_BACK],.62,.11,True))
|
||||
return math('MAXIMUM',body,boots)
|
||||
|
||||
|
||||
def prepare_depths(high):
|
||||
# Project onto the visible sculpt surface, not every surface behind it.
|
||||
# This keeps the black ruffle from being projected onto a nearby forearm.
|
||||
output=Path(__file__).resolve().parent.parent/'Demon_v0.19/captures/infernal'
|
||||
scene=bpy.data.scenes.new('Sculpt seam depth');scene.render.engine='BLENDER_EEVEE'
|
||||
scene.render.resolution_x=2048;scene.render.resolution_y=2048;scene.render.resolution_percentage=100;scene.render.film_transparent=True
|
||||
scene.render.image_settings.file_format='OPEN_EXR';scene.render.image_settings.color_depth='32';scene.render.image_settings.color_mode='RGBA'
|
||||
obj=high.copy();obj.hide_render=False;scene.collection.objects.link(obj)
|
||||
mat=bpy.data.materials.new('Surface depth');mat.use_nodes=True;n=mat.node_tree.nodes;l=mat.node_tree.links;n.clear()
|
||||
geo=n.new('ShaderNodeNewGeometry');split=n.new('ShaderNodeSeparateXYZ');l.new(geo.outputs['Position'],split.inputs[0])
|
||||
add=n.new('ShaderNodeMath');add.operation='ADD';l.new(split.outputs['Y'],add.inputs[0]);add.inputs[1].default_value=.5
|
||||
emission=n.new('ShaderNodeEmission');l.new(add.outputs[0],emission.inputs[0]);out=n.new('ShaderNodeOutputMaterial');l.new(emission.outputs[0],out.inputs[0]);scene.view_layers[0].material_override=mat
|
||||
data=bpy.data.cameras.new('Seam projection camera');camera=bpy.data.objects.new('Seam projection camera',data);scene.collection.objects.link(camera);scene.camera=camera;data.type='ORTHO';data.ortho_scale=.96
|
||||
for side,yy in [('front',-6),('back',6)]:
|
||||
camera.location=(0,yy,1.30);camera.rotation_euler=(Vector((0,0,1.30))-camera.location).to_track_quat('-Z','Y').to_euler()
|
||||
scene.render.filepath=str(output/('seam-depth-'+side+'.exr'));bpy.ops.render.render(scene=scene.name,write_still=True)
|
||||
image=bpy.data.images.load(scene.render.filepath,check_existing=False);pixels=np.array(image.pixels[:],dtype=np.float32).reshape(2048,2048,4);_DEPTHS[side]=(image,pixels)
|
||||
bpy.data.objects.remove(obj,do_unlink=True);bpy.data.objects.remove(camera,do_unlink=True);bpy.data.scenes.remove(scene)
|
||||
mask_image('Sculpt garment front',[FRONT,COLLAR]);mask_image('Sculpt garment back',[BACK,COLLAR])
|
||||
prepare_hidden_fill(high)
|
||||
|
||||
def cloth_at_point(point):
|
||||
x,y,z=point;z+=.15;seen=False
|
||||
for side in ['front','back']:
|
||||
xx=-x if side=='back' else x
|
||||
u=(xx/.96+.5)*2048;v=(z-.97)/.96*2048
|
||||
if not (0<=u<2048 and 0<=v<2048):continue
|
||||
column=int(u);row=int(v)
|
||||
mask=_MASKS['Sculpt garment '+side][row,column,0]
|
||||
depth=_DEPTHS[side][1][row,column,0]
|
||||
if abs(y+.5-depth)<.018:
|
||||
seen=True
|
||||
if mask>.5:return True
|
||||
if not seen and _FILL_CLOTH is not None and 1.09<z<1.85 and abs(x)<.26:
|
||||
_,_,a=_FILL_CLOTH.find(point);_,_,b=_FILL_SKIN.find(point)
|
||||
return a<b and a<.07
|
||||
return False
|
||||
|
||||
def prepare_hidden_fill(high):
|
||||
global _FILL_CLOTH,_FILL_SKIN
|
||||
points=np.array([tuple(v.co) for v in high.data.vertices],dtype=np.float64);n=len(points)
|
||||
visible=np.zeros(n,dtype=bool);clothing=np.zeros(n,dtype=bool)
|
||||
original_z=points[:,2]+.15
|
||||
for side,sign in [('front',1),('back',-1)]:
|
||||
cols=np.clip(((points[:,0]*sign/.96+.5)*2048).astype(int),0,2047)
|
||||
rows=np.clip(((original_z-.97)/.96*2048).astype(int),0,2047)
|
||||
depth=_DEPTHS[side][1][rows,cols,0]
|
||||
mask=_MASKS['Sculpt garment '+side][rows,cols,0]>.5
|
||||
view=(abs(points[:,1]+.5-depth)<.006)&(original_z>.97)&(original_z<1.93)&(abs(points[:,0])<.48)
|
||||
visible|=view;clothing|=view&mask
|
||||
body=(original_z>1.09)&(original_z<1.85)&(abs(points[:,0])<.26)
|
||||
cloth_ids=np.flatnonzero(clothing&body);skin_ids=np.flatnonzero(visible&~clothing&body)
|
||||
_FILL_CLOTH=KDTree(len(cloth_ids));_FILL_SKIN=KDTree(len(skin_ids))
|
||||
for i in cloth_ids:_FILL_CLOTH.insert(points[i],int(i))
|
||||
for i in skin_ids:_FILL_SKIN.insert(points[i],int(i))
|
||||
_FILL_CLOTH.balance();_FILL_SKIN.balance()
|
||||
fill=np.zeros(n,dtype=np.float32)
|
||||
for i in np.flatnonzero(~visible&body):
|
||||
_,_,a=_FILL_CLOTH.find(points[i]);_,_,b=_FILL_SKIN.find(points[i])
|
||||
if a<b and a<.07:fill[i]=1
|
||||
attribute=high.data.attributes.new('GarmentHiddenFill','FLOAT','POINT');attribute.data.foreach_set('value',fill)
|
||||
print('INFERNAL seam interior fill',int(fill.sum()),'hidden sculpt vertices',flush=True)
|
||||
@@ -0,0 +1,73 @@
|
||||
"""Anatomical weights for STL arms; avoid rolling helper-bone discontinuities."""
|
||||
import numpy as np,bmesh
|
||||
from mathutils import Vector
|
||||
|
||||
def clean_arm_contacts(obj):
|
||||
if obj.get("arm_contacts_cleaned",False):return
|
||||
path=[Vector(p) for p in [(.150,.015,1.70),(.170,.025,1.57),(.190,.035,1.40),(.235,.005,1.25),(.257,-.015,1.10),(.270,-.035,1.00)]]
|
||||
bm=bmesh.new();bm.from_mesh(obj.data);region=bm.verts.layers.int.get('SemanticRegion');remove=[]
|
||||
# The printed boots touch at the centre. Split that contact into two capped
|
||||
# soles, otherwise one walking foot drags triangles from the other shoe.
|
||||
lower=[f for f in bm.faces if all(v[region]==0 and v.co.z<.96 for v in f.verts)]
|
||||
geom=set(lower)
|
||||
for f in lower:geom.update(f.verts);geom.update(f.edges)
|
||||
result=bmesh.ops.bisect_plane(bm,geom=list(geom),plane_co=(0,0,0),plane_no=(1,0,0),dist=1e-7)
|
||||
cut=[e for e in result['geom_cut'] if isinstance(e,bmesh.types.BMEdge)]
|
||||
if cut:bmesh.ops.split_edges(bm,edges=cut)
|
||||
for sign in [-1,1]:
|
||||
boundary=[e for e in bm.edges if e.is_boundary and all(v[region]==0 and abs(v.co.x)<1e-6 and v.co.z<.96 for v in e.verts) and e.link_faces and e.link_faces[0].calc_center_median().x*sign>0]
|
||||
if boundary:bmesh.ops.holes_fill(bm,edges=boundary,sides=0)
|
||||
foot_side=bm.verts.layers.int.new('FootSide')
|
||||
for vertex in bm.verts:
|
||||
if vertex[region]==0 and vertex.co.z<.95:
|
||||
sign=1 if sum(f.calc_center_median().x for f in vertex.link_faces)>0 else -1
|
||||
vertex[foot_side]=sign
|
||||
if abs(vertex.co.x)<1e-6:vertex.co.x=sign*.0003
|
||||
|
||||
for face in bm.faces:
|
||||
if not all(vertex[region] in [4,5] for vertex in face.verts):continue
|
||||
p=face.calc_center_median();p.x=abs(p.x);p.z+=.15
|
||||
if p.z<1.13 or p.z>1.65:continue
|
||||
distance=10
|
||||
for a,b in zip(path[:-1],path[1:]):
|
||||
delta=b-a;t=max(0,min(1,(p-a).dot(delta)/delta.length_squared));distance=min(distance,(p-a-delta*t).length)
|
||||
radius=.046 if p.z>1.30 else .042
|
||||
if distance>radius:remove.append(face)
|
||||
if remove:bmesh.ops.delete(bm,geom=remove,context='FACES')
|
||||
for side in [4,5]:
|
||||
edges=[e for e in bm.edges if e.is_boundary and all(v[region]==side for v in e.verts)]
|
||||
if edges:bmesh.ops.holes_fill(bm,edges=edges,sides=0)
|
||||
bmesh.ops.recalc_face_normals(bm,faces=list(bm.faces));bmesh.ops.triangulate(bm,faces=list(bm.faces));bm.to_mesh(obj.data);bm.free();obj.data.validate(clean_customdata=False);obj.data.update()
|
||||
obj['arm_contacts_cleaned']=True
|
||||
print('INFERNAL trimmed print-contact arm fins',len(remove),flush=True)
|
||||
|
||||
def refine_weights(obj):
|
||||
clean_arm_contacts(obj)
|
||||
attrs=obj.data.attributes['SemanticRegion'].data
|
||||
names={g.name:g for g in obj.vertex_groups}
|
||||
for vertex in obj.data.vertices:
|
||||
x,y,z=vertex.co;zo=z+.15;region=attrs[vertex.index].value
|
||||
if region==0 and z<.95:
|
||||
side='L' if x>0 else 'R'
|
||||
if z<.18:
|
||||
for group in list(vertex.groups):obj.vertex_groups[group.group].remove([vertex.index])
|
||||
names['foot.'+side].add([vertex.index],1,'REPLACE')
|
||||
else:
|
||||
for group in list(vertex.groups):
|
||||
name=obj.vertex_groups[group.group].name
|
||||
if name.endswith('.R' if side=='L' else '.L'):obj.vertex_groups[group.group].remove([vertex.index])
|
||||
total=sum(group.weight for group in vertex.groups)
|
||||
for group in list(vertex.groups):obj.vertex_groups[group.group].add([vertex.index],group.weight/max(total,1e-8),'REPLACE')
|
||||
if region not in [4,5]:continue
|
||||
side='L' if x>0 else 'R'
|
||||
if zo>1.65 and y>.085:
|
||||
weights={'Wing.'+side:1.0}
|
||||
else:
|
||||
wrist=float(np.clip((1.17-zo)/.08,0,1))
|
||||
upper=float(np.clip((zo-1.36)/.12,0,1))
|
||||
shoulder=float(np.clip((zo-1.62)/.09,0,1))
|
||||
weights={'wrist.'+side:wrist,'lowerarm01.'+side:(1-wrist)*(1-upper),'upperarm01.'+side:upper*(1-shoulder),'spine02':upper*shoulder}
|
||||
total=sum(weights.values())
|
||||
for group in list(vertex.groups):obj.vertex_groups[group.group].remove([vertex.index])
|
||||
for name,value in weights.items():
|
||||
if value>1e-5:names[name].add([vertex.index],value/total,'REPLACE')
|
||||
@@ -0,0 +1,68 @@
|
||||
"""Continuous PBR surface masks in object space; no triangle-sized paint edges."""
|
||||
import bpy,numpy as np
|
||||
from mathutils.kdtree import KDTree
|
||||
|
||||
def prepare_surface(high,low):
|
||||
from infernal_seams import prepare_depths
|
||||
prepare_depths(high)
|
||||
kd=KDTree(len(low.data.vertices));regions=low.data.attributes['SemanticRegion'].data
|
||||
for vertex in low.data.vertices:kd.insert(vertex.co,vertex.index)
|
||||
kd.balance()
|
||||
values=np.zeros(len(high.data.vertices),dtype=np.float32)
|
||||
arms=np.zeros(len(high.data.vertices),dtype=np.float32)
|
||||
for vertex in high.data.vertices:
|
||||
_,index,_=kd.find(vertex.co);role=regions[index].value
|
||||
x,y,z=vertex.co
|
||||
zo=z+.15;a=abs(x)
|
||||
boundary=float(np.interp(zo,[1.,1.12,1.30,1.40,1.50,1.70],[.21,.21,.205,.15,.135,.135]))
|
||||
arm=(role in [4,5] or (.96<zo<1.70 and a>boundary and -.075<y<.095 and a<.30)) and not (zo>1.65 and y>.025 and a>.19)
|
||||
arms[vertex.index]=1 if arm else 0
|
||||
values[vertex.index]=1 if (role in [1,2,3] or (a>.19 and y>.025 and zo>1.65)) and not arm else 0
|
||||
attribute=high.data.attributes.new('AppendageMask','FLOAT','POINT');attribute.data.foreach_set('value',values)
|
||||
arm_attr=high.data.attributes.new('ExposedArmMask','FLOAT','POINT');arm_attr.data.foreach_set('value',arms)
|
||||
material=bpy.data.materials.new('Infernal continuous surface paint');material.use_nodes=True
|
||||
high.data.materials.clear();high.data.materials.append(material)
|
||||
for face in high.data.polygons:face.material_index=0
|
||||
nodes=material.node_tree.nodes;links=material.node_tree.links
|
||||
def op(operation,*args):
|
||||
node=nodes.new('ShaderNodeMath');node.operation=operation
|
||||
for i,value in enumerate(args):
|
||||
if isinstance(value,(float,int)):node.inputs[i].default_value=value
|
||||
else:links.new(value,node.inputs[i])
|
||||
return node.outputs[0]
|
||||
def AND(*args):
|
||||
result=args[0]
|
||||
for v in args[1:]:result=op('MULTIPLY',result,v)
|
||||
return result
|
||||
def OR(*args):
|
||||
result=args[0]
|
||||
for v in args[1:]:result=op('MAXIMUM',result,v)
|
||||
return result
|
||||
def within(value,lo,hi):return AND(op('GREATER_THAN',value,lo),op('LESS_THAN',value,hi))
|
||||
geometry=nodes.new('ShaderNodeNewGeometry');split=nodes.new('ShaderNodeSeparateXYZ');links.new(geometry.outputs['Position'],split.inputs[0])
|
||||
x=split.outputs['X'];y=split.outputs['Y'];z=op('ADD',split.outputs['Z'],.15);a=op('ABSOLUTE',x)
|
||||
attr=nodes.new('ShaderNodeAttribute');attr.attribute_name='AppendageMask'
|
||||
appendage=attr.outputs['Fac']
|
||||
arm_attr=nodes.new('ShaderNodeAttribute');arm_attr.attribute_name='ExposedArmMask';exposed=op('SUBTRACT',1,arm_attr.outputs['Fac'])
|
||||
hairline=op('SUBTRACT',1.968,op('MULTIPLY',a,.7))
|
||||
hair=OR(AND(op('LESS_THAN',a,.19),op('GREATER_THAN',z,hairline)),AND(op('LESS_THAN',a,.17),op('GREATER_THAN',y,.078),op('GREATER_THAN',z,1.30)),AND(within(a,.072,.215),op('LESS_THAN',y,.045),op('GREATER_THAN',z,1.52)),op('GREATER_THAN',z,1.99))
|
||||
from infernal_seams import add_sculpt_seams
|
||||
clothes=add_sculpt_seams(nodes,links,x,y,z)
|
||||
interior=nodes.new('ShaderNodeAttribute');interior.attribute_name='GarmentHiddenFill'
|
||||
clothes=OR(clothes,interior.outputs['Fac'])
|
||||
hair=AND(OR(hair,AND(within(a,.05,.19),op("GREATER_THAN",y,-.025),op("GREATER_THAN",z,1.68))),exposed)
|
||||
shader=next(n for n in nodes if n.type=='BSDF_PRINCIPLED')
|
||||
def mix_color(socket,mask,color):
|
||||
mix=nodes.new('ShaderNodeMixRGB');links.new(mask,mix.inputs[0])
|
||||
if hasattr(socket,'node'):links.new(socket,mix.inputs[1])
|
||||
else:mix.inputs[1].default_value=(*socket,1)
|
||||
mix.inputs[2].default_value=(*color,1)
|
||||
return mix.outputs[0]
|
||||
color=mix_color((.36,.012,.022),clothes,(.012,.015,.019))
|
||||
color=mix_color(color,hair,(.008,.009,.012));color=mix_color(color,appendage,(.014,.016,.019));links.new(color,shader.inputs['Base Color'])
|
||||
# Matte skin and restrained leather highlights preserve the sculpted detail.
|
||||
rough=op('SUBTRACT',.58,op('MULTIPLY',clothes,.14));rough=op('SUBTRACT',rough,op('MULTIPLY',hair,.08))
|
||||
links.new(rough,shader.inputs['Roughness']);shader.inputs['Metallic'].default_value=.03
|
||||
from infernal_facepaint import apply_facepaint
|
||||
apply_facepaint(material)
|
||||
return [material]
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Preserve the old animated whip and bind it to the retargeted right wrist."""
|
||||
import bpy
|
||||
|
||||
def transfer_whip(scene,source,target):
|
||||
whip=next((o for o in scene.objects if o.type=='MESH' and 'Flexible braided whip' in o.name),None)
|
||||
if whip is None:return None
|
||||
transform=target.data.bones['wrist.R'].matrix_local@source.data.bones['wrist.R'].matrix_local.inverted()
|
||||
if whip.data.shape_keys:
|
||||
for key in whip.data.shape_keys.key_blocks:
|
||||
for point in key.data:point.co=transform@point.co
|
||||
else:
|
||||
for vertex in whip.data.vertices:vertex.co=transform@vertex.co
|
||||
# Increase the actual cord radius, retaining its centreline and morph clips.
|
||||
whip.data.update()
|
||||
offsets=[vertex.normal.normalized()*.008 for vertex in whip.data.vertices]
|
||||
if whip.data.shape_keys:
|
||||
for key in whip.data.shape_keys.key_blocks:
|
||||
for point,offset in zip(key.data,offsets):point.co+=offset
|
||||
else:
|
||||
for vertex,offset in zip(whip.data.vertices,offsets):vertex.co+=offset
|
||||
whip.parent=target;whip.name='Infernal animated whip';whip.hide_render=False
|
||||
for modifier in whip.modifiers:
|
||||
if modifier.type=='ARMATURE':modifier.object=target
|
||||
if whip.data.shape_keys and whip.data.shape_keys.animation_data:
|
||||
whip.data.shape_keys.animation_data.action=None
|
||||
for track in whip.data.shape_keys.animation_data.nla_tracks:track.mute=False
|
||||
return whip
|
||||
@@ -0,0 +1,35 @@
|
||||
import bpy
|
||||
import json
|
||||
from pathlib import Path
|
||||
from mathutils import Vector
|
||||
|
||||
root=Path(__file__).resolve().parent.parent
|
||||
out=root/'Demon_v0.19/captures/infernal-inspect';out.mkdir(parents=True,exist_ok=True)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
bpy.ops.wm.stl_import(filepath=str(root/'tools/model_sources/infernal.stl'))
|
||||
model=bpy.context.object;model.name='Infernal source - untouched statue'
|
||||
original=list(model.dimensions)
|
||||
model.scale*=2.2/model.dimensions.z
|
||||
bpy.context.view_layer.update()
|
||||
points=[model.matrix_world@Vector(c) for c in model.bound_box]
|
||||
lo=Vector(tuple(min(p[i] for p in points) for i in range(3)));hi=Vector(tuple(max(p[i] for p in points) for i in range(3)))
|
||||
model.location-=Vector(((lo.x+hi.x)/2,(lo.y+hi.y)/2,lo.z))
|
||||
bpy.ops.object.transform_apply(location=True,rotation=True,scale=True)
|
||||
scene=bpy.context.scene;scene.render.engine='BLENDER_WORKBENCH'
|
||||
scene.render.resolution_x=1100;scene.render.resolution_y=1100;scene.render.resolution_percentage=100
|
||||
scene.display.shading.light='STUDIO';scene.display.shading.color_type='SINGLE';scene.display.shading.single_color=(.58,.58,.61)
|
||||
scene.display.shading.show_cavity=True;scene.display.shading.cavity_type='BOTH';scene.display.shading.curvature_ridge_factor=1.2;scene.display.shading.curvature_valley_factor=1.0
|
||||
scene.display.shading.background_type='WORLD';scene.world=bpy.data.worlds.new('Inspection background');scene.world.color=(.10,.11,.13)
|
||||
scene.view_settings.view_transform='Standard'
|
||||
camera_data=bpy.data.cameras.new('Inspection Camera');camera=bpy.data.objects.new('Inspection Camera',camera_data);scene.collection.objects.link(camera);scene.camera=camera
|
||||
camera_data.type='ORTHO';camera_data.ortho_scale=max(2.55,model.dimensions.x*1.15)
|
||||
focus=Vector((0,0,1.1))
|
||||
for name,at in [('front',(0,-6,1.15)),('back',(0,6,1.15)),('side',(6,0,1.15)),('angle',(4,-6,2.9))]:
|
||||
camera.location=at;camera.rotation_euler=(focus-camera.location).to_track_quat('-Z','Y').to_euler()
|
||||
scene.render.filepath=str(out/(name+'.png'));bpy.ops.render.render(write_still=True)
|
||||
coords=[v.co.z for v in model.data.vertices]
|
||||
import numpy as np
|
||||
report={'source_dimensions':original,'normalized_dimensions':list(model.dimensions),'vertices':len(model.data.vertices),'triangles':len(model.data.polygons),'z_percentiles':np.percentile(coords,[0,1,3,5,10,15,20,25,50,75,95,100]).tolist()}
|
||||
(out/'source_report.json').write_text(json.dumps(report,indent=2))
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(out/'source_inspection.blend'))
|
||||
print('INFERNAL_INSPECT',json.dumps(report),flush=True)
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"provided_by_user": true,
|
||||
"source_archive": "infernal.zip",
|
||||
"archive_entry": "infernal .stl",
|
||||
"source_stl_sha256": "9a0bad3fe47628b07b2bac1af2a22dbebc153f7bf4274346822515aab2801d3e",
|
||||
"color_reference": "color_reference.png",
|
||||
"color_reference_sha256": "34d8c86eb62cc36bb8dac449be8601893cb80c6b5f19e33dae563d5658d6a877",
|
||||
"animation_source": "Demon_v0.19/art/succubus/succubus_v02.glb",
|
||||
"paint_boundary_reference": "approved_paint_boundary.png",
|
||||
"paint_boundary_sha256": "3193824095b8eafb02e0771085e00bc3b9d303f5d53e777972d11b63d71d6e8c"
|
||||
}
|
||||
|
After Width: | Height: | Size: 663 KiB |
|
After Width: | Height: | Size: 227 KiB |
@@ -0,0 +1,188 @@
|
||||
"""Build an approval-only shoe revision; keep the production GLB unchanged."""
|
||||
from pathlib import Path
|
||||
import copy
|
||||
import json
|
||||
import struct
|
||||
import numpy as np
|
||||
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
source = root / 'Demon_v0.19/art/succubus/succubus_v02.glb'
|
||||
target = root / 'Demon_v0.19/reviews/heels_v01/succubus_heels.glb'
|
||||
raw = source.read_bytes()
|
||||
length = struct.unpack_from('<I', raw, 12)[0]
|
||||
doc = json.loads(raw[20:20+length])
|
||||
blob = bytearray(raw[28+length:])
|
||||
types = {5126:'<f4', 5125:'<u4', 5123:'<u2', 5121:'u1'}
|
||||
sizes = {'SCALAR':1, 'VEC2':2, 'VEC3':3, 'VEC4':4, 'MAT4':16}
|
||||
def read(i):
|
||||
a = doc['accessors'][i]; v = doc['bufferViews'][a['bufferView']]
|
||||
return np.frombuffer(blob, types[a['componentType']], a['count']*sizes[a['type']],
|
||||
v.get('byteOffset',0)+a.get('byteOffset',0)).reshape(-1,sizes[a['type']]).copy()
|
||||
def accessor(data, kind, component=5126):
|
||||
data = np.asarray(data,dtype=types[component]); blob.extend(b'\0'*((-len(blob))%4))
|
||||
offset=len(blob); blob.extend(data.tobytes()); view=len(doc['bufferViews'])
|
||||
doc['bufferViews'].append({'buffer':0,'byteOffset':offset,'byteLength':data.nbytes})
|
||||
a={'bufferView':view,'componentType':component,'count':len(data),'type':kind}
|
||||
if kind=='VEC3': a.update(min=data.min(axis=0).tolist(),max=data.max(axis=0).tolist())
|
||||
doc['accessors'].append(a); return len(doc['accessors'])-1
|
||||
|
||||
joints = doc['skins'][0]['joints']
|
||||
foot_ids = {side:joints.index(next(i for i,n in enumerate(doc['nodes']) if n.get('name')=='foot.'+side)) for side in ['L','R']}
|
||||
# Move the anatomical ankle above the raised heel, and rebind only these joints.
|
||||
# Merely raising shoe vertices leaves a bare-foot ankle pivot inside the heel.
|
||||
inverse=read(doc['skins'][0]['inverseBindMatrices']).reshape(-1,4,4).transpose(0,2,1)
|
||||
bind=np.linalg.inv(inverse);parents={child:i for i,node in enumerate(doc['nodes']) for child in node.get('children',[])}
|
||||
joint_map={node:i for i,node in enumerate(joints)};translation_delta={}
|
||||
for side in ['L','R']:
|
||||
joint=foot_ids[side];node=joints[joint];parent=parents[node]
|
||||
delta=np.linalg.inv(bind[joint_map[parent],:3,:3])@np.array([0,.080,0])
|
||||
doc['nodes'][node]['translation']=(np.array(doc['nodes'][node]['translation'])+delta).tolist();translation_delta[node]=delta
|
||||
new_bind=bind[joint].copy();new_bind[1,3]+=.080
|
||||
for child in doc['nodes'][node].get('children',[]):
|
||||
if child not in joint_map:continue
|
||||
local_bind=np.linalg.inv(new_bind)@bind[joint_map[child]]
|
||||
old=np.array(doc['nodes'][child]['translation']);translation_delta[child]=local_bind[:3,3]-old
|
||||
doc['nodes'][child]['translation']=local_bind[:3,3].tolist()
|
||||
inverse[joint]=np.linalg.inv(new_bind)
|
||||
doc['skins'][0]['inverseBindMatrices']=accessor(inverse.transpose(0,2,1).reshape(-1,16),'MAT4')
|
||||
for animation in doc.get('animations',[]):
|
||||
for channel in animation['channels']:
|
||||
target_node=channel['target'].get('node')
|
||||
if channel['target']['path']!='translation' or target_node not in translation_delta:continue
|
||||
sampler=animation['samplers'][channel['sampler']]
|
||||
sampler['output']=accessor(read(sampler['output'])+translation_delta[target_node],'VEC3')
|
||||
initial=copy.deepcopy(doc['meshes'][1]['primitives'][:-2]) # Replace the old open-ended heel columns.
|
||||
primitives=[]
|
||||
wing_ids=[joints.index(next(i for i,n in enumerate(doc['nodes']) if n.get('name')=='Wing.'+side)) for side in ['L','R']]
|
||||
doc['materials'][17]['pbrMetallicRoughness'].update(baseColorFactor=[.012,.014,.017,1],metallicFactor=.04,roughnessFactor=.27)
|
||||
sole_material=len(doc['materials'])
|
||||
doc['materials'].append({'name':'Dark tan outsole edge','pbrMetallicRoughness':{'baseColorFactor':[.15,.105,.065,1],'roughnessFactor':.62}})
|
||||
for p in initial:
|
||||
attr=p['attributes']; v=read(attr['POSITION'])
|
||||
if not {'JOINTS_0','WEIGHTS_0'}<=attr.keys():continue
|
||||
j=read(attr['JOINTS_0']); w=read(attr['WEIGHTS_0'])
|
||||
faces=read(p['indices']).reshape(-1,3).astype(np.int64)
|
||||
old_wing=(np.isin(j,wing_ids)*w).sum(axis=1)>.25
|
||||
faces=faces[~old_wing[faces].any(axis=1)]
|
||||
if p['material'] in [0,4,10]:
|
||||
center=v[faces].mean(axis=1);x=center[:,0]
|
||||
cup_top=1.313-.060*np.exp(-(x/.037)**2)+.018*np.exp(-((np.abs(x)-.105)/.055)**2)
|
||||
trim=(center[:,1]>cup_top)&(center[:,1]<1.385)&(center[:,2]>.07)&(np.abs(x)<.225)
|
||||
faces=faces[~trim]
|
||||
if p['material']==3:
|
||||
arm_ids=[k for k,node in enumerate(joints) if 'arm' in doc['nodes'][node].get('name','')]
|
||||
arm=(np.isin(j,arm_ids)*w).sum(axis=1)>.30
|
||||
faces=faces[~arm[faces].any(axis=1)]
|
||||
faces=faces[v[faces].mean(axis=1)[:,1]>1.045]
|
||||
if p['material'] in [4,10]:
|
||||
center=v[faces].mean(axis=1)
|
||||
faces=faces[~((center[:,1]>.12)&(center[:,1]<.74)&(np.abs(center[:,0])<.30))]
|
||||
if not len(faces):continue
|
||||
p['indices']=accessor(faces.reshape(-1,1),'SCALAR',5125)
|
||||
if p['material'] in [0,1,10,16,17]:
|
||||
mask=(v[:,1]<.17)&(v[:,2]>.09)&(np.abs(v[:,0])<.3)
|
||||
t=np.clip((v[mask,2]-.09)/.15,0,1)
|
||||
center=np.sign(v[mask,0])*.1745
|
||||
v[mask,0]=center+(v[mask,0]-center)*(1-.78*t*t)
|
||||
v[mask,2]+=.046*t*t
|
||||
foot=(v[:,1]<.145)&(np.abs(v[:,0])<.3)
|
||||
bottom=np.interp(v[foot,2],[-.06,-.025,.025,.080,.135,.190,.230,.285],[.105,.107,.091,.050,.013,.008,.010,.015])
|
||||
v[foot,1]=np.maximum(v[foot,1],bottom+.015)
|
||||
attr['POSITION']=accessor(v,'VEC3')
|
||||
faces=read(p['indices']).reshape(-1,3).astype(np.int64)
|
||||
normal=np.zeros_like(v);cross=np.cross(v[faces[:,1]]-v[faces[:,0]],v[faces[:,2]]-v[faces[:,0]])
|
||||
for k in range(3):np.add.at(normal,faces[:,k],cross)
|
||||
normal/=np.maximum(np.linalg.norm(normal,axis=1,keepdims=True),1e-12)
|
||||
attr['NORMAL']=accessor(normal,'VEC3');attr.pop('TANGENT',None)
|
||||
for i in np.flatnonzero((v[:,1]<.14)&(np.abs(v[:,0])<.30)):
|
||||
side='L' if v[i,0]>0 else 'R'; foot=foot_ids[side]
|
||||
# Shoes must not flex with the toes: a stiletto and sole are one rigid piece.
|
||||
if v[i,1]<.105 or p['material'] in [0,10]:
|
||||
j[i]=[foot,0,0,0]; w[i]=[1,0,0,0]
|
||||
attr['JOINTS_0']=accessor(j,'VEC4',5123);attr['WEIGHTS_0']=accessor(w,'VEC4')
|
||||
primitives.append(p)
|
||||
|
||||
def mesh(vertices, faces, foot, material,smooth=False):
|
||||
vertices=np.asarray(vertices,dtype='<f4');faces=np.asarray(faces,dtype=np.int64)
|
||||
cross=np.cross(vertices[faces[:,1]]-vertices[faces[:,0]],vertices[faces[:,2]]-vertices[faces[:,0]])
|
||||
faces=faces[np.linalg.norm(cross,axis=1)>1e-10]
|
||||
# Flat faces preserve crisp bevels on leather panels, soles and heels.
|
||||
pos=vertices[faces].reshape(-1,3);normal=np.cross(vertices[faces[:,1]]-vertices[faces[:,0]],vertices[faces[:,2]]-vertices[faces[:,0]])
|
||||
normal/=np.maximum(np.linalg.norm(normal,axis=1,keepdims=True),1e-12)
|
||||
normals=np.repeat(normal,3,axis=0)
|
||||
if smooth:
|
||||
averaged=np.zeros_like(vertices)
|
||||
for k in range(3):np.add.at(averaged,faces[:,k],normal)
|
||||
averaged/=np.maximum(np.linalg.norm(averaged,axis=1,keepdims=True),1e-12)
|
||||
normals=averaged[faces].reshape(-1,3)
|
||||
attr={'POSITION':accessor(pos,'VEC3'),'NORMAL':accessor(normals,'VEC3'),
|
||||
'JOINTS_0':accessor(np.tile([foot,0,0,0],(len(pos),1)),'VEC4',5123),
|
||||
'WEIGHTS_0':accessor(np.tile([1,0,0,0],(len(pos),1)),'VEC4')}
|
||||
primitives.append({'attributes':attr,'material':material,'indices':accessor(np.arange(len(pos)).reshape(-1,1),'SCALAR',5125)})
|
||||
|
||||
for side,sign in [('L',1),('R',-1)]:
|
||||
x=sign*.1745;foot=foot_ids[side]
|
||||
vertices=[];faces=[];rings=[(.006,.026,.031,-.040),(.018,.025,.030,-.039),(.078,.028,.032,-.030),(.112,.031,.034,-.024)]
|
||||
outline=[(-.72,-1),(.72,-1),(1,-.72),(1,.72),(.72,1),(-.72,1),(-1,.72),(-1,-.72)]
|
||||
for y,rx,rz,z in rings:
|
||||
for dx,dz in outline:vertices.append([x+dx*rx,y,z+dz*rz])
|
||||
for ring in range(3):
|
||||
for n in range(8):
|
||||
a=ring*8+n;b=ring*8+(n+1)%8;c=b+8;d=a+8;faces.extend([[a,c,b],[a,d,c]])
|
||||
for n in range(1,7):faces.extend([[0,n,n+1],[24,24+n+1,24+n]])
|
||||
mesh(vertices,faces,foot,17)
|
||||
# Closed sculpted outsole: raised heel seat, concave arch, low forefoot.
|
||||
sections=[(-.060,.021,.105),(-.025,.040,.107),(.025,.042,.091),(.080,.038,.050),(.135,.043,.013),(.190,.033,.008),(.250,.015,.010),(.285,.002,.015)]
|
||||
vertices=[];faces=[]
|
||||
for z,width,y in sections:
|
||||
vertices.extend([[x-width,y,z],[x+width,y,z],[x+width,y+.013,z],[x-width,y+.013,z]])
|
||||
for n in range(len(sections)-1):
|
||||
for edge in range(4):
|
||||
a=n*4+edge;b=n*4+(edge+1)%4;c=b+4;d=a+4;faces.extend([[a,b,c],[a,c,d]])
|
||||
faces.extend([[0,2,1],[0,3,2]]);a=(len(sections)-1)*4;faces.extend([[a,a+1,a+2],[a,a+2,a+3]])
|
||||
mesh(vertices,faces,foot,sole_material)
|
||||
|
||||
from succubus_review_outfit import augment
|
||||
augment(doc,read,mesh,primitives,accessor)
|
||||
primitives=[p for p in primitives if doc['accessors'][p['indices']]['count']>0 and doc['accessors'][p['attributes']['POSITION']]['count']>0]
|
||||
doc['meshes'][1]['primitives']=primitives
|
||||
doc['meshes'][1]['name']='Approval only - red bat corset, black block heel boots and curved wings'
|
||||
# Remove superseded buffer data, so the approval model remains portable.
|
||||
used=set()
|
||||
for m in doc['meshes']:
|
||||
for p in m['primitives']:
|
||||
used.update(p['attributes'].values())
|
||||
if 'indices' in p:used.add(p['indices'])
|
||||
for morph in p.get('targets',[]):used.update(morph.values())
|
||||
for skin in doc['skins']:
|
||||
if 'inverseBindMatrices' in skin:used.add(skin['inverseBindMatrices'])
|
||||
for animation in doc.get('animations',[]):
|
||||
for sampler in animation['samplers']:used.update([sampler['input'],sampler['output']])
|
||||
mapping={old:new for new,old in enumerate(sorted(used))}
|
||||
doc['accessors']=[doc['accessors'][old] for old in sorted(used)]
|
||||
for m in doc['meshes']:
|
||||
for p in m['primitives']:
|
||||
p['attributes']={key:mapping[value] for key,value in p['attributes'].items()}
|
||||
if 'indices' in p:p['indices']=mapping[p['indices']]
|
||||
p['targets']=[{key:mapping[value] for key,value in morph.items()} for morph in p.get('targets',[])] if 'targets' in p else []
|
||||
for skin in doc['skins']:
|
||||
if 'inverseBindMatrices' in skin:skin['inverseBindMatrices']=mapping[skin['inverseBindMatrices']]
|
||||
for animation in doc.get('animations',[]):
|
||||
for sampler in animation['samplers']:
|
||||
sampler['input']=mapping[sampler['input']];sampler['output']=mapping[sampler['output']]
|
||||
used_views={a['bufferView'] for a in doc['accessors']}
|
||||
used_views.update(i['bufferView'] for i in doc.get('images',[]) if 'bufferView' in i)
|
||||
view_map={old:new for new,old in enumerate(sorted(used_views))};new_blob=bytearray();views=[]
|
||||
for old in sorted(used_views):
|
||||
view=copy.deepcopy(doc['bufferViews'][old]);start=view.get('byteOffset',0)
|
||||
new_blob.extend(b'\0'*((-len(new_blob))%4));view['byteOffset']=len(new_blob)
|
||||
new_blob.extend(blob[start:start+view['byteLength']]);views.append(view)
|
||||
for a in doc['accessors']:a['bufferView']=view_map[a['bufferView']]
|
||||
for image in doc.get('images',[]):
|
||||
if 'bufferView' in image:image['bufferView']=view_map[image['bufferView']]
|
||||
doc['bufferViews']=views;blob=new_blob
|
||||
doc['buffers'][0]['byteLength']=len(blob)
|
||||
data=json.dumps(doc,separators=(',',':')).encode();data+=b' '*((-len(data))%4);blob.extend(b'\0'*((-len(blob))%4))
|
||||
target.parent.mkdir(parents=True,exist_ok=True)
|
||||
target.write_bytes(struct.pack('<III',0x46546c67,2,28+len(data)+len(blob))+struct.pack('<II',len(data),0x4e4f534a)+data+struct.pack('<II',len(blob),0x004e4942)+blob)
|
||||
print('Review GLB:',target,'bytes:',target.stat().st_size,'foot joints:',foot_ids)
|
||||
@@ -0,0 +1,41 @@
|
||||
"""Clip material boundaries through triangles instead of painting whole faces."""
|
||||
import numpy as np
|
||||
|
||||
def split_material(primitive, selected, signed_distance, positive_material, negative_material, doc, read, accessor):
|
||||
faces=read(primitive['indices']).reshape(-1,3).astype(np.int64)
|
||||
arrays={key:read(value) for key,value in primitive['attributes'].items()}
|
||||
output=[]
|
||||
def clip(poly,values,sign):
|
||||
result=[]
|
||||
for i,a in enumerate(poly):
|
||||
b=poly[(i+1)%len(poly)];va=float(a@values)*sign;vb=float(b@values)*sign
|
||||
if va>=0:result.append(a)
|
||||
if (va>=0)!=(vb>=0):result.append(a+(b-a)*(va/(va-vb)))
|
||||
return result
|
||||
for sign,material in [(1,positive_material),(-1,negative_material)]:
|
||||
if material is None:continue
|
||||
rows={key:[] for key in arrays}
|
||||
for face in faces[selected]:
|
||||
values=np.array([signed_distance(p) for p in arrays['POSITION'][face]])
|
||||
poly=clip(list(np.eye(3)),values,sign)
|
||||
for i in range(1,len(poly)-1):
|
||||
for bary in [poly[0],poly[i],poly[i+1]]:
|
||||
for key,array in arrays.items():
|
||||
if key in ['JOINTS_0','WEIGHTS_0']:continue
|
||||
value=bary@array[face]
|
||||
if key=='NORMAL':value/=max(np.linalg.norm(value),1e-12)
|
||||
rows[key].append(value)
|
||||
weights={}
|
||||
for corner in range(3):
|
||||
for joint,weight in zip(arrays['JOINTS_0'][face[corner]],arrays['WEIGHTS_0'][face[corner]]):
|
||||
weights[int(joint)]=weights.get(int(joint),0)+float(weight)*bary[corner]
|
||||
pairs=sorted(weights.items(),key=lambda x:-x[1])[:4];pairs+=[(0,0)]*(4-len(pairs));total=max(sum(w for _,w in pairs),1e-12)
|
||||
rows['JOINTS_0'].append([j for j,_ in pairs]);rows['WEIGHTS_0'].append([w/total for _,w in pairs])
|
||||
if not rows['POSITION']:continue
|
||||
attrs={}
|
||||
for key,values in rows.items():
|
||||
original=doc['accessors'][primitive['attributes'][key]]
|
||||
attrs[key]=accessor(values,original['type'],original['componentType'])
|
||||
output.append({'attributes':attrs,'material':material,'indices':accessor(np.arange(len(rows['POSITION'])).reshape(-1,1),'SCALAR',5125)})
|
||||
primitive['indices']=accessor(faces[~selected].reshape(-1,1),'SCALAR',5125)
|
||||
return output
|
||||
@@ -0,0 +1,133 @@
|
||||
"""Reference-based red leather outfit and bat wings for the approval model."""
|
||||
import numpy as np
|
||||
from review_mesh_cut import split_material
|
||||
|
||||
def augment(doc, read, mesh, primitives,accessor):
|
||||
joints=doc['skins'][0]['joints']
|
||||
def bone(name):return joints.index(next(i for i,n in enumerate(doc['nodes']) if n.get('name')==name))
|
||||
def material(name,color,metal=0,rough=.4):
|
||||
i=len(doc['materials']);doc['materials'].append({'name':name,'doubleSided':True,'pbrMetallicRoughness':{'baseColorFactor':[*color,1],'metallicFactor':metal,'roughnessFactor':rough}});return i
|
||||
red=material('Crimson fitted leather',[.32,.009,.018],.06,.32)
|
||||
seam=material('Red leather stitched piping',[.12,.004,.009],0,.47)
|
||||
silver=material('Antique silver buckles and eyelets',[.46,.48,.50],.9,.25)
|
||||
membrane=material('Rose burgundy bat membrane',[.29,.045,.065],0,.58)
|
||||
spar=material('Dark living wing spars',[.045,.009,.016],0,.44)
|
||||
doc['materials'][3]['pbrMetallicRoughness'].update(baseColorFactor=[.28,.008,.017,1],roughnessFactor=.34)
|
||||
body=read(next(p for p in primitives if p['material']==1)['attributes']['POSITION'])
|
||||
for p in list(primitives):
|
||||
if p['material'] in [16,17]:
|
||||
positions=read(p['attributes']['POSITION']);faces=read(p['indices']).reshape(-1,3).astype(np.int64);center=positions[faces].mean(axis=1)
|
||||
edge=(center[:,1]>.67)&(center[:,1]<.78)&(np.abs(positions[faces][:,:,0]).max(axis=1)<.30)
|
||||
if edge.any():primitives.extend(split_material(p,edge,lambda point:.72-point[1],17,16,doc,read,accessor))
|
||||
if p['material']==3:
|
||||
positions=read(p['attributes']['POSITION']);faces=read(p['indices']).reshape(-1,3).astype(np.int64);center=positions[faces].mean(axis=1)
|
||||
front=(center[:,2]>.07)&(center[:,1]>1.23)&(np.abs(center[:,0])<.225)
|
||||
def cup(point):
|
||||
x,y,z=point;top=1.313-.060*np.exp(-(x/.037)**2)+.018*np.exp(-((abs(x)-.105)/.055)**2)
|
||||
return top-y
|
||||
primitives.extend(split_material(p,front,cup,3,None,doc,read,accessor))
|
||||
continue
|
||||
if p['material'] not in [1,16]:continue
|
||||
positions=read(p['attributes']['POSITION']);faces=read(p['indices']).reshape(-1,3).astype(np.int64);center=positions[faces].mean(axis=1)
|
||||
region=(center[:,1]>.78)&(center[:,1]<1.04)&(np.abs(positions[faces][:,:,0]).max(axis=1)<.24)
|
||||
primitives.extend(split_material(p,region,lambda point:point[1]-.82-.8125*abs(point[0]),red,16,doc,read,accessor))
|
||||
def surface(x,y,front=True):
|
||||
distance=(body[:,0]-x)**2+(body[:,1]-y)**2
|
||||
near=body[np.argpartition(distance,20)[:20]]
|
||||
z=near[:,2].max()+.012 if front else near[:,2].min()-.012
|
||||
return np.array([x,y,z])
|
||||
def tube(points,radius,mat,bn,radii=None):
|
||||
points=np.array(points);v=[];f=[]
|
||||
for i,p in enumerate(points):
|
||||
tangent=points[min(i+1,len(points)-1)]-points[max(0,i-1)];tangent/=max(np.linalg.norm(tangent),1e-8)
|
||||
axis=np.array([0.,0.,1.]) if abs(tangent[2])<.9 else np.array([0.,1.,0.])
|
||||
u=np.cross(tangent,axis);u/=max(np.linalg.norm(u),1e-8);w=np.cross(tangent,u)
|
||||
r=radius*(radii[i] if radii is not None else 1)
|
||||
for j in range(8):v.append(p+r*(u*np.cos(j*np.pi/4)+w*np.sin(j*np.pi/4)))
|
||||
for i in range(len(points)-1):
|
||||
for j in range(8):
|
||||
a=i*8+j;b=i*8+(j+1)%8;f.extend([[a,b,b+8],[a,b+8,a+8]])
|
||||
mesh(v,f,bn,mat,True)
|
||||
def ring(at,rx,ry,wire,mat,bn):
|
||||
at=np.array(at);tube([at+np.array([rx*np.cos(a),ry*np.sin(a),0]) for a in np.linspace(0,2*np.pi,33)],wire,mat,bn)
|
||||
def strap(points,width,mat,bn):
|
||||
points=np.array(points);v=[];f=[]
|
||||
for i,p in enumerate(points):
|
||||
tangent=points[min(i+1,len(points)-1)]-points[max(0,i-1)]
|
||||
normal=np.cross(tangent,[0,0,1]);normal/=max(np.linalg.norm(normal),1e-8)
|
||||
v.extend([p-normal*width/2,p+normal*width/2])
|
||||
for i in range(len(points)-1):a=i*2;f.extend([[a,a+1,a+3],[a,a+3,a+2]])
|
||||
mesh(v,f,bn,mat)
|
||||
def band(y,rx,rz,z,height,mat,bn,x=0):
|
||||
v=[];f=[]
|
||||
for a in np.linspace(0,2*np.pi,65):
|
||||
v.extend([[x+rx*np.cos(a),y-height/2,z+rz*np.sin(a)],[x+rx*np.cos(a),y+height/2,z+rz*np.sin(a)]])
|
||||
for i in range(64):a=i*2;f.extend([[a,a+1,a+3],[a,a+3,a+2]])
|
||||
mesh(v,f,bn,mat)
|
||||
def buckle(at,width,height,bn):
|
||||
at=np.array(at);outline=[[-width/2,-height/2,0],[width/2,-height/2,0],[width/2,height/2,0],[-width/2,height/2,0],[-width/2,-height/2,0]]
|
||||
tube([at+v for v in np.array(outline)],.0025,silver,bn)
|
||||
tube([at+[-width/2,0,0],at+[width*.12,0,.002]],.0017,silver,bn)
|
||||
def rivet(p,bn):ring(p,.0025,.0025,.0018,silver,bn)
|
||||
|
||||
neck=bone('neck02');chest=bone('spine02');waist=bone('spine04')
|
||||
band(1.468,.067,.065,.025,.092,red,neck)
|
||||
for y,r in [(1.49,.012),(1.455,.018),(1.415,.016)]:ring([0,y,.095],r,r,.0024,silver,neck)
|
||||
for y in [1.495,1.468,1.441]:buckle([0,y,-.044],.025,.018,neck)
|
||||
band(1.045,.145,.100,.052,.028,red,waist);buckle([0,1.045,.160],.042,.030,waist)
|
||||
for sign in [-1,1]:
|
||||
for front in [True,False]:
|
||||
path=[surface(sign*x,y,front) for x,y in [(.045,1.425),(.090,1.385),(.145,1.335),(.185,1.285)]]
|
||||
strap(path,.021,red,chest)
|
||||
for p in path[1:]:rivet(p+np.array([0,0,.001 if front else -.001]),chest)
|
||||
for x in [.055,.105]:
|
||||
tube([surface(sign*x,y) for y in np.linspace(.98,1.29,20)],.0016,seam,chest)
|
||||
# Four fan panels create the small leather bat-wing shoulder silhouette.
|
||||
bn=bone('clavicle.L' if sign>0 else 'clavicle.R')
|
||||
center=np.array([sign*.265,1.365,.045])
|
||||
edge=np.array([[.20,1.405,.025],[.455,1.475,.01],[.390,1.385,.035],[.46,1.305,.025],[.355,1.305,.04],[.365,1.225,.015],[.215,1.29,.03]])
|
||||
edge[:,0]*=sign
|
||||
mesh([center,*edge],[[0,i+1,(i+1)%len(edge)+1] for i in range(len(edge))],bn,red)
|
||||
tube([*edge,edge[0]],.0022,seam,bn)
|
||||
for j in [1,3,5]:tube([center,center*.45+edge[j]*.55+np.array([0,0,.009]),edge[j]],.0033,seam,bn,[1,.9,.15])
|
||||
rivet(center+np.array([0,0,.009]),bn)
|
||||
thigh=bone('upperleg01.L' if sign>0 else 'upperleg01.R')
|
||||
if sign==1:
|
||||
for front in [True,False]:
|
||||
tube([surface(x,.82+.8125*abs(x),front) for x in np.linspace(-.155,.155,45)],.0024,seam,waist)
|
||||
for y in [.782,.815]:band(y,.082,.078,.045,.018,red,thigh,sign*.135)
|
||||
for front in [True,False]:
|
||||
path=[surface(sign*x,y,front) for x,y in [(.13,.955),(.15,.905),(.16,.85),(.16,.812)]]
|
||||
strap(path,.016,red,thigh);buckle(path[-2],.023,.025,thigh)
|
||||
# Visible crossed rear lacing, separate metal eyelets and loose tied ends.
|
||||
for y in np.linspace(.97,1.29,12):
|
||||
for sign in [-1,1]:
|
||||
p=surface(sign*.022,y,False);ring(p,.0037,.0037,.0012,silver,chest)
|
||||
tube([surface(-.022,y,False),surface(.022,y+.014,False)],.0014,red,chest)
|
||||
tube([surface(.022,y,False),surface(-.022,y+.014,False)],.0014,red,chest)
|
||||
knot=surface(0,1.04,False)
|
||||
for sign in [-1,1]:
|
||||
tube([knot,knot+[sign*.035,-.018,-.01],knot+[sign*.022,-.038,-.015],knot],.0018,red,chest)
|
||||
tube([knot,knot+[sign*.009,-.08,-.02],knot+[sign*.02,-.12,-.012]],.0016,red,chest)
|
||||
|
||||
# New curved bat wings are weighted to the existing independent wing bones.
|
||||
for side,sign in [('L',1),('R',-1)]:
|
||||
bn=bone('Wing.'+side)
|
||||
root=np.array([sign*.12,1.39,-.09]);knuckle=np.array([sign*.36,1.97,-.15])
|
||||
tips=np.array([[.73,2.015,-.18],[1.06,1.775,-.20],[.98,1.19,-.18],[.69,.80,-.15],[.35,.88,-.11]])
|
||||
tips[:,0]*=sign;edge=[root,*tips,root+[0,-.20,-.02]]
|
||||
tube([root,root*.45+knuckle*.55+np.array([sign*.035,.08,0]),knuckle,knuckle+[sign*.025,.12,.01],knuckle+[sign*.005,.16,.02]],.017,spar,bn,[1.2,1,.7,.4,.02])
|
||||
for tip in tips:
|
||||
tube([knuckle,knuckle*.55+tip*.45+np.array([0,.035,-.025]),tip],.010,spar,bn,[1,.7,.035])
|
||||
for a,b in zip(edge[:-1],edge[1:]):
|
||||
v=[];f=[];n=16
|
||||
for row in range(n+1):
|
||||
u=row/n
|
||||
for col in range(n+1):
|
||||
t=col/n;boundary=a*(1-t)+b*t+(knuckle-(a+b)/2)*(.30*np.sin(np.pi*t))
|
||||
p=knuckle*(1-u)+boundary*u;p[2]-=.045*np.sin(np.pi*u)*np.sin(np.pi*t);v.append(p)
|
||||
for row in range(n):
|
||||
for col in range(n):
|
||||
k=row*(n+1)+col;f.extend([[k,k+1,k+n+2],[k,k+n+2,k+n+1]])
|
||||
mesh(v,f,bn,membrane,True)
|
||||
tube([a*(1-t)+b*t+(knuckle-(a+b)/2)*(.30*np.sin(np.pi*t)) for t in np.linspace(0,1,25)],.003,spar,bn)
|
||||
@@ -0,0 +1,31 @@
|
||||
"""Validate the actual optimized mesh, paint protection and all transferred clips."""
|
||||
import bpy,numpy as np,json,struct
|
||||
from pathlib import Path
|
||||
r=Path(__file__).resolve().parent.parent;out=r/'Demon_v0.19/reviews/infernal_v01'
|
||||
bpy.ops.wm.open_mainfile(filepath=str(r/'tools/model_sources/infernal_game.blend'))
|
||||
o=bpy.data.objects['Infernal_Game_Mesh'];rig=bpy.data.objects['INFERNAL_RIG'];v=np.array([tuple(x.co) for x in o.data.vertices]);edges=np.array([tuple(e.vertices) for e in o.data.edges]);initial=np.linalg.norm(v[edges[:,0]]-v[edges[:,1]],axis=1)
|
||||
assert len(rig.data.bones)==166
|
||||
assert np.isfinite(v).all() and v[:,2].min()>-.0001
|
||||
floor=v[v[:,2]<.01];assert len(floor)>0 and abs(floor[:,0]).max()<.13,'pedestal left below feet'
|
||||
assert len(o.data.polygons)<100000
|
||||
for vertex in o.data.vertices:assert abs(sum(group.weight for group in vertex.groups)-1)<.001
|
||||
skin=next(m for m in o.data.materials if m.name=='Infernal exposed arm skin');shader=next(n for n in skin.node_tree.nodes if n.type=='BSDF_PRINCIPLED')
|
||||
assert not shader.inputs['Base Color'].is_linked and shader.inputs['Base Color'].default_value[0]>.3
|
||||
for name in ['infernal_basecolor.png','infernal_normal.png','infernal_orm.png']:
|
||||
image=bpy.data.images[name];assert tuple(image.size)==(4096,4096)
|
||||
for t in rig.animation_data.nla_tracks:t.mute=True
|
||||
metrics={}
|
||||
for clip in ['Idle','Walk','Whip']:
|
||||
action=bpy.data.actions['Infernal / '+clip];rig.animation_data.action=action;maximum=0.;max_edge=0.
|
||||
for frame in range(1,int(action.frame_range[1])+1,4):
|
||||
bpy.context.scene.frame_set(frame);bpy.context.view_layer.update();ev=o.evaluated_get(bpy.context.evaluated_depsgraph_get());mesh=ev.to_mesh();p=np.array([tuple(x.co) for x in mesh.vertices]);ev.to_mesh_clear()
|
||||
assert np.isfinite(p).all()
|
||||
maximum=max(maximum,float(np.linalg.norm(p-v,axis=1).max()));growth=np.linalg.norm(p[edges[:,0]]-p[edges[:,1]],axis=1)-initial;max_edge=max(max_edge,float(growth.max()))
|
||||
if growth.max()>.14:
|
||||
edge=edges[growth.argmax()];print('BAD EDGE',clip,frame,[(v[i].round(3).tolist(),[(o.vertex_groups[x.group].name,round(x.weight,3)) for x in o.data.vertices[i].groups]) for i in edge],float(growth.max()),flush=True)
|
||||
assert maximum<1.2,(clip,maximum)
|
||||
assert max_edge<.15,(clip,'long stretched film',max_edge)
|
||||
metrics[clip]={'frames':int(action.frame_range[1]),'max_vertex_travel_m':round(maximum,5),'max_edge_growth_m':round(max_edge,5)}
|
||||
b=(out/'infernal_game.glb').read_bytes();length=struct.unpack_from('<I',b,12)[0];g=json.loads(b[20:20+length]);assert {a['name'] for a in g['animations']}=={'Idle','Walk','Whip'}
|
||||
report={'status':'PASS','mesh_vertices':len(v),'mesh_triangles':len(o.data.polygons),'bones':166,'floor_min_z':float(v[:,2].min()),'pedestal_removed':True,'skin_material_protected':True,'pbr_maps':'4096x4096 basecolor / normal / ORM','clips':metrics,'glb_bytes':len(b)}
|
||||
(out/'validation.json').write_text(json.dumps(report,indent=2));print('INFERNAL ASSET QA',json.dumps(report),flush=True)
|
||||