Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo for OffScreen rendering? #440

Open
lfz opened this issue Dec 11, 2023 · 5 comments
Open

demo for OffScreen rendering? #440

lfz opened this issue Dec 11, 2023 · 5 comments
Assignees

Comments

@lfz
Copy link

lfz commented Dec 11, 2023

Hi, I really like the offscreen rendering effect. the color, shadow looks really great. And I cannot tune this effect on the online version. Besides, the online version does not have the auto-rotate function.

I am wondering how to

  1. achieve the same rendering effect
  2. achieve the auto-rotate function

thank you !

@artur-trzesiok
Copy link
Collaborator

Hi @lfz !

Can you provide example? I'm not sure about what auto-rotate function and rendering are you talking. Please share some code or screens to clarify that. Thanks!

@artur-trzesiok artur-trzesiok self-assigned this Jan 4, 2024
@lfz
Copy link
Author

lfz commented Jan 4, 2024

these two videos:

https://www.youtube.com/watch?v=zCeQ_ZXy_Ps

https://www.youtube.com/watch?v=9evYSq3ieVs

besides, how to make a video/gif like this?

@artur-trzesiok
Copy link
Collaborator

I used offscreen rendering aka headless browser:
https://github.com/K3D-tools/K3D-jupyter/blob/main/examples/headless.ipynb

K3D have no auto-rotate function but that is feature that we can discuss. But we can animate camera:
https://github.com/K3D-tools/K3D-jupyter/blob/main/examples/Camera_interactive_demo.ipynb

@GregorKobsik
Copy link

Hi,
I had some issues with running the headless.ipynb example, but managed to resolve them on my own.

I was getting the error AttributeError: 'NoneType' object has no attribute 'split'
I needed to modify get_headless_driver as ChromeDriverManager().install() was giving me the error.

Following Stackoverflow comment from JeffC, he pointed out: "as of Selenium 4.6+, Selenium now has a driver manager built in so you no longer need ChromeDriverManager()"

The new working code looks like this:

def get_headless_driver(no_headless=False):
    from selenium import webdriver

    options = webdriver.ChromeOptions()

    options.add_argument("--no-sandbox")
    options.add_argument("--disable-crash-reporter")

    if not no_headless:
        options.add_argument("--headless")

    return webdriver.Chrome(options=options)

Result/Output:

screenshot

@artur-trzesiok
Copy link
Collaborator

@GregorKobsik great sugesstion. I will change a code after testing. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants