godotengine / godot-demo-projects

Demonstration and Template Projects
https://godotengine.org
MIT License
5.92k stars 1.65k forks source link

Add a 3D procedural materials demo #919

Closed Calinou closed 1 year ago

Calinou commented 1 year ago

This demo includes procedurally generated materials with 3 different techniques:

Preview

procedural_materials webp

mhilbrunner commented 1 year ago

Really cool demo! On Windows 10, it hangs a bit for me on load when starting the run in editor in Godot 4.0.2. It also outputs this:

ERROR: Viewport Texture must be set to use it.
   at: (scene/main/viewport.cpp:116)
ERROR: Viewport Texture must be set to use it.
   at: (scene/main/viewport.cpp:111)
ERROR: Node not found: "Testers/ShaderPlasma/SubViewport" (relative to "WorldEnvironment").
   at: (scene/main/node.cpp:1364)
ERROR: ViewportTexture: Path to node is invalid.
   at: (scene/main/viewport.cpp:76)
ERROR: Viewport Texture must be set to use it.
   at: (scene/main/viewport.cpp:116)
ERROR: Viewport Texture must be set to use it.
   at: (scene/main/viewport.cpp:111)

Then it works correctly. On exit, it spams more errors, not sure these are important though?

Console output on exit ``` ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ERROR: Condition "!material" is true. Returning: true at: material_casts_shadows (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2824) ERROR: Condition "!material" is true. Returning: false at: material_is_animated (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2811) ERROR: Condition "!material" is true. at: material_get_instance_shader_parameters (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2837) ERROR: Condition "!material" is true. at: material_update_dependency (servers/rendering/renderer_rd/storage_rd/material_storage.cpp:2849) ```
Calinou commented 1 year ago

There should be a loading screen appearing on Linux at least, not sure why it doesn't appear on Windows. Can you try changing loading.gd to make it appear for a few more frames?

InfiniteProductions commented 1 year ago

I have some warnings:

[Ignore]Line 15 (INTEGER_DIVISION):Integer division, decimal part will be discarded. [Ignore] Line 20 (INTEGER_DIVISION):Integer division, decimal part will be discarded. [Ignore]Line 20 (INTEGER_DIVISION):Integer division, decimal part will be discarded. [Ignore]Line 22 (INTEGER_DIVISION):Integer division, decimal part will be discarded. [Ignore]Line 22 (INTEGER_DIVISION):Integer division, decimal part will be discarded.

and errors too:

E 0:00:06:0563 loading.gd:13 @ _ready(): Viewport Texture must be set to use it. <C++ Source> scene/main/viewport.cpp:116 @ get_height()

loading.gd:13 @ _ready() E 0:00:06:0565 loading.gd:13 @ _ready(): Viewport Texture must be set to use it. scene/main/viewport.cpp:106 @ get_width() loading.gd:13 @ _ready()

and pretty much the same flow of "errors" on exit in console.

I have the loading screen displayed for a few seconds (~ 5-10s).

Godot v4.1.dev2.official [668cf3c66], Windows 7 64b, GeForce 780M GTX

Calinou commented 1 year ago

and errors too:

You can ignore those errors; they're a well-known engine issue.

jtnicholl commented 1 year ago

pixel_art.tres is 2.37 MB, looks like there's an image embedded in it.

Calinou commented 1 year ago

pixel_art.tres is 2.37 MB, looks like there's an image embedded in it.

Good catch, fixed :slightly_smiling_face:

This should allow the scene to load a bit faster.

jtnicholl commented 1 year ago

Good catch, fixed slightly_smiling_face

It's only down to 1.21 MB now, the normal texture is still there.

Calinou commented 1 year ago

It's only down to 1.21 MB now, the normal texture is still there.

Fixed.