-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
160ef35
commit 5c1dd46
Showing
9 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
# ss-shaders | ||
# ss-shaders | ||
|
||
Custom Star Sonata 2 ship shaders which makes all ships to be illuminated from the top, which gives them "C1" / sprite feeling. | ||
|
||
#Installation | ||
Download [mod package](/amorek/name/releases/latest/download/spritelike-shaders-1-0.zip) into Star Sonata 2 "Content" directory. | ||
|
||
#Known Issues | ||
* Lion ship does not use ship shader (game bug) | ||
* Some stations appear to be black (base model has faces pointing to it's inside) | ||
|
||
|
||
#Screenshots | ||
!(/images/Screenshot_1.png) | ||
!(/images/Screenshot_2.png) | ||
!(/images/Screenshot_3.png) | ||
!(/images/Screenshot_4.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#define EFFECT_MAX_LIGHT_COUNT 8 | ||
|
||
sampler2D ColoredTextureSampler : register(s0); | ||
sampler2D NormalMapSampler : register(s1); | ||
sampler2D EnvMapSampler : register(s2); | ||
|
||
float3 LightPositions[EFFECT_MAX_LIGHT_COUNT]; | ||
float LightAtts[EFFECT_MAX_LIGHT_COUNT]; | ||
float3 LightColors[EFFECT_MAX_LIGHT_COUNT]; | ||
float3 SpecularColors[EFFECT_MAX_LIGHT_COUNT]; | ||
float3 AmbientColor; | ||
float4 DiffuseTint; | ||
float SpecularExponent, LCount, DoSphereMapping; | ||
bool UseNormalMap; | ||
|
||
static const float3 lDir = float3(0,0,1); | ||
|
||
|
||
float3 getLightContribution(float3 Normal) | ||
{ | ||
float diffuse = saturate(dot(Normal, lDir)); | ||
float3 Reflect = normalize(4.0 * diffuse * Normal - lDir); | ||
float specFac = clamp(dot(Reflect, lDir),0, 0.97); | ||
float specular = pow(specFac, SpecularExponent); | ||
|
||
return (diffuse + specular); | ||
} | ||
|
||
float4 pixelMain | ||
( | ||
float2 TexCoords : TEXCOORD0, | ||
float3 View : TEXCOORD1, | ||
float3 Normal : TEXCOORD2, | ||
float3 Tangent : TEXCOORD3, | ||
float3 Binormal : TEXCOORD4, | ||
float3 WPos : TEXCOORD5, | ||
float4 Misc : TEXCOORD6, | ||
float4 Misc2 : TEXCOORD7 | ||
) | ||
: COLOR0 | ||
{ | ||
if (UseNormalMap) { | ||
float4 sample = tex2D(NormalMapSampler, TexCoords); | ||
float3 peturbation = sample.xyz - float3(0.5, 0.5, 0.5); | ||
Normal = float3( | ||
peturbation.x * Tangent - | ||
peturbation.y * Binormal + | ||
peturbation.z * Normal); | ||
} | ||
/* Interpolated vertex normals might not be normalized. */ | ||
Normal = normalize(Normal); | ||
|
||
float4 albedoColor = tex2D(ColoredTextureSampler, TexCoords) * DiffuseTint; | ||
|
||
if(DoSphereMapping > 0.5) | ||
{ | ||
float2 refCoords = reflect(View, Normal).xy * 0.5; | ||
albedoColor = lerp(albedoColor, tex2D(EnvMapSampler, refCoords), 0.5); | ||
} | ||
|
||
float3 finalLightColor = getLightContribution(Normal); | ||
|
||
float4 finalColor = saturate(albedoColor * float4(finalLightColor.xyz, 1.0)); | ||
finalColor.a = saturate(DiffuseTint.a); | ||
|
||
return finalColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#define EFFECT_MAX_LIGHT_COUNT 8 | ||
|
||
sampler2D ColoredTextureSampler : register(s0); | ||
sampler2D NormalMapSampler : register(s1); | ||
sampler2D EnvMapSampler : register(s2); | ||
|
||
float3 LightPositions[EFFECT_MAX_LIGHT_COUNT]; | ||
float LightAtts[EFFECT_MAX_LIGHT_COUNT]; | ||
float3 LightColors[EFFECT_MAX_LIGHT_COUNT]; | ||
float3 SpecularColors[EFFECT_MAX_LIGHT_COUNT]; | ||
float3 AmbientColor; | ||
float4 DiffuseTint; | ||
float SpecularExponent, LCount, DoSphereMapping; | ||
bool UseNormalMap; | ||
|
||
static const float3 lDir = float3(0,0,1); | ||
|
||
|
||
float3 getLightContribution(float3 Normal) | ||
{ | ||
float diffuse = saturate(dot(Normal, lDir)); | ||
float3 Reflect = normalize(4.0 * diffuse * Normal - lDir); | ||
float specFac = clamp(dot(Reflect, lDir),0, 0.97); | ||
float specular = pow(specFac, SpecularExponent); | ||
|
||
return (diffuse + specular); | ||
} | ||
|
||
float4 pixelMain | ||
( | ||
float2 TexCoords : TEXCOORD0, | ||
float3 View : TEXCOORD1, | ||
float3 Normal : TEXCOORD2, | ||
float3 Tangent : TEXCOORD3, | ||
float3 Binormal : TEXCOORD4, | ||
float3 WPos : TEXCOORD5, | ||
float4 Misc : TEXCOORD6, | ||
float4 Misc2 : TEXCOORD7 | ||
) | ||
: COLOR0 | ||
{ | ||
if (UseNormalMap) { | ||
float4 sample = tex2D(NormalMapSampler, TexCoords); | ||
float3 peturbation = sample.xyz - float3(0.5, 0.5, 0.5); | ||
Normal = float3( | ||
peturbation.x * Tangent - | ||
peturbation.y * Binormal + | ||
peturbation.z * Normal); | ||
} | ||
/* Interpolated vertex normals might not be normalized. */ | ||
Normal = normalize(Normal); | ||
|
||
float4 albedoColor = tex2D(ColoredTextureSampler, TexCoords) * DiffuseTint; | ||
|
||
if(DoSphereMapping > 0.5) | ||
{ | ||
float2 refCoords = reflect(View, Normal).xy * 0.5; | ||
albedoColor = lerp(albedoColor, tex2D(EnvMapSampler, refCoords), 0.5); | ||
} | ||
|
||
float3 finalLightColor = getLightContribution(Normal); | ||
|
||
float4 finalColor = saturate(albedoColor * float4(finalLightColor.xyz, 1.0)); | ||
finalColor.a = saturate(DiffuseTint.a); | ||
|
||
return finalColor; | ||
} |