Skip to content

Commit

Permalink
New options that allow you to configure dynamic wet surfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jul 14, 2018
1 parent 886de2b commit d354433
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 5 deletions.
12 changes: 12 additions & 0 deletions res/gamedata/configs/text/eng/ui_st_mm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,18 @@
<string id="ui_mm_r3_dynamic_wet_surfaces">
<text>Wet surfaces</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_opt">
<text>Wet surfaces optimization</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_near">
<text>Wet surfaces near dist.</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_far">
<text>Wet surfaces far dist.</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_sm_res">
<text>Wet surfaces quality</text>
</string>
<string id="ui_mm_r3_gbuffer_opt">
<text>Optimize geometric buffer</text>
</string>
Expand Down
12 changes: 12 additions & 0 deletions res/gamedata/configs/text/rus/ui_st_mm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,18 @@
<string id="ui_mm_r3_dynamic_wet_surfaces">
<text>Íàìîêàíèå ïëîñêîñòåé</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_opt">
<text>Îïòèìèçàöèÿ íàìîêàíèÿ</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_near">
<text>Íàìîêàíèå âáëèçè</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_far">
<text>Íàìîêàíèå âäàëè</text>
</string>
<string id="ui_mm_r3_dynamic_wet_surfaces_sm_res">
<text>Êà÷åñòâî íàìîêàíèÿ</text>
</string>
<string id="ui_mm_r3_gbuffer_opt">
<text>Îïòèìèçèðîâàòü ãåîìåòð. áóôåð</text>
</string>
Expand Down
34 changes: 34 additions & 0 deletions res/gamedata/configs/ui/ui_mm_opt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,45 @@
<cap_r3_dynamic_wet_surfaces x="20" y="3" width="135" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces</text>
</cap_r3_dynamic_wet_surfaces>

<check_r3_dynamic_wet_surfaces x="167" y="0" width="44" height="29">
<texture>ui_inGame2_checkbox</texture>
<options_item entry="r3_dynamic_wet_surfaces" group="mm_opt_video"/>
</check_r3_dynamic_wet_surfaces>

<cap_r3_dynamic_wet_surfaces_opt x="20" y="3" width="135" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_opt</text>
</cap_r3_dynamic_wet_surfaces_opt>

<check_r3_dynamic_wet_surfaces_opt x="167" y="0" width="44" height="29">
<texture>ui_inGame2_checkbox</texture>
<options_item entry="r3_dynamic_wet_surfaces_opt" group="mm_opt_video" is_integer="1" depend="vid"/>
</check_r3_dynamic_wet_surfaces_opt>

<cap_r3_dynamic_wet_surfaces_near x="20" y="3" width="135" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_near</text>
</cap_r3_dynamic_wet_surfaces_near>

<track_r3_dynamic_wet_surfaces_near x="175" y="97" width="235" height="16">
<options_item entry="r3_dynamic_wet_surfaces_near" group="mm_opt_video" depend="runtime"/>
</track_r3_dynamic_wet_surfaces_near>

<cap_r3_dynamic_wet_surfaces_far x="20" y="3" width="135" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_far</text>
</cap_r3_dynamic_wet_surfaces_far>

<track_r3_dynamic_wet_surfaces_far x="175" y="97" width="235" height="16">
<options_item entry="r3_dynamic_wet_surfaces_far" group="mm_opt_video" depend="runtime"/>
</track_r3_dynamic_wet_surfaces_far>

<cap_r3_dynamic_wet_surfaces_sm_res x="20" y="3" width="135" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_sm_res</text>
</cap_r3_dynamic_wet_surfaces_sm_res>

<track_r3_dynamic_wet_surfaces_sm_res x="175" y="97" width="235" height="16" step="16" is_integer="1">
<options_item entry="r3_dynamic_wet_surfaces_sm_res" group="mm_opt_video" depend="runtime"/>
</track_r3_dynamic_wet_surfaces_sm_res>

<cap_r3_volumetric_smoke x="20" y="3" width="135" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_volumetric_smoke</text>
</cap_r3_volumetric_smoke>
Expand Down
34 changes: 34 additions & 0 deletions res/gamedata/configs/ui/ui_mm_opt_16.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,45 @@
<cap_r3_dynamic_wet_surfaces x="16" y="3" width="108" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces</text>
</cap_r3_dynamic_wet_surfaces>

