Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI Shared Data.asset
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,26 @@ MonoBehaviour:
m_Key: vr.help.ring.text
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Key: menuitem.shadows.label
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Key: menuitem.shadows.description
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Key: menuitem.shadows.value
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Key: menuitem.shadowRange.label
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Key: menuitem.shadowRange.description
m_Metadata:
m_Items: []
m_Metadata:
m_Items: []
m_KeyGenerator:
Expand Down
22 changes: 22 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_cs.asset
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,28 @@ MonoBehaviour:
m_Localized: "s t\u011Blem|prolnut\xED"
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: "St\xEDny"
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: "Dynamick\xE9 st\xEDny slunce, m\u011Bs\xEDce a sv\u011Btel. Ostr\xE9
nebo vypnut\xE9 pro slab\u0161\xED PC"
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: "Vyp.|Ostr\xE9|St\u0159edn\xED|M\u011Bkk\xE9"
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: "Dosah st\xEDn\u016F"
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: "Kolik lamp a oh\u0148\u016F vrh\xE1 st\xEDny a jak daleko. Na slab\u0161\xEDch
PC sni\u017Ete"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
22 changes: 22 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_de.asset
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,28 @@ MonoBehaviour:
\"Favoriten-Ring\"."
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: Schatten
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: "Dynamische Schatten von Sonne, Mond und Lichtern. Hart oder aus
f\xFCr langsamere PCs"
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: Aus|Hart|Mittel|Weich
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: Schattenreichweite
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: Wie viele Lampen und Feuer Schatten werfen und wie weit. Auf langsameren
PCs verringern
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
22 changes: 22 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_en.asset
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,28 @@ MonoBehaviour:
it off in Immersion: "Favorites ring".'
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: Shadows
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: Dynamic shadows of the sun, moon and lights. Hard or off for slower
PCs
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: Off|Hard|Medium|Soft
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: Shadow range
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: How many lamps and fires cast shadows, and how far. Lower it on
slower PCs
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
22 changes: 22 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_es.asset
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,28 @@ MonoBehaviour:
m_Localized: con el cuerpo|fundido
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: Sombras
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: "Sombras din\xE1micas del sol, la luna y las luces. Duras o desactivadas
para PC m\xE1s lentos"
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: No|Duras|Medias|Suaves
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: Alcance de sombras
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: "Cu\xE1ntas l\xE1mparas y fuegos proyectan sombras y hasta d\xF3nde.
Red\xFAcelo en PC m\xE1s lentos"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
22 changes: 22 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_fr.asset
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,28 @@ MonoBehaviour:
m_Localized: avec le corps|fondu
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: Ombres
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: "Ombres dynamiques du soleil, de la lune et des lumi\xE8res. Dures
ou d\xE9sactiv\xE9es pour les PC plus lents"
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: Non|Dures|Moyennes|Douces
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: "Port\xE9e des ombres"
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: "Combien de lampes et de feux projettent des ombres, et jusqu'o\xF9.
\xC0 r\xE9duire sur les PC plus lents"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
22 changes: 22 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_it.asset
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,28 @@ MonoBehaviour:
m_Localized: col corpo|dissolvenza
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: Ombre
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: "Ombre dinamiche di sole, luna e luci. Nette o disattivate per PC
pi\xF9 lenti"
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: No|Nette|Medie|Morbide
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: Portata ombre
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: "Quante lampade e fuochi proiettano ombre e fin dove. Riducila sui
PC pi\xF9 lenti"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
22 changes: 22 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_pl.asset
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,28 @@ MonoBehaviour:
dr\u0105\u017Cek, gdy jest otwarty)"
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: Cienie
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: "Dynamiczne cienie s\u0142o\u0144ca, ksi\u0119\u017Cyca i \u015Bwiate\u0142.
Twarde lub wy\u0142\u0105czone na s\u0142absze komputery"
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: "Wy\u0142.|Twarde|\u015Arednie|Mi\u0119kkie"
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: "Zasi\u0119g cieni"
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: "Ile lamp i ognisk rzuca cienie i jak daleko. Zmniejsz na s\u0142abszych
komputerach"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
28 changes: 28 additions & 0 deletions Assets/Gothic-Core/Localizations/Gothic-UI_ru.asset
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,34 @@ MonoBehaviour:
m_Localized: "\u0441 \u0442\u0435\u043B\u043E\u043C|\u0437\u0430\u0442\u0435\u043C\u043D\u0435\u043D\u0438\u0435"
m_Metadata:
m_Items: []
- m_Id: 196594145456431104
m_Localized: "\u0422\u0435\u043D\u0438"
m_Metadata:
m_Items: []
- m_Id: 196594145510957056
m_Localized: "\u0414\u0438\u043D\u0430\u043C\u0438\u0447\u0435\u0441\u043A\u0438\u0435
\u0442\u0435\u043D\u0438 \u0441\u043E\u043B\u043D\u0446\u0430, \u043B\u0443\u043D\u044B
\u0438 \u043E\u0433\u043D\u0435\u0439. \u0416\u0451\u0441\u0442\u043A\u0438\u0435
\u0438\u043B\u0438 \u0432\u044B\u043A\u043B. \u0434\u043B\u044F \u0441\u043B\u0430\u0431\u044B\u0445
\u041F\u041A"
m_Metadata:
m_Items: []
- m_Id: 196594145510957057
m_Localized: "\u0412\u044B\u043A\u043B.|\u0416\u0451\u0441\u0442\u043A\u0438\u0435|\u0421\u0440\u0435\u0434\u043D\u0438\u0435|\u041C\u044F\u0433\u043A\u0438\u0435"
m_Metadata:
m_Items: []
- m_Id: 196653647115460608
m_Localized: "\u0414\u0430\u043B\u044C\u043D\u043E\u0441\u0442\u044C \u0442\u0435\u043D\u0435\u0439"
m_Metadata:
m_Items: []
- m_Id: 196653647161597952
m_Localized: "\u0421\u043A\u043E\u043B\u044C\u043A\u043E \u043B\u0430\u043C\u043F
\u0438 \u043A\u043E\u0441\u0442\u0440\u043E\u0432 \u043E\u0442\u0431\u0440\u0430\u0441\u044B\u0432\u0430\u044E\u0442
\u0442\u0435\u043D\u0438 \u0438 \u043A\u0430\u043A \u0434\u0430\u043B\u0435\u043A\u043E.
\u0423\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u0435 \u043D\u0430 \u0441\u043B\u0430\u0431\u044B\u0445
\u041F\u041A"
m_Metadata:
m_Items: []
references:
version: 2
RefIds: []
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ MonoBehaviour:
EnableGameSounds: 1
SunLightColor: {r: 0.69, g: 0.69, b: 0.69, a: 1}
SunLightIntensity: 1
SunUpdateInterval: 1
SunUpdateInterval: 0
AmbientLightColor: {r: 0.1, g: 0.1, b: 0.1, a: 1}
EnableWorldLightmaps: 1
StartTimeHour: 8
Expand Down
8 changes: 8 additions & 0 deletions Assets/Gothic-Core/Scripts/Adapters/Rendering.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
using Gothic.Core.Services.World;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering.Universal;

