Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

F4 switch to GPU

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
zeljko_zelicWTQ43
604 Views, 6 Replies

F4 switch to GPU

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

6 REPLIES 6
Message 2 of 7

Hi, something like this should work.

 

def gpu_rt():
    setRenderQuality(VR_QUALITY_RAYTRACING)
    setRaytracingMode(1) # GPU
vrFileIOService.newScene.connect(gpu_rt)

 

Regards,

Dan

Message 3 of 7

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.

zeljko_zelicWTQ43_0-1710344953826.png

 

Message 4 of 7

Ok, it should change when you click "New" scene icon.

Message 5 of 7

Nice, that's working, cheers mate.

Message 6 of 7
wispoxy
in reply to: zeljko_zelicWTQ43

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.

Message 7 of 7

Nice, thanks a lot.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report