<check_r3_dynamic_wet_surfaces x="133" y="0" width="35" stretch="1" height="29">
<texture>ui_inGame2_checkbox</texture>
<options_item entry="r3_dynamic_wet_surfaces" group="mm_opt_video"/>
</check_r3_dynamic_wet_surfaces>

<cap_r3_dynamic_wet_surfaces_opt x="16" y="3" width="108" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_opt</text>
</cap_r3_dynamic_wet_surfaces_opt>

<check_r3_dynamic_wet_surfaces_opt x="133" y="0" width="35" stretch="1" height="29">
<texture>ui_inGame2_checkbox</texture>
<options_item entry="r3_dynamic_wet_surfaces_opt" group="mm_opt_video" is_integer="1" depend="vid"/>
</check_r3_dynamic_wet_surfaces_opt>

<cap_r3_dynamic_wet_surfaces_near x="16" y="3" width="108" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_near</text>
</cap_r3_dynamic_wet_surfaces_near>

<track_r3_dynamic_wet_surfaces_near x="144" y="6" width="188" height="16">
<options_item entry="r3_dynamic_wet_surfaces_near" group="mm_opt_video" depend="runtime"/>
</track_r3_dynamic_wet_surfaces_near>

<cap_r3_dynamic_wet_surfaces_far x="16" y="3" width="108" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_far</text>
</cap_r3_dynamic_wet_surfaces_far>

<track_r3_dynamic_wet_surfaces_far x="144" y="6" width="188" height="16">
<options_item entry="r3_dynamic_wet_surfaces_far" group="mm_opt_video" depend="runtime"/>
</track_r3_dynamic_wet_surfaces_far>

<cap_r3_dynamic_wet_surfaces_sm_res x="16" y="3" width="108" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_dynamic_wet_surfaces_sm_res</text>
</cap_r3_dynamic_wet_surfaces_sm_res>

<track_r3_dynamic_wet_surfaces_sm_res x="144" y="6" width="188" height="16" step="16" is_integer="1">
<options_item entry="r3_dynamic_wet_surfaces_sm_res" group="mm_opt_video" depend="runtime"/>
</track_r3_dynamic_wet_surfaces_sm_res>

<cap_r3_volumetric_smoke x="16" y="3" width="108" height="24">
<text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_r3_volumetric_smoke</text>
</cap_r3_volumetric_smoke>
Expand Down
27 changes: 27 additions & 0 deletions res/gamedata/scripts/ui_mm_opt_main.script
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,30 @@ function options_dialog:UpdateDependControls()
self:OnAOOptionChange()
end

function options_dialog:OnDynWetSurfNearUpdate()
local near = self.track_r3_dyn_wet_surf_near:GetFValue()
local far = self.track_r3_dyn_wet_surf_far:GetFValue()

if (near > far) then
local console = get_console()
console:execute("r3_dynamic_wet_surfaces_far " .. near + 1)
end

self.track_r3_dyn_wet_surf_far:SetCurrentValue()
end

function options_dialog:OnDynWetSurfFarUpdate()
local near = self.track_r3_dyn_wet_surf_near:GetFValue()
local far = self.track_r3_dyn_wet_surf_far:GetFValue()

if (far < near) then
local console = get_console()
console:execute("r3_dynamic_wet_surfaces_near " .. far - 1)
end

self.track_r3_dyn_wet_surf_near:SetCurrentValue()
end

function options_dialog:InitCallBacks()
self:AddCallback("tab", ui_events.TAB_CHANGED, self.OnTabChange, self)
self:AddCallback("btn_advanced_graphic",ui_events.BUTTON_CLICKED, self.OnBtnAdvGraphic, self)
Expand All @@ -149,6 +173,9 @@ function options_dialog:InitCallBacks()
self:AddCallback("combo_renderer", ui_events.LIST_ITEM_SELECT, self.UpdateDependControls, self)
self:AddCallback("btn_cancel_download", ui_events.BUTTON_CLICKED, self.OnBtn_CancelDownload, self)
self:AddCallback("tab_ao_opt", ui_events.TAB_CHANGED, self.OnAOOptionChange, self)
self:AddCallback("track_r3_dyn_wet_surf_near", ui_events.BUTTON_CLICKED, self.OnDynWetSurfNearUpdate, self)
self:AddCallback("track_r3_dyn_wet_surf_far", ui_events.BUTTON_CLICKED, self.OnDynWetSurfFarUpdate, self)


