mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 06:52:55 +08:00
Shader improvements for decal_dirt
This commit is contained in:
parent
a68523b2ef
commit
0264011ad0
@ -386,6 +386,7 @@ namespace CodeWalker.Rendering
|
||||
public Vector4 WindOverrideParams { get; set; } = Vector4.One;
|
||||
public Vector4 globalAnimUV0 { get; set; } = Vector4.Zero;
|
||||
public Vector4 globalAnimUV1 { get; set; } = Vector4.Zero;
|
||||
public Vector4 DirtDecalMask { get; set; } = Vector4.Zero;
|
||||
public bool SpecOnly { get; set; } = false;
|
||||
public float WaveOffset { get; set; } = 0; //for terrainfoam
|
||||
public float WaterHeight { get; set; } = 0; //for terrainfoam
|
||||
@ -583,6 +584,9 @@ namespace CodeWalker.Rendering
|
||||
case MetaName.HeightOpacity:
|
||||
HeightOpacity = ((Vector4)param.Data).X;
|
||||
break;
|
||||
case MetaName.DirtDecalMask:
|
||||
DirtDecalMask = ((Vector4)param.Data);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ namespace CodeWalker.Rendering
|
||||
public float specularFresnel;
|
||||
public float wetnessMultiplier;
|
||||
public uint SpecOnly;
|
||||
public Vector4 TextureAlphaMask;
|
||||
}
|
||||
public struct BasicShaderInstGlobalMatrix
|
||||
{
|
||||
@ -588,8 +589,11 @@ namespace CodeWalker.Rendering
|
||||
uint tintflag = 0;
|
||||
if (usetint) tintflag = 1;
|
||||
|
||||
Vector4 textureAlphaMask = Vector4.Zero;
|
||||
uint decalflag = DecalMode ? 1u : 0u;
|
||||
uint windflag = geom.EnableWind ? 1u : 0u;
|
||||
uint emflag = geom.IsEmissive ? 1u : 0u;
|
||||
uint pstintflag = tintflag;
|
||||
var shaderName = geom.DrawableGeom.Shader.Name;
|
||||
var shaderFile = geom.DrawableGeom.Shader.FileName;
|
||||
switch (shaderFile.Hash)
|
||||
@ -606,9 +610,12 @@ namespace CodeWalker.Rendering
|
||||
case 2706821972://{mirror_decal.sps}
|
||||
//if (RenderMode == WorldRenderMode.Default) usediff = false;
|
||||
break;
|
||||
case 2655725442://{decal_dirt.sps}
|
||||
textureAlphaMask = geom.DirtDecalMask;
|
||||
decalflag = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
uint pstintflag = tintflag;
|
||||
if (VSEntityVars.Vars.IsInstanced>0)
|
||||
{
|
||||
pstintflag = 1;
|
||||
@ -631,7 +638,7 @@ namespace CodeWalker.Rendering
|
||||
PSGeomVars.Vars.EnableNormalMap = usebump ? 1u : 0u;
|
||||
PSGeomVars.Vars.EnableSpecMap = usespec ? 1u : 0u;
|
||||
PSGeomVars.Vars.EnableDetailMap = usedetl ? 1u : 0u;
|
||||
PSGeomVars.Vars.IsDecal = DecalMode ? 1u : 0u;
|
||||
PSGeomVars.Vars.IsDecal = decalflag;
|
||||
PSGeomVars.Vars.IsEmissive = emflag;
|
||||
PSGeomVars.Vars.IsDistMap = isdistmap ? 1u : 0u;
|
||||
PSGeomVars.Vars.bumpiness = geom.bumpiness;
|
||||
@ -645,6 +652,7 @@ namespace CodeWalker.Rendering
|
||||
PSGeomVars.Vars.specularFresnel = geom.specularFresnel;
|
||||
PSGeomVars.Vars.wetnessMultiplier = geom.wetnessMultiplier;
|
||||
PSGeomVars.Vars.SpecOnly = geom.SpecOnly ? 1u : 0u;
|
||||
PSGeomVars.Vars.TextureAlphaMask = textureAlphaMask;
|
||||
PSGeomVars.Update(context);
|
||||
PSGeomVars.SetPSCBuffer(context, 2);
|
||||
|
||||
@ -752,6 +760,7 @@ namespace CodeWalker.Rendering
|
||||
PSGeomVars.Vars.specularFresnel = 1.0f;
|
||||
PSGeomVars.Vars.wetnessMultiplier = 0.0f;
|
||||
PSGeomVars.Vars.SpecOnly = 0;
|
||||
PSGeomVars.Vars.TextureAlphaMask = Vector4.Zero;
|
||||
PSGeomVars.Update(context);
|
||||
PSGeomVars.SetPSCBuffer(context, 2);
|
||||
|
||||
|
Binary file not shown.
@ -36,6 +36,7 @@ cbuffer PSGeomVars : register(b2)
|
||||
float specularFresnel;
|
||||
float wetnessMultiplier;
|
||||
uint SpecOnly;
|
||||
float4 TextureAlphaMask;
|
||||
}
|
||||
|
||||
|
||||
@ -77,6 +78,12 @@ float4 main(VS_OUTPUT input) : SV_TARGET
|
||||
if ((IsDecal == 0) && (c.a <= 0.33)) discard;
|
||||
if ((IsDecal == 1) && (c.a <= 0.0)) discard;
|
||||
if(IsDecal==0) c.a = 1;
|
||||
if (IsDecal == 2)
|
||||
{
|
||||
float4 mask = TextureAlphaMask * c;
|
||||
c.a = saturate(mask.r + mask.g + mask.b + mask.a);
|
||||
c.rgb = 0;
|
||||
}
|
||||
c.a = saturate(c.a*AlphaScale);
|
||||
}
|
||||
if (EnableTint > 0)
|
||||
|
2
Todo.txt
2
Todo.txt
@ -101,13 +101,13 @@ done:
|
||||
|
||||
|
||||
[v.29]
|
||||
Improved selected MLO instance display - portals, limbo room
|
||||
New Project Window
|
||||
RPF Explorer drag & drop
|
||||
Show vehicle wheels
|
||||
Snap to ground, snap to grid
|
||||
CodeWalker.Core library
|
||||
Improved GTA folder management
|
||||
Improved selected MLO instance display - portals, limbo room
|
||||
entitySets - like mapDataGroups but for interiors..... in Mlo data
|
||||
World view - delete key - delete item!
|
||||
RPF Explorer Edit mode
|
||||
|
@ -53,7 +53,7 @@ namespace CodeWalker
|
||||
bool rendermaps = false;
|
||||
bool renderworld = false;
|
||||
int startupviewmode = 0; //0=world, 1=ymap, 2=model
|
||||
string modelname = "dt1_tc_dufo_core";//"dt1_11_fount_decal";//
|
||||
string modelname = "dt1_tc_dufo_core";//"dt1_11_fount_decal";//"v_22_overlays";//
|
||||
string[] ymaplist;
|
||||
|
||||
Vector3 prevworldpos = new Vector3(0, 0, 100); //also the start pos
|
||||
|
Loading…
Reference in New Issue
Block a user