Skip to content

Add a quad mesh to the material preview in the inspector #10744

@tetrapod00

Description

@tetrapod00

Describe the project you are working on

Writing shaders.

Describe the problem or limitation you are having in your project

There is no good preview mesh to preview VFX, foliage, or billboarding shaders. We are missing a single quad with UVs in the range of 0-1.

The box mesh might be usable to preview such effects in some cases, if it were unwrapped so that each face had 0-1 UVs. As is, it's not really usable for this purpose.
godot windows editor dev x86_64_kBL64QYwtc

Previewing a VFX shader, like this simple radial gradient with alpha, looks terrible on the sphere and box:
godot windows editor dev x86_64_NfUAqOkMdR
godot windows editor dev x86_64_NtbDEwT6Qd

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

Add a quad mesh with 0-1 UVs:
godot windows editor dev x86_64_yEdVdJqJCA

Previewing a VFX shader, like the radial gradient, looks correct with a quad mesh:
godot windows editor dev x86_64_XQyBJSr5ym

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

Duplicate the existing code for a box or sphere, but with a quad mesh instead.

With a quad mesh, there are some extra usability considerations. Unlike the sphere or box mesh, with backface (default) culling, the quad is only visible from some angles. It's possible to rotate the quad such that you cannot see it. I believe this is a valid usecase, as you may be testing double-sided materials. I don't believe that limiting the rotation, or forcing a double sided quad is the correct solution. Instead, whenever you select the quad mesh, the rotation resets so you can see the quad.

If instead we would rather limit the rotation so the quad is always visible, most of the code is already in place to do so.

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

You can preview your materials by creating a scene with a quad mesh instead.

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

The quad is a common, standard shape for previewing shaders, and it fills a gap in the current featureset.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions