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

Add secondary light to 3D Advanced Import Settings #76140

Conversation

jeronimo-schreyer
Copy link
Contributor

@jeronimo-schreyer jeronimo-schreyer commented Apr 16, 2023

Added a second light for the 3D Preview Viewport and UI toggle buttons which resemble the ones in the EditorMaterialPreviewPlugin

On branch add_secondary_light_to_3d_resource_importer
Changes to be committed:
modified: editor/import/scene_import_settings.cpp
modified: editor/import/scene_import_settings.h

@aaronfranke
Copy link
Member

Tested. I noticed that the two lights are coming from similar angles, one more on top and one more on the side. However, the material preview has light coming from very different angles, one light in the bottom and one light in the top right. Since one of the goals is to resemble that editor, shouldn't one of the lights be coming from below?

Also, in the material preview, the lights stay fixed relative to the camera. In this PR, the lights are fixed relative to the object. I think it would be better to have lights fixed relative to the camera, so you can view different parts of the model illuminated by the light at different angles relative to the model, instead of having a fixed part of the model lit at the same angle relative to the model.

@YuriSizov YuriSizov modified the milestones: 4.x, 4.3 Oct 17, 2023
@aaronfranke aaronfranke self-assigned this Apr 16, 2024
@aaronfranke aaronfranke force-pushed the add_secondary_light_to_3d_resource_importer branch from 47cd8e4 to c3bc768 Compare April 16, 2024 17:16
@jeronimo-schreyer jeronimo-schreyer requested review from a team as code owners April 16, 2024 17:16
@aaronfranke
Copy link
Member

aaronfranke commented Apr 16, 2024

Since the original author was inactive, I sent them an email asking for write access to their repo so I can push to their PRs, which they granted to me. I have taken over this PR in order to bring it to the finish line. Most of the code is still Jeronimo's work, which is itself similar to the mesh and material previewer code, so I have him marked as author.

I made the following changes to this PR:

  • Rebase and fix conflicts.
  • In a few minor ways, make the code more similar to the mesh and material previewers.
  • Introduce a new method to Node3D called set_as_top_level_keep_local, which is like set_as_top_level but simpler, as it excludes the code that preserves the global transform (instead, it preserves the local transform).
  • Implement both points in my comment above.
    • The light directions are now the same as the mesh and material previewers.
    • The lights are now fixed relative to the camera by default, for consistency with the mesh and material previews.
      • However, if you prefer the old behavior for consistency with an orbiting camera in the scene editor, that is also kept. There is now a button in the top-right that will toggle between the rotation modes:
        Screenshot 2024-04-16 at 9 45 31 AM

This new button uses a new icon called "PreviewRotate", which is the same as "ToolRotate" but with an outline and brighter (thank you to @MewPurPur for making this).

PreviewRotate

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with adding the enhancement to add a secondary light. Did not compile the code.

@akien-mga akien-mga merged commit 42e6f9a into godotengine:master Apr 19, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@aaronfranke aaronfranke deleted the add_secondary_light_to_3d_resource_importer branch April 19, 2024 19:16
@akien-mga akien-mga changed the title Added secondary light to 3D Advanced Import Settings Add secondary light to 3D Advanced Import Settings May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a secondary light in the Advanced Import Settings preview
6 participants