Skip to content

Commit

Permalink
Merge pull request #31 from Gmod4phun/model-update
Browse files Browse the repository at this point in the history
Smooth shading, higher res textures, shadow
  • Loading branch information
selimnahimi authored Aug 31, 2023
2 parents 339667f + 90cab5b commit 62fc913
Show file tree
Hide file tree
Showing 17 changed files with 216 additions and 52 deletions.
16 changes: 16 additions & 0 deletions code/pawn/Pawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public BBox Hull

public override Ray AimRay => new Ray( EyePosition, EyeRotation.Forward );

public AnimatedEntity ShadowModel;

/// <summary>
/// Called when the entity is first created
/// </summary>
Expand All @@ -91,6 +93,13 @@ public override void Spawn()
CameraHelper.SetParent( this, "CameraJoint" );

PostProcessing = Camera.Main.FindOrCreateHook<CameraPostProcessing>();

EnableShadowCasting = false;

ShadowModel = new( "models/faith_shadow.vmdl" );
ShadowModel.SetParent( this, true );
ShadowModel.EnableShadowOnly = true;
ShadowModel.EnableShadowCasting = true;
}

public void UpdatePostProcessing()
Expand Down Expand Up @@ -264,4 +273,11 @@ protected void SimulateRotation()
EyeRotation = ViewAngles.ToRotation();
Rotation = ViewAngles.WithPitch( 0f ).ToRotation();
}

protected override void OnDestroy()
{
base.OnDestroy();

ShadowModel?.Delete();
}
}
42 changes: 42 additions & 0 deletions materials/faith_arms/faith_merged.vmat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// THIS FILE IS AUTO-GENERATED

Layer0
{
shader "shaders/complex.shader"

//---- PBR ----
F_SPECULAR 1

//---- Ambient Occlusion ----
g_flAmbientOcclusionDirectDiffuse "0.000"
g_flAmbientOcclusionDirectSpecular "0.000"
TextureAmbientOcclusion "materials/default/default_ao.tga"

//---- Color ----
g_flModelTintAmount "1.000"
g_vColorTint "[1.000000 1.000000 1.000000 0.000000]"
TextureColor "textures/faith_body/asia_fixer_merged_color.tga"

//---- Fade ----
g_flFadeExponent "1.000"

//---- Fog ----
g_bFogEnabled "1"

//---- Metalness ----
g_flMetalness "0.000"

//---- Normal ----
TextureNormal "textures/faith_body/asia_fixer_merged_normal.tga"

//---- Roughness ----
g_flRoughnessScaleFactor "1.000"
TextureRoughness "textures/faith_body/asia_fixer_merged_roughness.tga"

//---- Texture Coordinates ----
g_nScaleTexCoordUByModelScaleAxis "0"
g_nScaleTexCoordVByModelScaleAxis "0"
g_vTexCoordOffset "[0.000 0.000]"
g_vTexCoordScale "[1.000 1.000]"
g_vTexCoordScrollSpeed "[0.000 0.000]"
}
61 changes: 41 additions & 20 deletions materials/faith_arms/mi_female_arm_glove.vmat
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
"Layer0"
// THIS FILE IS AUTO-GENERATED

Layer0
{
"shader" "shaders/complex.shader"
"g_flAmbientOcclusionDirectDiffuse" "0.000000"
"g_flAmbientOcclusionDirectSpecular" "0.000000"
"TextureAmbientOcclusion" "materials/default/default_ao.tga"
"g_flModelTintAmount" "1.000000"
"g_vColorTint" "[1.000000 1.000000 1.000000 0.000000]"
"TextureColor" "textures/faith_arms/faith_glove_c.tga"
"g_flFadeExponent" "1.000000"
"g_bFogEnabled" "1"
"g_flMetalness" "0.000000"
"TextureNormal" "textures/faith_arms/faith_glove_n.tga"
"g_flRoughnessScaleFactor" "1.000000"
"TextureRoughness" "textures/faith_arms/faith_glove_s.tga"
"g_nScaleTexCoordUByModelScaleAxis" "0"
"g_nScaleTexCoordVByModelScaleAxis" "0"
"g_vTexCoordOffset" "[0.000 0.000]"
"g_vTexCoordScale" "[1.000 1.000]"
"g_vTexCoordScrollSpeed" "[0.000 0.000]"
}
shader "shaders/complex.shader"

//---- PBR ----
F_SPECULAR 1

//---- Ambient Occlusion ----
g_flAmbientOcclusionDirectDiffuse "0.000"
g_flAmbientOcclusionDirectSpecular "0.000"
TextureAmbientOcclusion "materials/default/default_ao.tga"

//---- Color ----
g_flModelTintAmount "1.000"
g_vColorTint "[1.000000 1.000000 1.000000 0.000000]"
TextureColor "textures/faith_arms/faith_glove_c.tga"

//---- Fade ----
g_flFadeExponent "1.000"

//---- Fog ----
g_bFogEnabled "1"

//---- Metalness ----
g_flMetalness "0.000"

//---- Normal ----
TextureNormal "textures/faith_arms/faith_glove_n.tga"

//---- Roughness ----
g_flRoughnessScaleFactor "1.000"
TextureRoughness "textures/faith_arms/faith_glove_rough.tga"

//---- Texture Coordinates ----
g_nScaleTexCoordUByModelScaleAxis "0"
g_nScaleTexCoordVByModelScaleAxis "0"
g_vTexCoordOffset "[0.000 0.000]"
g_vTexCoordScale "[1.000 1.000]"
g_vTexCoordScrollSpeed "[0.000 0.000]"
}
61 changes: 41 additions & 20 deletions materials/faith_arms/mi_female_arm_skinn.vmat
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
"Layer0"
// THIS FILE IS AUTO-GENERATED

Layer0
{
"shader" "shaders/complex.shader"
"g_flAmbientOcclusionDirectDiffuse" "0.000000"
"g_flAmbientOcclusionDirectSpecular" "0.000000"
"TextureAmbientOcclusion" "materials/default/default_ao.tga"
"g_flModelTintAmount" "1.000000"
"g_vColorTint" "[1.000000 1.000000 1.000000 0.000000]"
"TextureColor" "textures/faith_arms/female_1p_c.tga"
"g_flFadeExponent" "1.000000"
"g_bFogEnabled" "1"
"g_flMetalness" "0.000000"
"TextureNormal" "textures/faith_arms/female_1p_n.tga"
"g_flRoughnessScaleFactor" "1.000000"
"TextureRoughness" "textures/faith_arms/female_1p_s.tga"
"g_nScaleTexCoordUByModelScaleAxis" "0"
"g_nScaleTexCoordVByModelScaleAxis" "0"
"g_vTexCoordOffset" "[0.000 0.000]"
"g_vTexCoordScale" "[1.000 1.000]"
"g_vTexCoordScrollSpeed" "[0.000 0.000]"
}
shader "shaders/complex.shader"

//---- PBR ----
F_SPECULAR 1

//---- Ambient Occlusion ----
g_flAmbientOcclusionDirectDiffuse "0.000"
g_flAmbientOcclusionDirectSpecular "0.000"
TextureAmbientOcclusion "materials/default/default_ao.tga"

//---- Color ----
g_flModelTintAmount "1.000"
g_vColorTint "[1.000000 1.000000 1.000000 0.000000]"
TextureColor "textures/faith_arms/female_1p_c.tga"

//---- Fade ----
g_flFadeExponent "1.000"

//---- Fog ----
g_bFogEnabled "1"

//---- Metalness ----
g_flMetalness "0.000"

//---- Normal ----
TextureNormal "textures/faith_arms/female_1p_n.tga"

//---- Roughness ----
g_flRoughnessScaleFactor "1.000"
TextureRoughness "textures/faith_arms/female_1p_roughness.tga"

