Hi guys, I am not that much into Python, maybe one of can help me out. We all know the F4 activates CPU Raytracing in VRED Pro after starting a new instance of VRED. The funny thing is that once you manually switch to GPU, VRED remembers the GPU flag during the session. Ideally, I would like VRED to jump into GPU RT after I start a new instance, rather than doing it manually. Does anyone know what to change or add in the prefs?
This is the default prefs script.
# Raytracing
KeyF4 = vrKey(Key_F4)
KeyF4.connect("setRenderQuality(VR_QUALITY_RAYTRACING)")
KeyF4.connect("setFaceNormalRendering(false)")
KeyF4.connect("setDiscontinuityRendering(false)")
KeyF4.connect("setAORendering(false)")
KeyF4.setDescription("Render Mode Raytracing")
Thanks in advance!
Z
Solved! Go to Solution.
Solved by wispoxy. Go to Solution.
Hi, something like this should work.
def gpu_rt():
setRenderQuality(VR_QUALITY_RAYTRACING)
setRaytracingMode(1) # GPU
vrFileIOService.newScene.connect(gpu_rt)
Regards,
Dan
Hi Daniel, thanks for the quick reply, I tried it out, nothing is happening. No error message as such, but nothing is happening to the the icon. It still says CPU.
Python Script Modification: You can modify the Python script that handles the F4 key behavior. The default script looks like this:
Python
# Raytracing
KeyF4 = vrKey(Key_F4)
KeyF4.connect("setRenderQuality(VR_QUALITY_RAYTRACING)")
KeyF4.connect("setFaceNormalRendering(false)")
KeyF4.connect("setDiscontinuityRendering(false)")
KeyF4.connect("setAORendering(false)")
KeyF4.setDescription("Render Mode Raytracing")
To switch to GPU raytracing, you can add the following lines to the script:
Python:
def gpu_rt():
setRenderQuality(VR_QUALITY_RAYTRACING)
setRaytracingMode(1) # GPU
vrFileIOService.newScene.connect(gpu_rt)
Activate GPU Raytracing Manually: If you prefer a manual approach, you can click the “New” scene icon after starting a new instance. This will trigger the GPU raytracing mode.
VRED 2021 introduced the ability to switch between OpenGL, CPU, and GPU raytracing.
Can't find what you're looking for? Ask the community or share your knowledge.