commit807aa8c3c6
Merge:34f74aa
3777d06
Author: Clement <clement@jo85.com> Date: Thu Jan 18 12:02:57 2024 +0100 Merge pull request 'add Atomes Factory' (#10) from feature/AtomesFactory into develop Reviewed-on: #10 Reviewed-by: Clement <clement@jo85.com> commit3777d06a0e
Author: Mathis <mathis.ragot@epitech.eu> Date: Thu Jan 18 12:00:00 2024 +0100 Rename Classname commit16bd5bfb6c
Merge:da9d57b
34f74aa
Author: Mathis <mathis.ragot@epitech.eu> Date: Thu Jan 18 11:46:03 2024 +0100 Merge remote-tracking branch 'origin/develop' into feature/AtomesFactory commitda9d57b0bb
Author: Mathis <mathis.ragot@epitech.eu> Date: Thu Jan 18 11:44:22 2024 +0100 vue foria config commit5346e596c8
Author: Mathis <mathis.ragot@epitech.eu> Date: Thu Jan 18 11:28:02 2024 +0100 [feature/AtomesFactory] - remove testing file commitf613217658
Author: Mathis <mathis.ragot@epitech.eu> Date: Thu Jan 18 10:38:59 2024 +0100 [feature/AtomesFactory] - Add json for atomes commitbc2b9e02fd
Author: Mathis <mathis.ragot@epitech.eu> Date: Fri Jan 12 15:37:09 2024 +0100 add Atomes Factory commit34f74aa443
Merge:8b6d07f
f181fd9
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 11:50:43 2024 +0100 Merge pull request 'feature/multi_targets' (#7) from feature/multi_targets into develop Reviewed-on: #7 Reviewed-by: Clement <clement@jo85.com> commitf181fd9935
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 11:50:10 2024 +0100 fix du mauvais nom de scene dans le script ChangeScene.cs commit1c76868eee
Merge:f1ec062
8b6d07f
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 11:39:02 2024 +0100 Merge remote-tracking branch 'origin/develop' into feature/multi_targets commitf1ec062047
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 11:37:29 2024 +0100 ajout du font fallback commit9c23975b20
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 11:36:49 2024 +0100 rajouts des fonts text mesh pro commitaff9df22cf
Merge:a791273
73394e5
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 11:03:32 2024 +0100 Merge remote-tracking branch 'origin/develop' into feature/multi_targets commita7912733e5
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 10:54:51 2024 +0100 Ajout dans le canvas d'éléments UI (nom, description....) commit0313fe28a1
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Jan 12 09:57:07 2024 +0100 Suppression du build de la CI commit5237a32bb4
Author: Nicolas <nicolas.sansd@gmail.com> Date: Thu Jan 11 16:18:35 2024 +0100 ajout de la keystore de debug (user) + changement de la target version d'android commitafa265dd31
Author: Nicolas <nicolas.sansd@gmail.com> Date: Thu Jan 11 11:26:53 2024 +0100 Affichage des molécules unitairement et en mode fusion commit84136dcc5c
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Dec 22 15:05:47 2023 +0100 MAJ du fichier d'action build.yaml commitce3c956544
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Dec 22 15:02:10 2023 +0100 MAJ du fichier d'action build.yaml commit8f105732f7
Author: Nicolas <nicolas.sansd@gmail.com> Date: Fri Dec 22 14:36:52 2023 +0100 Ajout de la multitarget pour générer un préfab
102 lines
3.5 KiB
HLSL
102 lines
3.5 KiB
HLSL
void VertShader(inout appdata_full v, out Input data)
|
|
{
|
|
v.vertex.x += _VertexOffsetX;
|
|
v.vertex.y += _VertexOffsetY;
|
|
|
|
UNITY_INITIALIZE_OUTPUT(Input, data);
|
|
|
|
float bold = step(v.texcoord1.y, 0);
|
|
|
|
// Generate normal for backface
|
|
float3 view = ObjSpaceViewDir(v.vertex);
|
|
v.normal *= sign(dot(v.normal, view));
|
|
|
|
#if USE_DERIVATIVE
|
|
data.param.y = 1;
|
|
#else
|
|
float4 vert = v.vertex;
|
|
float4 vPosition = UnityObjectToClipPos(vert);
|
|
float2 pixelSize = vPosition.w;
|
|
|
|
pixelSize /= float2(_ScaleX, _ScaleY) * mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy);
|
|
float scale = rsqrt(dot(pixelSize, pixelSize));
|
|
scale *= abs(v.texcoord1.y) * _GradientScale * (_Sharpness + 1);
|
|
scale = lerp(scale * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(v.normal.xyz), normalize(WorldSpaceViewDir(vert)))));
|
|
data.param.y = scale;
|
|
#endif
|
|
|
|
data.param.x = (lerp(_WeightNormal, _WeightBold, bold) / 4.0 + _FaceDilate) * _ScaleRatioA * 0.5; //
|
|
|
|
v.texcoord1.xy = UnpackUV(v.texcoord1.x);
|
|
data.viewDirEnv = mul((float3x3)_EnvMatrix, WorldSpaceViewDir(v.vertex));
|
|
}
|
|
|
|
void PixShader(Input input, inout SurfaceOutput o)
|
|
{
|
|
|
|
#if USE_DERIVATIVE
|
|
float2 pixelSize = float2(ddx(input.uv_MainTex.y), ddy(input.uv_MainTex.y));
|
|
pixelSize *= _TextureWidth * .75;
|
|
float scale = rsqrt(dot(pixelSize, pixelSize)) * _GradientScale * (_Sharpness + 1);
|
|
#else
|
|
float scale = input.param.y;
|
|
#endif
|
|
|
|
// Signed distance
|
|
float c = tex2D(_MainTex, input.uv_MainTex).a;
|
|
float sd = (.5 - c - input.param.x) * scale + .5;
|
|
float outline = _OutlineWidth*_ScaleRatioA * scale;
|
|
float softness = _OutlineSoftness*_ScaleRatioA * scale;
|
|
|
|
// Color & Alpha
|
|
float4 faceColor = _FaceColor;
|
|
float4 outlineColor = _OutlineColor;
|
|
faceColor *= input.color;
|
|
outlineColor.a *= input.color.a;
|
|
faceColor *= tex2D(_FaceTex, float2(input.uv2_FaceTex.x + _FaceUVSpeedX * _Time.y, input.uv2_FaceTex.y + _FaceUVSpeedY * _Time.y));
|
|
outlineColor *= tex2D(_OutlineTex, float2(input.uv2_OutlineTex.x + _OutlineUVSpeedX * _Time.y, input.uv2_OutlineTex.y + _OutlineUVSpeedY * _Time.y));
|
|
faceColor = GetColor(sd, faceColor, outlineColor, outline, softness);
|
|
faceColor.rgb /= max(faceColor.a, 0.0001);
|
|
|
|
#if BEVEL_ON
|
|
float3 delta = float3(1.0 / _TextureWidth, 1.0 / _TextureHeight, 0.0);
|
|
|
|
float4 smp4x = {tex2D(_MainTex, input.uv_MainTex - delta.xz).a,
|
|
tex2D(_MainTex, input.uv_MainTex + delta.xz).a,
|
|
tex2D(_MainTex, input.uv_MainTex - delta.zy).a,
|
|
tex2D(_MainTex, input.uv_MainTex + delta.zy).a };
|
|
|
|
// Face Normal
|
|
float3 n = GetSurfaceNormal(smp4x, input.param.x);
|
|
|
|
// Bumpmap
|
|
float3 bump = UnpackNormal(tex2D(_BumpMap, input.uv2_FaceTex.xy)).xyz;
|
|
bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5));
|
|
bump = lerp(float3(0, 0, 1), bump, faceColor.a);
|
|
n = normalize(n - bump);
|
|
|
|
// Cubemap reflection
|
|
fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDirEnv, mul((float3x3)unity_ObjectToWorld, n)));
|
|
float3 emission = reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a;
|
|
#else
|
|
float3 n = float3(0, 0, -1);
|
|
float3 emission = float3(0, 0, 0);
|
|
#endif
|
|
|
|
#if GLOW_ON
|
|
float4 glowColor = GetGlowColor(sd, scale);
|
|
glowColor.a *= input.color.a;
|
|
emission += glowColor.rgb*glowColor.a;
|
|
faceColor = BlendARGB(glowColor, faceColor);
|
|
faceColor.rgb /= max(faceColor.a, 0.0001);
|
|
#endif
|
|
|
|
// Set Standard output structure
|
|
o.Albedo = faceColor.rgb;
|
|
o.Normal = -n;
|
|
o.Emission = emission;
|
|
o.Specular = lerp(_FaceShininess, _OutlineShininess, saturate(sd + outline * 0.5));
|
|
o.Gloss = 1;
|
|
o.Alpha = faceColor.a;
|
|
}
|