Jump to content

Having a custom material on a surface causes an editor crash during 'bake lighting'


photo
Go to solution Solved by sweetluna,

Recommended Posts

We have a single surface which has a custom deferred pass. If the surface is enabled, when the baking process gets to that surface the editor crashes. Disabling the surface before "bake all" fixes the issue.

(Edit: version is 2.17.0.1)

The head of the custom basemat is 

 

BaseMaterial <node=ObjectMeshStatic preview_hidden=0 var_prefix=var texture_prefix=tex>
{
        Group LED {
                Texture albedo = "core/textures/common/white.texture" <anisotropy=false>
                Float percent_good_pixels = 0.5f <min=0.0 max=1.0 widget=slider>
                Float color_boost = 0.0f
                Float luminance_boost = 0.0f
                Int luminance_steps = 1
                Float pixel_size = 1.0f
                Float time

        }

        Pass deferred
        {
                Fragment =
                #{
                        // Include the UUSL fragment shader header
                        #include <core/materials/shaders/api/common.h>

                        STRUCT_FRAG_BEGIN
                                INIT_COLOR(float4)
                        STRUCT_FRAG_END

 

Edited by angus
Link to comment

I've attached the full .basemat file and the surface uses a child material but without any changes to the basemat.

For background data: we varied the number of bounces (1 and 5), samples per frame (10 and auto), near and far clipping. We also ran it with everything visible and then out-of-bounds so that nothing is visible in order to confirm it wasn't a rendering bug. We also kept it foreground-focussed for some runs and minimised for others to see if that was the issue.

 

led_post_new.basemat

Link to comment

Hi angus.

We reproduced the issue.

So far it is hard to say what exactly causes editor to crash. We sent the problem to the developers, let's see what they say. 

For now, you can use the voxel probe just as lightmaps to bake the light as an alternative, if you don't mind. It work all right with your material.

To do that simply add the Voxel Probe light source to the scene and bake it in Bake Lighting window.

Thanks!

Link to comment
  • 1 month later...
  • Solution

Hi Angus,

I've noticed that your material is the cause of the issue. Since you not implemented most of the required functionality your self and the one you implemented couldn't be farther from the truth, I highly recommend reading about Abstract Materials, they heavily reduce required things to implement and fairly easy to use.

I've modified your material a bit, so it correctly works in 2.17 and beyond.
Notice a few changes:
1) In header I parent against Unigine::mesh to use mesh abstract material
2) Added basic vertex layout that is going from vertex to pixel/fragment shader stage
3) All functions now reside in common section
4) And the main function replaced with simple code block that writes into an Albedo

Hope this helps!

led_post_new.basemat

  • Like 1
Link to comment
×
×
  • Create New...