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

Display a checkerboard pattern on the fallback 3D material #6138

Open
Calinou opened this issue Jan 21, 2023 · 9 comments
Open

Display a checkerboard pattern on the fallback 3D material #6138

Calinou opened this issue Jan 21, 2023 · 9 comments

Comments

@Calinou
Copy link
Member

Calinou commented Jan 21, 2023

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

While Godot 4 has made a lot of progress on the default appearance of 3D scenes, there's still room for improvement.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Display a checkerboard pattern on the fallback 3D material. This has two benefits over a plain untextured surface:

  • It looks better, and gives a better first impression of the engine's visuals.
    • As a bonus, the checkerboard pattern helps make color banding and shadow dithering patterns less noticeable (closer to how it'd be in most finished projects).
  • It has better usability, as the checkerboard gives you a sense of scale. This is useful when prototyping levels using CSG nodes, as you no longer need to apply a material on every top-level CSG node to have this checkerboard pattern.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This shader is based on @CptPotato's procedural checker shader. Since it performs triplanar mapping in local (object) space, it does not require meshes to have UV. It also doesn't use a texture, but renders the checkerboard procedurally. The checkerboard's lines are always sharp but antialiased.

The checkerboard's average albedo and roughness levels are tuned to match the previous untextured material, with parts of the material being brighter and other parts being darker.

Screenshots have SDFGI and glow enabled.

On the 3rd test case, some of the cubes have default StandardMaterial3D/ORMMaterial3D/ShaderMaterials attached as a comparison. These are expected to be brighter and rougher than the fallback material.

Daytime

Current fallback material With checkerboard material
Screenshot_20230121_014105 webp Screenshot_20230121_014057 webp
Screenshot_20230121_014158 webp Screenshot_20230121_014152 webp
Screenshot_20230121_014223 webp Screenshot_20230121_014215 webp

Nighttime

Current fallback material With checkerboard material
Screenshot_20230121_013636 webp Screenshot_20230121_013603 webp
Screenshot_20230121_013813 webp Screenshot_20230121_013804 webp
Screenshot_20230121_013926 webp Screenshot_20230121_013918 webp

Regarding performance, this shader makes the 2nd test scene 0.05 mspf slower to render in 4K on a GeForce RTX 4090 (measured with SDFGI and glow disabled). Slower GPUs will be more impacted at similar resolutions, but it may also be argued that the performance of the fallback material should be representative of final materials you'd typically use in a finished project. There may be ways to optimize the shader too – I haven't looked extensively.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

This is about improving the out-of-the-box user experience.

@Calinou Calinou changed the title Use a checkeboard pattern on the fallback 3D material Use a checkerboard pattern on the fallback 3D material Jan 21, 2023
@Calinou Calinou changed the title Use a checkerboard pattern on the fallback 3D material Display a checkerboard pattern on the fallback 3D material Jan 21, 2023
@Lielay9
Copy link

Lielay9 commented Jan 22, 2023

Such a missed opportunity :shakes head: 😔

image

@yosoyfreeman
Copy link

I personally think that the current material is better suited for prototyping and and looks more cohesive and less noisy.

Also, a checkerboard only helps with scale and prototyping if it have the proper subdivisions (With the proposed one it would only be helpful modelling in a grid of 25 cm), in practise a developer could be using 3x3 pieces that would need a corresponding meters and subdivisions. This could be adjustable, but i think is over complicated.

@CptPotato
Copy link

I personally think that the current material is better suited for prototyping and and looks more cohesive and less noisy.

Also, a checkerboard only helps with scale and prototyping if it have the proper subdivisions (With the proposed one it would only be helpful modelling in a grid of 25 cm), in practise a developer could be using 3x3 pieces that would need a corresponding meters and subdivisions. This could be adjustable, but i think is over complicated.

It's not for me to decide, but in my opinion the main benefit such a material provides is giving important visual cues to judge the depth and shape of the geometry. Especially on large surfaces that are common in rough blockouts it's otherwise hard or impossible to tell how close you actually are to the surface.

Whether or not the grid actually lines up with the objects themselves is secondary I think, but I do get the point.

@Calinou
Copy link
Member Author

Calinou commented Feb 2, 2023

After discussing this with reduz, we decided to go with a different implementation instead:

  • Keep the current fallback material as-is.
  • Add a CheckerboardMaterial resource you can apply to any node that accepts a Material resource. The default values of that resource would look similar to the one currently in the PR. This would also allow you to adjust the colors, roughness/metallic and offset/scale on a per-material basis.

It may also be worth having a project setting to override the fallback material, in case you want the checkerboard (or any other texture) to be applied everywhere.

@yosoyfreeman
Copy link

yosoyfreeman commented Feb 2, 2023

Super nice solution.

Anyway, i think changing the current super white color to something more gray and reflective would achieve a similar result of improving first impressions and would still be a good solution.

@Calinou
Copy link
Member Author

Calinou commented Feb 2, 2023

Anyway, i think changing the current super white color to something more gray and reflective would achieve a similar result of improving first impressions and would still be a good solution.

The fallback material's albedo and roughness were already tweaked in 4.0 to be less bright and slightly more reflective. There is a PR that further tweaks it, but it won't be merged for 4.0: godotengine/godot#62756

@yosoyfreeman
Copy link

You are always two steps ahead haha

Thank you for your work Calinou!

@Zireael07
Copy link

Closed PR is godotengine/godot#71774, no new PR yet

@Calinou
Copy link
Member Author

Calinou commented Jul 19, 2023

It may also be worth having a project setting to override the fallback material, in case you want the checkerboard (or any other texture) to be applied everywhere.

I made a branch adding such a project setting: /~https://github.com/Calinou/godot/tree/add-3d-fallback-material-shader-override

It overrides the shader and not the material though, as I couldn't figure out how to override the material. This would be preferable as it's much more flexible.

Testing project: test_custom_default_material.zip

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

Successfully merging a pull request may close this issue.

5 participants