Différents niveaux de qualité du rendu EEVEE

This commit is contained in:
Philippe Roy 2023-02-06 17:34:39 +01:00
parent 8c011aa529
commit 048555173e
5 changed files with 95 additions and 38 deletions

Binary file not shown.

18
rp.py
View File

@ -398,14 +398,8 @@ def cmd_init(cont):
# Configuration de l'écran # Configuration de l'écran
bge.render.setWindowSize(int(rp_config_tree[0][3][0].text),int(rp_config_tree[0][3][1].text)) bge.render.setWindowSize(int(rp_config_tree[0][3][0].text),int(rp_config_tree[0][3][1].text))
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
scene.objects['About']['quality'] = int(rp_config_tree[0][3][2].text) scene.objects['About']['quality'] = int(rp_config_tree[0][3][2].text)
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA': rp_about.quality_apply(scene.objects['About']['quality'])
eevee.smaa_quality= 'LOW'
eevee.use_eevee_smaa = False
else:
eevee.use_eevee_smaa = True
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
# UI : Commands # UI : Commands
scene.objects['Run-Hl'].setVisible(False,False) scene.objects['Run-Hl'].setVisible(False,False)
@ -495,7 +489,7 @@ def cmd_init(cont):
scene.objects['Text_speed']['Text']=speed_mode_txt[i] scene.objects['Text_speed']['Text']=speed_mode_txt[i]
# Windows # Windows
windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About", "Task") windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About", "Credits", "Task")
for window in windows: for window in windows:
scene.objects[window].setVisible(False,True) scene.objects[window].setVisible(False,True)
rp_doc.init() rp_doc.init()
@ -1396,14 +1390,8 @@ def config_load():
# Configuration de l'écran # Configuration de l'écran
bge.render.setWindowSize(int(rp_config_tree2[0][3][0].text),int(rp_config_tree2[0][3][1].text)) bge.render.setWindowSize(int(rp_config_tree2[0][3][0].text),int(rp_config_tree2[0][3][1].text))
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
scene.objects['About']['quality'] = int(rp_config_tree2[0][3][2].text) scene.objects['About']['quality'] = int(rp_config_tree2[0][3][2].text)
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA': rp_about.quality_apply(scene.objects['About']['quality'])
eevee.smaa_quality= 'LOW'
eevee.use_eevee_smaa = False
else:
eevee.use_eevee_smaa = True
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
# Init de la carte # Init de la carte
# Read config (mission actuelle : data/mission/current -> [1][0].text) # Read config (mission actuelle : data/mission/current -> [1][0].text)

View File

@ -383,18 +383,8 @@ def screen_down(cont):
def quality_up(cont): def quality_up(cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive : if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
scene.objects['About']['quality'] +=1 scene.objects['About']['quality'] +=1
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']] quality_apply(scene.objects['About']['quality'])
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
eevee.smaa_quality= 'LOW'
eevee.use_eevee_smaa = False
else:
eevee.use_eevee_smaa = True
# print (sys.platform)
if sys.platform=="linux": # Plantage sur Windows
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
# Boutons < et > # Boutons < et >
if scene.objects['About']['quality']==4: if scene.objects['About']['quality']==4:
@ -406,17 +396,8 @@ def quality_up(cont):
def quality_down(cont): def quality_down(cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive : if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
scene.objects['About']['quality'] -=1 scene.objects['About']['quality'] -=1
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[scene.objects['About']['quality']] quality_apply(scene.objects['About']['quality'])
if quality_eevee[scene.objects['About']['quality']] == 'NOSMAA':
eevee.smaa_quality= 'LOW'
eevee.use_eevee_smaa = False
else:
eevee.use_eevee_smaa = True
if sys.platform=="Linux": # Plantage sur Windows
eevee.smaa_quality= quality_eevee[scene.objects['About']['quality']]
# Boutons < et > # Boutons < et >
if scene.objects['About']['quality']==0: if scene.objects['About']['quality']==0:
@ -425,3 +406,89 @@ def quality_down(cont):
if scene.objects['About']['quality']==3: if scene.objects['About']['quality']==3:
scene.objects['About_quality-up'].setVisible(True,True) scene.objects['About_quality-up'].setVisible(True,True)
scene.objects['About_quality-up-colbox'].restorePhysics() scene.objects['About_quality-up-colbox'].restorePhysics()
##
# Qualité du rendu EEVEE de 0 à 4
##
def quality_apply(quality):
# Texte du About
quality_txt=("Inconvenant", "Basse", "Moyenne", "Haute", "Épique")
# quality_eevee=('NOSMAA', 'LOW', 'MEDIUM','HIGH','ULTRA')
scene.objects['About_quality']['Text']= "Qualité : "+quality_txt[quality]
# Inconvenant
if quality== 0:
eevee.use_eevee_smaa = False # Subpixel Morphological Antialiasing
eevee.use_ssr = False # Screen space reflection
eevee.use_gtao = False # Ambient occlusion
eevee.taa_render_samples = 1
eevee.taa_samples = 1
eevee.use_volumetric_lights = False
eevee.use_volumetric_shadows = False
eevee.shadow_cascade_size='64'
eevee.shadow_cube_size='64'
# Basse
if quality== 1:
eevee.use_eevee_smaa = True
eevee.smaa_quality= 'LOW'
eevee.use_ssr = True # Screen space reflection
eevee.use_ssr_refraction = False # Screen space refractions
eevee.use_ssr_halfres = True
eevee.use_gtao = False
eevee.taa_render_samples = 32
eevee.taa_samples = 8
eevee.use_volumetric_lights = True
eevee.use_volumetric_shadows = False
eevee.shadow_cascade_size='1024'
eevee.shadow_cube_size='512'
# Moyenne
if quality== 2:
eevee.use_eevee_smaa = True
eevee.smaa_quality= 'MEDIUM'
eevee.use_ssr = True # Screen space reflection
eevee.use_ssr_refraction = True # Screen space refractions
eevee.use_ssr_halfres = True
eevee.use_gtao = False
eevee.taa_render_samples = 64
eevee.taa_samples = 16
eevee.use_volumetric_lights = True
eevee.use_volumetric_shadows = False
eevee.shadow_cascade_size='1024'
eevee.shadow_cube_size='512'
# Haute
if quality== 3:
eevee.use_eevee_smaa = True
eevee.smaa_quality= 'HIGH'
eevee.use_ssr = True
eevee.use_ssr_refraction = True
eevee.use_ssr_halfres = False
eevee.use_gtao = False
eevee.taa_render_samples = 64
eevee.taa_samples = 16
eevee.use_volumetric_lights = True
eevee.use_volumetric_shadows = False
eevee.shadow_cascade_size='1024'
eevee.shadow_cube_size='512'
# Épique
if quality== 4:
eevee.use_eevee_smaa = True
eevee.smaa_quality= 'ULTRA'
eevee.use_ssr = True
eevee.use_ssr_refraction = True
eevee.use_ssr_halfres = False
eevee.use_gtao = True
eevee.taa_render_samples = 64
eevee.taa_samples = 16
eevee.use_volumetric_lights = True
eevee.use_volumetric_shadows = True
eevee.shadow_cascade_size='4096'
eevee.shadow_cube_size='4096'

View File

@ -10,7 +10,7 @@
<screen> <screen>
<width>1641</width> <width>1641</width>
<height>924</height> <height>924</height>
<quality>1</quality> <quality>4</quality>
</screen> </screen>
</config> </config>
<mission> <mission>

View File

@ -534,6 +534,8 @@ def rp_marquer (twins=True):
beacon.worldPosition=[x,y,0.2] beacon.worldPosition=[x,y,0.2]
beacon['activated']=True beacon['activated']=True
beacon.setVisible(True, True) beacon.setVisible(True, True)
if scene.objects['About']['quality'] < 2: # Qualité de rendu : faible -> sans la sphère
beacon.children[1].setVisible(False, True)
scene.objects['Terrain']['map_tile_beacon'].append([x,y]) scene.objects['Terrain']['map_tile_beacon'].append([x,y])
break break
if i ==beacon_max-1 : if i ==beacon_max-1 :