self:AddCallback("mb", ui_events.MESSAGE_BOX_YES_CLICKED, self.OnApplyChanges, self)
self:AddCallback("mb", ui_events.MESSAGE_BOX_NO_CLICKED, self.OnDiscardChanges,self)
Expand Down
24 changes: 24 additions & 0 deletions res/gamedata/scripts/ui_mm_opt_video_adv.script
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,30 @@ function opt_video_adv:InitControls(x, y, xml, handler)
ctl = xml:InitCheck ("video_adv:check_r3_dynamic_wet_surfaces", _st)
table.insert(handler.m_preconditions, {func=mode_ge_3, control=_st})

_st = xml:InitStatic("video_adv:templ_item", nil)
xml:InitStatic("video_adv:cap_r3_dynamic_wet_surfaces_opt", _st)
ctl = xml:InitCheck ("video_adv:check_r3_dynamic_wet_surfaces_opt", _st)
table.insert(handler.m_preconditions, {func=mode_ge_3, control=_st})

_st = xml:InitStatic("video_adv:templ_item", nil)
xml:InitStatic("video_adv:cap_r3_dynamic_wet_surfaces_near", _st)
ctl = xml:InitTrackBar("video_adv:track_r3_dynamic_wet_surfaces_near", _st)
handler.track_r3_dyn_wet_surf_near = ctl
handler:Register(ctl, "track_r3_dyn_wet_surf_near")
table.insert(handler.m_preconditions, {func=mode_ge_3, control=_st})

_st = xml:InitStatic("video_adv:templ_item", nil)
xml:InitStatic("video_adv:cap_r3_dynamic_wet_surfaces_far", _st)
ctl = xml:InitTrackBar("video_adv:track_r3_dynamic_wet_surfaces_far", _st)
handler.track_r3_dyn_wet_surf_far = ctl
handler:Register(ctl, "track_r3_dyn_wet_surf_far")
table.insert(handler.m_preconditions, {func=mode_ge_3, control=_st})

_st = xml:InitStatic("video_adv:templ_item", nil)
xml:InitStatic("video_adv:cap_r3_dynamic_wet_surfaces_sm_res", _st)
ctl = xml:InitTrackBar("video_adv:track_r3_dynamic_wet_surfaces_sm_res", _st)
table.insert(handler.m_preconditions, {func=mode_ge_2, control=_st})

-- r3_volumetric_smoke >r25
_st = xml:InitStatic("video_adv:templ_item", nil)
xml:InitStatic("video_adv:cap_r3_volumetric_smoke", _st)
Expand Down
Binary file modified res/gamedata/shaders/r3/rain_patch_normal_new.ps
Binary file not shown.
8 changes: 5 additions & 3 deletions src/Layers/xrRender/xrRender_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ Fvector3 ps_r2_dof = Fvector3().set(-1.25f, 1.4f, 600.f);
float ps_r2_dof_sky = 30; // distance to sky
float ps_r2_dof_kernel_size = 5.0f; // 7.0f

float ps_r3_dyn_wet_surf_near = 10.f; // 10.0f
float ps_r3_dyn_wet_surf_far = 30.f; // 30.0f
int ps_r3_dyn_wet_surf_opt = 1;
float ps_r3_dyn_wet_surf_near = 5.f; // 10.0f
float ps_r3_dyn_wet_surf_far = 20.f; // 30.0f
int ps_r3_dyn_wet_surf_sm_res = 256; // 256

//AVO: detail draw radius
Expand Down Expand Up @@ -909,7 +910,8 @@ void xrRender_initconsole()
#endif // (RENDER == R_R3) || (RENDER == R_R4)

