Skip to content

Commit

Permalink
Split r__geometry_lod con cmd to 5 different commands
Browse files Browse the repository at this point in the history
`r__lod_sprite_dist_f`, `r__geom_quality_dist_f`, `r__geom_discard_dist_f`, `r__dtexture_dist_f`, `r__ntexture_dist_f`
  • Loading branch information
MAYLAYSHEZ authored and Drombeys committed Apr 30, 2024
1 parent 98ab44b commit 5a962b2
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 51 deletions.
1 change: 0 additions & 1 deletion src/Layers/xrRender/r__dsgraph_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ using namespace R_dsgraph;
// Scene graph actual insertion and sorting ////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
float r_ssaDISCARD;
float r_ssaDONTSORT;
float r_ssaLOD_A, r_ssaLOD_B;
float r_ssaGLOD_start, r_ssaGLOD_end;
float r_ssaHZBvsTEX;
Expand Down
1 change: 0 additions & 1 deletion src/Layers/xrRender/r__dsgraph_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using namespace R_dsgraph;

extern float r_ssaDISCARD;
extern float r_ssaDONTSORT;
extern float r_ssaHZBvsTEX;
extern float r_ssaGLOD_start, r_ssaGLOD_end;

Expand Down
31 changes: 20 additions & 11 deletions src/Layers/xrRender/xrRender_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,18 @@ float ps_r__WallmarkTTL = 50.f ;
float ps_r__WallmarkSHIFT = 0.0001f;
float ps_r__WallmarkSHIFT_V = 0.0001f;

float ps_r__GLOD_ssa_start = 256.f ;
float ps_r__GLOD_ssa_end = 64.f ;
float ps_r__LOD = 0.75f ;
//. float ps_r__LOD_Power = 1.5f ;
float ps_r__ssaDISCARD = 3.5f ; //RO
float ps_r__ssaDONTSORT = 32.f ; //RO
float ps_r__ssaHZBvsTEX = 96.f ; //RO
// Base factor values
float ps_r__GLOD_ssa_start = 256.f;
float ps_r__GLOD_ssa_end = 64.f;
float ps_r__ssaDISCARD = 3.5f;
float ps_r__ssaHZBvsTEX = 96.f;

// Distance factor values
float ps_r__geomLodSpriteDistF_ = 0.75f;
float ps_r__geomDiscardDistF_ = 0.75f;
float ps_r__geomLodDistF_ = 0.75f;
float ps_r__geomNTextureDistF_ = 0.75f;
float ps_r__geomDTextureDistF_ = 0.75f;

int ps_r__tf_Anisotropic = 8 ;

Expand Down Expand Up @@ -679,8 +684,6 @@ void xrRender_initconsole ()
CMD1(CCC_BuildSSA, "build_ssa" );
#endif
CMD4(CCC_Integer, "r__lsleep_frames", &ps_r__LightSleepFrames, 4, 30 );
CMD4(CCC_Float, "r__ssa_glod_start", &ps_r__GLOD_ssa_start, 128, 512 );
CMD4(CCC_Float, "r__ssa_glod_end", &ps_r__GLOD_ssa_end, 16, 96 );
CMD4(CCC_Float, "r__wallmark_shift_pp", &ps_r__WallmarkSHIFT, 0.0f, 1.f );
CMD4(CCC_Float, "r__wallmark_shift_v", &ps_r__WallmarkSHIFT_V, 0.0f, 1.f );
CMD1(CCC_ModelPoolStat,"stat_models" );
Expand All @@ -691,8 +694,14 @@ void xrRender_initconsole ()

Fvector tw_min,tw_max;

CMD4(CCC_Float, "r__geometry_lod", &ps_r__LOD, 0.1f, 1.2f );
//. CMD4(CCC_Float, "r__geometry_lod_pow", &ps_r__LOD_Power, 0, 2 );
// Geometry Lod control
CMD4(CCC_Float, "r__ssa_glod_start", &ps_r__GLOD_ssa_start, 128, 512);
CMD4(CCC_Float, "r__ssa_glod_end", &ps_r__GLOD_ssa_end, 16, 96);
CMD4(CCC_Float, "r__lod_sprite_dist_f", &ps_r__geomLodSpriteDistF_, 0.1f, 3.0f);
CMD4(CCC_Float, "r__geom_quality_dist_f", &ps_r__geomLodDistF_, 0.1f, 3.0f);
CMD4(CCC_Float, "r__geom_discard_dist_f", &ps_r__geomDiscardDistF_, 0.1f, 3.0f);
CMD4(CCC_Float, "r__dtexture_dist_f", &ps_r__geomDTextureDistF_, 0.1f, 3.0f);
CMD4(CCC_Float, "r__ntexture_dist_f", &ps_r__geomNTextureDistF_, 0.1f, 3.0f);

CMD4(CCC_Float, "r__detail_density", &ps_r__Detail_density, 0.2f, 0.8f );

Expand Down
8 changes: 5 additions & 3 deletions src/Layers/xrRender/xrRender_console.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ extern ECORE_API float ps_r__WallmarkSHIFT_V ;

extern ECORE_API float ps_r__GLOD_ssa_start;
extern ECORE_API float ps_r__GLOD_ssa_end ;
extern ECORE_API float ps_r__LOD ;
//.extern ECORE_API float ps_r__LOD_Power ;
extern ECORE_API float ps_r__ssaDISCARD ;
extern ECORE_API float ps_r__ssaDONTSORT ;
extern ECORE_API float ps_r__ssaHZBvsTEX ;
extern ECORE_API float ps_r__geomLodSpriteDistF_;
extern ECORE_API float ps_r__geomDiscardDistF_;
extern ECORE_API float ps_r__geomLodDistF_;
extern ECORE_API float ps_r__geomNTextureDistF_;
extern ECORE_API float ps_r__geomDTextureDistF_;
extern ECORE_API int ps_r__tf_Anisotropic;

// R1
Expand Down
28 changes: 17 additions & 11 deletions src/Layers/xrRenderPC_R1/FStaticRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ CRender::~CRender()
}

extern float r_ssaDISCARD;
extern float r_ssaDONTSORT;
extern float r_ssaLOD_A, r_ssaLOD_B;
extern float r_ssaGLOD_start, r_ssaGLOD_end;
extern float r_ssaHZBvsTEX;
Expand All @@ -349,16 +348,23 @@ void CRender::Calculate ()
Device.Statistic->RenderCALC.Begin();

// Transfer to global space to avoid deep pointer access
IRender_Target* T = getTarget ();
float fov_factor = _sqr (90.f / Device.fFOV);
g_fSCREEN = float(T->get_width()*T->get_height())*fov_factor*(EPS_S+ps_r__LOD);
r_ssaDISCARD = _sqr(ps_r__ssaDISCARD) /g_fSCREEN;
r_ssaDONTSORT = _sqr(ps_r__ssaDONTSORT/3) /g_fSCREEN;
r_ssaLOD_A = _sqr(ps_r1_ssaLOD_A/3) /g_fSCREEN;
r_ssaLOD_B = _sqr(ps_r1_ssaLOD_B/3) /g_fSCREEN;
r_ssaGLOD_start = _sqr(ps_r__GLOD_ssa_start/3)/g_fSCREEN;
r_ssaGLOD_end = _sqr(ps_r__GLOD_ssa_end/3) /g_fSCREEN;
r_ssaHZBvsTEX = _sqr(ps_r__ssaHZBvsTEX/3) /g_fSCREEN;
IRender_Target* T = getTarget();

float fov_factor = _sqr(90.f / Device.fFOV);

g_fSCREEN = float(T->get_width() * T->get_height()) * fov_factor;

float sprite_lodding_dist_f = g_fSCREEN * (EPS_S + ps_r__geomLodSpriteDistF_);
float geom_q_dist_f = g_fSCREEN * (EPS_S + ps_r__geomLodDistF_);
float geom_discard_dist_f = g_fSCREEN * (EPS_S + ps_r__geomDiscardDistF_);
float geom_nt_dist_f = g_fSCREEN * (EPS_S + ps_r__geomNTextureDistF_);