//---- Texture Coordinates ----
g_nScaleTexCoordUByModelScaleAxis "0"
g_nScaleTexCoordVByModelScaleAxis "0"
g_vTexCoordOffset "[0.000 0.000]"
g_vTexCoordScale "[1.000 1.000]"
g_vTexCoordScrollSpeed "[0.000 0.000]"
}
Binary file added model_source/faith_v2/faith_3p.dmx
Binary file not shown.
Binary file added model_source/faith_v2/faith_shadow_full.dmx
Binary file not shown.
Binary file added model_source/faith_v2/faithv2.dmx
Binary file not shown.
69 changes: 69 additions & 0 deletions models/faith_shadow.vmdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:modeldoc29:version{3cec427c-1b0e-4d48-a90a-0436f33a6041} -->
{
rootNode =
{
_class = "RootNode"
children =
[
{
_class = "ModelModifierList"
children =
[
{
_class = "ModelModifier_ScaleAndMirror"
scale = 39.369999
mirror_x = false
mirror_y = false
mirror_z = false
flip_bone_forward = false
swap_left_and_right_bones = false
},
]
},
{
_class = "MaterialGroupList"
children =
[
{
_class = "DefaultMaterialGroup"
remaps =
[
{
from = "shadow.vmat"
to = "materials/tools/toolsblocklight.vmat"
},
]
use_global_default = false
global_default_material = ""
},
]
},
{
_class = "RenderMeshList"
children =
[
{
_class = "RenderMeshFile"
filename = "model_source/faith_v2/faith_shadow_full.dmx"
import_translation = [ 0.0, 0.0, 0.0 ]
import_rotation = [ 0.0, 0.0, 0.0 ]
import_scale = 1.0
align_origin_x_type = "None"
align_origin_y_type = "None"
align_origin_z_type = "None"
parent_bone = ""
import_filter =
{
exclude_by_default = false
exception_list = [ ]
}
},
]
},
]
model_archetype = ""
primary_associated_entity = ""
anim_graph_name = "animgraphs/faith_arms.vanmgrph"
base_model_name = ""
}
}
16 changes: 4 additions & 12 deletions models/faith_v2.vmdl
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@
[
{
_class = "ModelModifier_ScaleAndMirror"
scale = 35.0
scale = 39.369999
mirror_x = false
mirror_y = false
mirror_z = false
flip_bone_forward = false
swap_left_and_right_bones = false
},
{
_class = "ModelModifier_Translate"
translation = [ 0.0, 0.0, 0.0 ]
},
]
},
{
Expand All @@ -41,12 +37,8 @@
to = "materials/faith_arms/mi_female_arm_skinn.vmat"
},
{
from = "mi_faith_lowres_upper.vmat"
to = "materials/faith_arms/mi_faith_lowres_upper.vmat"
},
{
from = "mi_shtest.vmat"
to = "materials/faith_arms/mi_shtest.vmat"
from = "faith_merged.vmat"
to = "materials/faith_arms/faith_merged.vmat"
},
]
use_global_default = false
Expand All @@ -60,7 +52,7 @@
[
{
_class = "RenderMeshFile"
filename = "model_source/faith_v2/Collection.dmx"
filename = "model_source/faith_v2/faithv2.dmx"
import_translation = [ 0.0, 0.0, 0.0 ]
import_rotation = [ 0.0, 0.0, 0.0 ]
import_scale = 1.0
Expand Down
Binary file modified textures/faith_arms/Faith_Glove_C.tga
Binary file not shown.
Binary file added textures/faith_arms/Faith_Glove_Rough.tga
Binary file not shown.
Binary file added textures/faith_arms/Female_1p_Roughness.tga
Binary file not shown.
Binary file added textures/faith_body/Asia_Fixer_Merged_Color.tga
Binary file not shown.
Binary file added textures/faith_body/Asia_Fixer_Merged_Normal.tga
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions textures/faith_body/asia_fixer_merged_color.tga.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"nocompress": 1
}

0 comments on commit 62fc913

Please sign in to comment.