CMD3(CCC_Mask, "r3_dynamic_wet_surfaces", &ps_r2_ls_flags, R3FLAG_DYN_WET_SURF);
CMD4(CCC_Float, "r3_dynamic_wet_surfaces_near", &ps_r3_dyn_wet_surf_near, 10, 70);
CMD4(CCC_Integer, "r3_dynamic_wet_surfaces_opt", &ps_r3_dyn_wet_surf_opt, 0, 1);
CMD4(CCC_Float, "r3_dynamic_wet_surfaces_near", &ps_r3_dyn_wet_surf_near, 5, 70);
CMD4(CCC_Float, "r3_dynamic_wet_surfaces_far", &ps_r3_dyn_wet_surf_far, 30, 100);
CMD4(CCC_Integer, "r3_dynamic_wet_surfaces_sm_res", &ps_r3_dyn_wet_surf_sm_res, 64, 2048);

Expand Down
1 change: 1 addition & 0 deletions src/Layers/xrRender/xrRender_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ extern ECORE_API Fvector3 ps_r2_dof;
extern ECORE_API float ps_r2_dof_sky; // distance to sky
extern ECORE_API float ps_r2_dof_kernel_size; // 7.0f

extern ECORE_API int ps_r3_dyn_wet_surf_opt;
extern ECORE_API float ps_r3_dyn_wet_surf_near; // 10.0f
extern ECORE_API float ps_r3_dyn_wet_surf_far; // 30.0f
extern ECORE_API int ps_r3_dyn_wet_surf_sm_res; // 256
Expand Down
10 changes: 8 additions & 2 deletions src/Layers/xrRenderDX10/DX10 Rain/dx10RainBlender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ void CBlender_rain::Compile(CBlender_Compile& C)
// C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE);
// C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA,
// D3DBLEND_INVSRCALPHA);
C.r_Pass("stub_notransform_2uv", "rain_patch_normal_nomsaa", false, TRUE, FALSE, FALSE);
if (ps_r3_dyn_wet_surf_opt)
C.r_Pass("stub_notransform_2uv", "rain_patch_normal_nomsaa", false, TRUE, FALSE, FALSE);
else
C.r_Pass("stub_notransform_2uv", "rain_patch_normal_new_nomsaa", false, TRUE, FALSE, FALSE);
C.PassSET_ZB(TRUE, FALSE, TRUE); // force inverted Z-Buffer

C.r_dx10Texture("s_position", r2_RT_P);
Expand Down Expand Up @@ -165,7 +168,10 @@ void CBlender_rain_msaa::Compile(CBlender_Compile& C)
// C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_ONE, D3DBLEND_ONE);
// C.r_Pass ("stub_notransform_2uv", "rain_layer", false, TRUE, FALSE, TRUE, D3DBLEND_SRCALPHA,
// D3DBLEND_INVSRCALPHA);
C.r_Pass("stub_notransform_2uv", "rain_patch_normal_msaa", false, TRUE, FALSE, FALSE);
if (ps_r3_dyn_wet_surf_opt)
C.r_Pass("stub_notransform_2uv", "rain_patch_normal_msaa", false, TRUE, FALSE, FALSE);
else
C.r_Pass("stub_notransform_2uv", "rain_patch_normal_new_msaa", false, TRUE, FALSE, FALSE);
C.PassSET_ZB(TRUE, FALSE, TRUE); // force inverted Z-Buffer

C.r_dx10Texture("s_position", r2_RT_P);
Expand Down
2 changes: 2 additions & 0 deletions src/Layers/xrRenderPC_R3/r3_rendertarget_draw_rain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ void CRenderTarget::draw_rain(light& RainSetup)
RCache.set_c("m_shadow", m_shadow);
RCache.set_c("m_sunmask", m_clouds_shadow);
RCache.set_c("RainDensity", fRainFactor, 0, 0, 0);
RCache.set_c("RainFallof", ps_r3_dyn_wet_surf_near, ps_r3_dyn_wet_surf_far, 0, 0);

if (!RImplementation.o.dx10_msaa)
{
RCache.set_Stencil(TRUE, D3DCMP_EQUAL, 0x01, 0x01, 0);
Expand Down

0 comments on commit d354433

Please sign in to comment.