r_ssaDISCARD = _sqr(ps_r__ssaDISCARD) / geom_discard_dist_f;
r_ssaLOD_A = _sqr(ps_r1_ssaLOD_A / 3) / sprite_lodding_dist_f;
r_ssaLOD_B = _sqr(ps_r1_ssaLOD_B / 3) / sprite_lodding_dist_f;
r_ssaGLOD_start = _sqr(ps_r__GLOD_ssa_start / 3) / geom_q_dist_f;
r_ssaGLOD_end = _sqr(ps_r__GLOD_ssa_end / 3) / geom_q_dist_f;
r_ssaHZBvsTEX = _sqr(ps_r__ssaHZBvsTEX / 3) / geom_nt_dist_f;

// Frustum & HOM rendering
ViewBase.CreateFromMatrix (Device.mFullTransform,FRUSTUM_P_LRTB|FRUSTUM_P_FAR);
Expand Down
31 changes: 19 additions & 12 deletions src/Layers/xrRenderPC_R2/r2_R_calculate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ float g_fSCREEN ;

extern float r_dtex_range ;
extern float r_ssaDISCARD ;
extern float r_ssaDONTSORT ;
extern float r_ssaLOD_A ;
extern float r_ssaLOD_B ;
extern float r_ssaHZBvsTEX ;
Expand All @@ -14,17 +13,25 @@ extern float r_ssaGLOD_start, r_ssaGLOD_end;
void CRender::Calculate ()
{
// Transfer to global space to avoid deep pointer access
IRender_Target* T = getTarget ();
float fov_factor = _sqr (90.f / Device.fFOV);
g_fSCREEN = float(T->get_width()*T->get_height())*fov_factor*(EPS_S+ps_r__LOD);
r_ssaDISCARD = _sqr(ps_r__ssaDISCARD) /g_fSCREEN;
r_ssaDONTSORT = _sqr(ps_r__ssaDONTSORT/3) /g_fSCREEN;
r_ssaLOD_A = _sqr(ps_r2_ssaLOD_A/3) /g_fSCREEN;
r_ssaLOD_B = _sqr(ps_r2_ssaLOD_B/3) /g_fSCREEN;
r_ssaGLOD_start = _sqr(ps_r__GLOD_ssa_start/3)/g_fSCREEN;
r_ssaGLOD_end = _sqr(ps_r__GLOD_ssa_end/3) /g_fSCREEN;
r_ssaHZBvsTEX = _sqr(ps_r__ssaHZBvsTEX/3) /g_fSCREEN;
r_dtex_range = ps_r2_df_parallax_range * g_fSCREEN / (1024.f * 768.f);
IRender_Target* T = getTarget();

float fov_factor = _sqr(90.f / Device.fFOV);

g_fSCREEN = float(T->get_width() * T->get_height()) * fov_factor;

float sprite_lodding_dist_f = g_fSCREEN * (EPS_S + ps_r__geomLodSpriteDistF_);
float geom_q_dist_f = g_fSCREEN * (EPS_S + ps_r__geomLodDistF_);
float geom_discard_dist_f = g_fSCREEN * (EPS_S + ps_r__geomDiscardDistF_);
float geom_nt_dist_f = g_fSCREEN * (EPS_S + ps_r__geomNTextureDistF_);
float geom_dt_dist_f = g_fSCREEN * (EPS_S + ps_r__geomDTextureDistF_);

r_ssaDISCARD = _sqr(ps_r__ssaDISCARD) / geom_discard_dist_f;
r_ssaLOD_A = _sqr(ps_r2_ssaLOD_A / 3) / sprite_lodding_dist_f;
r_ssaLOD_B = _sqr(ps_r2_ssaLOD_B / 3) / sprite_lodding_dist_f;
r_ssaGLOD_start = _sqr(ps_r__GLOD_ssa_start / 3) / geom_q_dist_f;
r_ssaGLOD_end = _sqr(ps_r__GLOD_ssa_end / 3) / geom_q_dist_f;
r_ssaHZBvsTEX = _sqr(ps_r__ssaHZBvsTEX / 3) / geom_nt_dist_f;
r_dtex_range = ps_r2_df_parallax_range * geom_dt_dist_f / (1024.f * 768.f);

// Detect camera-sector
if (!vLastCameraPos.similar(Device.vCameraPosition,EPS_S))
Expand Down
31 changes: 19 additions & 12 deletions src/Layers/xrRenderPC_R4/r2_R_calculate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ float g_fSCREEN ;

extern float r_dtex_range ;
extern float r_ssaDISCARD ;
extern float r_ssaDONTSORT ;
extern float r_ssaLOD_A ;
extern float r_ssaLOD_B ;
extern float r_ssaHZBvsTEX ;
Expand All @@ -14,17 +13,25 @@ extern float r_ssaGLOD_start, r_ssaGLOD_end;
void CRender::Calculate ()
{
// Transfer to global space to avoid deep pointer access
IRender_Target* T = getTarget ();
float fov_factor = _sqr (90.f / Device.fFOV);
g_fSCREEN = float(T->get_width()*T->get_height())*fov_factor*(EPS_S+ps_r__LOD);
r_ssaDISCARD = _sqr(ps_r__ssaDISCARD) /g_fSCREEN;
r_ssaDONTSORT = _sqr(ps_r__ssaDONTSORT/3) /g_fSCREEN;
r_ssaLOD_A = _sqr(ps_r2_ssaLOD_A/3) /g_fSCREEN;
r_ssaLOD_B = _sqr(ps_r2_ssaLOD_B/3) /g_fSCREEN;
r_ssaGLOD_start = _sqr(ps_r__GLOD_ssa_start/3)/g_fSCREEN;
r_ssaGLOD_end = _sqr(ps_r__GLOD_ssa_end/3) /g_fSCREEN;
r_ssaHZBvsTEX = _sqr(ps_r__ssaHZBvsTEX/3) /g_fSCREEN;
r_dtex_range = ps_r2_df_parallax_range * g_fSCREEN / (1024.f * 768.f);
IRender_Target* T = getTarget();

float fov_factor = _sqr(90.f / Device.fFOV);

g_fSCREEN = float(T->get_width() * T->get_height()) * fov_factor;

float sprite_lodding_dist_f = g_fSCREEN * (EPS_S + ps_r__geomLodSpriteDistF_);
float geom_q_dist_f = g_fSCREEN * (EPS_S + ps_r__geomLodDistF_);
float geom_discard_dist_f = g_fSCREEN * (EPS_S + ps_r__geomDiscardDistF_);
float geom_nt_dist_f = g_fSCREEN * (EPS_S + ps_r__geomNTextureDistF_);
float geom_dt_dist_f = g_fSCREEN * (EPS_S + ps_r__geomDTextureDistF_);

r_ssaDISCARD = _sqr(ps_r__ssaDISCARD) / geom_discard_dist_f;
r_ssaLOD_A = _sqr(ps_r2_ssaLOD_A / 3) / sprite_lodding_dist_f;
r_ssaLOD_B = _sqr(ps_r2_ssaLOD_B / 3) / sprite_lodding_dist_f;
r_ssaGLOD_start = _sqr(ps_r__GLOD_ssa_start / 3) / geom_q_dist_f;
r_ssaGLOD_end = _sqr(ps_r__GLOD_ssa_end / 3) / geom_q_dist_f;
r_ssaHZBvsTEX = _sqr(ps_r__ssaHZBvsTEX / 3) / geom_nt_dist_f;
r_dtex_range = ps_r2_df_parallax_range * geom_dt_dist_f / (1024.f * 768.f);

// Detect camera-sector
if (!vLastCameraPos.similar(Device.vCameraPosition,EPS_S))
Expand Down

0 comments on commit 5a962b2

Please sign in to comment.