Dummy NPC texture

This commit is contained in:
2025-05-05 23:12:09 -05:00
parent 2b3cfc0eb7
commit 424edaf581
6 changed files with 53 additions and 8 deletions

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://yhtpoum3eek7"] [gd_scene load_steps=8 format=3 uid="uid://yhtpoum3eek7"]
[ext_resource type="Script" uid="uid://ixwikdguyhf0" path="res://scripts/Entities/RosaController.gd" id="1_3g383"] [ext_resource type="Script" uid="uid://ixwikdguyhf0" path="res://scripts/Entities/RosaController.gd" id="1_3g383"]
[ext_resource type="Script" uid="uid://jd50n00bo05y" path="res://scripts/Entities/RosaCamera.gd" id="2_tr66j"] [ext_resource type="Script" uid="uid://jd50n00bo05y" path="res://scripts/Entities/RosaCamera.gd" id="2_tr66j"]
[ext_resource type="Shader" uid="uid://7h2axb2tsh17" path="res://shaders/NPC Shader.gdshader" id="3_j5vis"] [ext_resource type="Shader" uid="uid://7h2axb2tsh17" path="res://shaders/NPC Shader.gdshader" id="3_j5vis"]
[ext_resource type="Texture2D" uid="uid://cofrgefp8e617" path="res://textures/human.png" id="4_rvn3n"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ls7r8"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ls7r8"]
radius = 0.331611 radius = 0.331611
@@ -13,7 +14,8 @@ height = 0.804274
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fegux"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_fegux"]
render_priority = 0 render_priority = 0
shader = ExtResource("3_j5vis") shader = ExtResource("3_j5vis")
shader_parameter/color = Color(0.931725, 0.000206962, 0.803019, 1) shader_parameter/npcTexture = ExtResource("4_rvn3n")
shader_parameter/color = Color(1, 1, 1, 1)
shader_parameter/frame = 0 shader_parameter/frame = 0
shader_parameter/direction = 1 shader_parameter/direction = 1

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://dr4b2pmsknuhc"] [gd_scene load_steps=8 format=3 uid="uid://dr4b2pmsknuhc"]
[ext_resource type="Script" uid="uid://d23qg1ovkbxst" path="res://scripts/Entities/BasicNPCEntity.gd" id="1_1muh7"] [ext_resource type="Script" uid="uid://d23qg1ovkbxst" path="res://scripts/Entities/BasicNPCEntity.gd" id="1_1muh7"]
[ext_resource type="Shader" uid="uid://7h2axb2tsh17" path="res://shaders/NPC Shader.gdshader" id="1_xgcv1"] [ext_resource type="Shader" uid="uid://7h2axb2tsh17" path="res://shaders/NPC Shader.gdshader" id="1_xgcv1"]
[ext_resource type="Script" uid="uid://btxgv85qst1jy" path="res://scripts/Cutscene/TestCutscene.gd" id="2_jwvuu"] [ext_resource type="Script" uid="uid://btxgv85qst1jy" path="res://scripts/Cutscene/TestCutscene.gd" id="2_jwvuu"]
[ext_resource type="Texture2D" uid="uid://cofrgefp8e617" path="res://textures/human.png" id="4_vo0ku"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dw1sy"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dw1sy"]
radius = 0.331611 radius = 0.331611
@@ -13,6 +14,7 @@ height = 0.804274
[sub_resource type="ShaderMaterial" id="ShaderMaterial_l4utx"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_l4utx"]
render_priority = 0 render_priority = 0
shader = ExtResource("1_xgcv1") shader = ExtResource("1_xgcv1")
shader_parameter/npcTexture = ExtResource("4_vo0ku")
shader_parameter/color = Color(0, 0.563816, 0, 1) shader_parameter/color = Color(0, 0.563816, 0, 1)
shader_parameter/frame = 0 shader_parameter/frame = 0
shader_parameter/direction = 1 shader_parameter/direction = 1

View File

@@ -1,10 +1,10 @@
class_name OverworldEntity extends CharacterBody3D class_name OverworldEntity extends CharacterBody3D
enum Direction { enum Direction {
NORTH,
EAST,
SOUTH, SOUTH,
WEST, WEST,
NORTH,
EAST,
} }
var speed:float = 150; var speed:float = 150;

View File

@@ -6,12 +6,15 @@ uniform vec4 color : source_color;
uniform int frame; uniform int frame;
uniform int direction; uniform int direction;
const int FRAMES = 3; const int FRAMES = 1;
const int DIRECTIONS = 4; const int DIRECTIONS = 4;
void vertex() { void vertex() {
vec2 tileSize = vec2(1.0 / float(FRAMES), 1.0 / float(DIRECTIONS)); vec2 tileSize = vec2(1.0 / float(DIRECTIONS), 1.0 / float(FRAMES));
vec2 topLeft = tileSize * vec2(float(frame % FRAMES), float(direction % DIRECTIONS)); vec2 topLeft = tileSize * vec2(
float(direction % DIRECTIONS),
float(frame % FRAMES)
);
vec2 bottomRight = topLeft + tileSize; vec2 bottomRight = topLeft + tileSize;
if(VERTEX_ID == 3) { if(VERTEX_ID == 3) {
@@ -27,6 +30,9 @@ void vertex() {
void fragment() { void fragment() {
vec4 npcColor = texture(npcTexture, UV); vec4 npcColor = texture(npcTexture, UV);
if(npcColor.a == 0.0)
discard;
// Remove PINK background // Remove PINK background
if(npcColor.r == 1.0 && npcColor.g == 0.0 && npcColor.b == 1.0) if(npcColor.r == 1.0 && npcColor.g == 0.0 && npcColor.b == 1.0)

BIN
textures/human.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

35
textures/human.png.import Normal file
View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cofrgefp8e617"
path.s3tc="res://.godot/imported/human.png-1880dba459540c27ee8035fcec96bd0b.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/human.png"
dest_files=["res://.godot/imported/human.png-1880dba459540c27ee8035fcec96bd0b.s3tc.ctex"]
[params]
compress/mode=2
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=0