-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Improve the material preview in the inspector #99927
base: master
Are you sure you want to change the base?
Conversation
doc/classes/ProjectSettings.xml
Outdated
@@ -2458,6 +2458,12 @@ | |||
<member name="rendering/environment/defaults/default_environment" type="String" setter="" getter="" default=""""> | |||
[Environment] that will be used as a fallback environment in case a scene does not specify its own environment. The default environment is loaded in at scene load time regardless of whether you have set an environment or not. If you do not rely on the fallback environment, you do not need to set this property. | |||
</member> | |||
<member name="rendering/environment/material_preview/environment" type="String" setter="" getter="" default=""""> | |||
[Environment] that will be used in the inspector's material preview. If this is not set, a default environment will be used instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Environment] that will be used in the inspector's material preview. If this is not set, a default environment will be used instead. | |
Path to the [Environment] resource that will be used in the Inspector's material preview. If this is not set, a default environment will be used instead. |
What's "a default environment will be used instead" in this context? I am to assume it's NOT the editor setting with the same name. May be worth being more specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the material preview's own default environment. Not related to the default fallback or setting for the environment of the 3D scenes.
This comment was marked as resolved.
This comment was marked as resolved.
73f1f86
to
34f8b4b
Compare
That's not possible because string path properties only filter by file extensions and resources all have the same extensions (tres, res) or multiple variations.
There isn't much use for zoom in this simple preview with basic shapes. I'm not sure if it's worth interfering with the inspector's scrolling or adding a shortcut that isn't utilized elsewhere.
Previously it reset rotations when changing shapes or materials too. My goal is to keep the preview state while switching so lights should do too. Fixed. |
34f8b4b
to
6407c1d
Compare
When I added the quad mesh (#97030), I intentionally chose a few things:
However, while I did put some thought into these choices, they aren't the only reasonable choices to make, and the tradeoffs might have changed with the addition of an environment. I just wanted to give some context. |
I think these should be left for the user to decide. Automatic resets hinder workflow, I'm always putting the rotating back where it was. Hardcoded restrictions limit usage, for example, you may want to visualize disabled back-face culling which is a material setting but you can't see the back of the quad because rotating was clamped. (Note: cull modes don't update unless the preview is recreated, but it also happens in the 3D view, bug not related to the PR).
That must be the case. Changing shapes did reset it and I did an overhaul on the logic so I probably remember it wrong about materials. Making comparing consistent is also one of the reasons I decided not reseting rotation. |
Yeah, I agree that In that case I would like to see some way to reset the rotation, but I'm not sure what the best UI is. I also don't think that it necessarily has to be implemented in this PR. IMO it's okay to simply remove rotation clamping and rotation resetting, and if there is enough demand to reset the rotation, add it back in the future. But others may disagree. Off the top of my head, possible ways to reset rotation:
|
I like this option since it avoids more buttons. Implemented it. |
22f52b7
to
01df955
Compare
These two make a lot of sense and seem intuitive to me. |
Regarding the default sky colors, I wonder if we should go for a purely grayscale sky by default, like we do in the Advanced Import Settings dialog. That dialog uses a sky which is fully white at its top and fully black at its bottom, but we can use something that resembles the luminance of a real sky more closely too. The reason for using a grayscale sky is to avoid skewing the reflections towards a certain color, which can bias certain materials as looking more blue than they really are. It can also make previews look misleading if your project never uses skies with a blue-ish hue. There are project settings available to use a custom preview environment either way, so if skewing the previews towards a certain color makes sense for your project, you'd still be able to do it. |
sphere_switch->set_pressed_no_signal(true); | ||
box_switch->set_pressed_no_signal(false); | ||
quad_switch->set_pressed_no_signal(false); | ||
cam_zoom = 2.973804; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this zoom value correspond to anything specific? There should be a comment above it, or it should use the value of a named constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It comes from visible_height / sin(vfov)
for precise camera framing.
I refactored the switch logic in the new push.
box_switch->set_pressed_no_signal(true); | ||
sphere_switch->set_pressed_no_signal(false); | ||
quad_switch->set_pressed_no_signal(false); | ||
cam_zoom = 4.35f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
quad_switch->set_pressed_no_signal(true); | ||
sphere_switch->set_pressed_no_signal(false); | ||
box_switch->set_pressed_no_signal(false); | ||
cam_zoom = 2.973804; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
01df955
to
f1d1bd5
Compare
It is a good point for making it like neutral studio lighting. However, I want to note that it's a bad practice to use a non-realistic sky for PBR authoring since we should design expecting hue influences from the environment. Any option is fine. I'm not particular about the defaults as long as they can be configured. |
I want to boost the opinion that it is bad practice to use a non-realistic sky, too. |
f1d1bd5
to
5f74e42
Compare
Agreed, when working on materials I prefer something more representative of an actual lighting scenario rather than an unnatural gray, an outdoors setting is a good default. I think the blue-tint in the preview is definitely neutral and toned down enough, it misrepresenting hues shouldn't really be a concern. Besides that, I think it's a more fun/nicer experience working on materials, and as a bonus makes the editor look a little nicer, if the preview lighting has a little bit of flair instead of being entirely gray. |
5f74e42
to
b734763
Compare
The current preview setup is a clear color with no sky so PBR effects can't be visualized correctly and the material looks very different from what it would look in a scene.
I made the default preview use an
Environment
similar to the default 3D view's environment with a procedural sky. A floor can be toggled to preview reflections too using a reflection probe. The environment and floor material can be configured inrendering/environment/material_preview/..
.