namespace Gothic.Core.Adapters.Rendering
{
/// <summary>
/// Tells the shaders where URP keeps this frame's shadow casting lamps/fires (StationaryLightsService picks them):
/// their index among URP's additional lights. GothicShadowedLights (GothicShadows.hlsl) lights every object in their
/// range with it - URP's per-object list holds 8 lights, a big world chunk near candles and oil lamps didn't get the
/// lamp, its light ended at the chunk's edge.
/// On the renderers with shadows (URP-HighFidelity-Renderer). Costs one loop over the visible lights per camera.
/// </summary>
public class GothicShadowLightsFeature : ScriptableRendererFeature
{
// Up to 12 lamps/fires (Shadow range option) + hero light + spell projectiles (StationaryLightsService).
// Same as GothicShadows.hlsl.
private const int _maxShadowLights = 64;

private static readonly int _indicesShaderId = Shader.PropertyToID("_GothicShadowLightIndices");
private static readonly int _countShaderId = Shader.PropertyToID("_GothicShadowLightCount");

private ShadowLightsPass _pass;

public override void Create()
{
_pass = new ShadowLightsPass { renderPassEvent = RenderPassEvent.BeforeRenderingShadows };
}

public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
{
renderer.EnqueuePass(_pass);
}

private class ShadowLightsPass : ScriptableRenderPass
{
private readonly Vector4[] _indices = new Vector4[_maxShadowLights / 4];
private StationaryLightsService _lightsService;
private float _nextResolveTime;

/// <summary>
/// The service only exists while the game runs (not for the Editor's scene view, not before the boot) -
/// asked again once a second until then.
/// </summary>
private StationaryLightsService TryResolveLightsService()
{
if (!Application.isPlaying || Time.unscaledTime < _nextResolveTime ||
ReflexProjectInstaller.DIContainer == null)
return null;

_nextResolveTime = Time.unscaledTime + 1f;
try
{
return ReflexProjectInstaller.DIContainer.Resolve<StationaryLightsService>();
}
catch (System.Exception)
{
return null;
}
}

public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
{
_lightsService ??= TryResolveLightsService();
var lightData = frameData.Get<UniversalLightData>();
var visibleLights = lightData.visibleLights;
var count = 0;

if (_lightsService != null && _lightsService.HasShadowLights)
{
// URP's additional light index: the visible lights in order, without the main light, up to its cap
// (ForwardLights.SetupAdditionalLightConstants).
var additionalIndex = 0;
var maxAdditional = UniversalRenderPipeline.maxVisibleAdditionalLights;
for (var i = 0; i < visibleLights.Length && additionalIndex < maxAdditional; i++)
{
if (i == lightData.mainLightIndex)
continue;
var light = visibleLights[i].light;
if (count < _maxShadowLights && light != null && _lightsService.IsShadowLight(light))
{
var index = _indices[count / 4];
index[count % 4] = additionalIndex;
_indices[count / 4] = index;
count++;
}
additionalIndex++;
}
}

Shader.SetGlobalVectorArray(_indicesShaderId, _indices);
Shader.SetGlobalFloat(_countShaderId, count);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading