BEER icon indicating copy to clipboard operation
BEER copied to clipboard

Properly sync materials in realtime across MALT and BEER.

Open eballeste opened this issue 3 years ago • 3 comments

I noticed that when I try to use a Malt material that uses global variables that aren't referenced in some type of get method, these variables are dropped in new BEER materials.

#include "Pipelines/NPR_Pipeline.glsl"

uniform vec3 ambient_color = vec3(0.1,0.1,0.1);
uniform vec3 diffuse_color = vec3(1.0,0.1,0.1);
uniform vec3 specular_color = vec3(1.0,1.0,1.0);
uniform float roughness = 0.5;

uniform vec3 line_color = vec3(0.0,0.0,0.0);
uniform float line_width = 1.0;
uniform float line_depth_threshold = 0.5;
uniform float line_normal_threshold = 1.0;

void COMMON_PIXEL_SHADER(Surface S, inout PixelOutput PO)
{
   ...
}

All of these global variables show up as settings to be edited in a Malt material: Screenshot 2021-12-12 210506

But are dropped in BEER Materials when used in a layer: Screenshot 2021-12-12 212219


Unrelated, it would be cool if we had some way to rename the prefix used for the material settings (beergen1, beergen2, beergen#) don't offer much context as to what layer the settings belong to.

Edit: I just noticed that all of these variables show up in alphabetical order in both Malt and BEER so maybe that's why it's prefixed the way it currently is?? if that is the case could a different label be used like beerlayer# or blayer# or even better blayer#__layername, (can layers be given names?) (edit: i think i should be able to edit the name via the UI layer panel but double clicking to rename does nothing)

eballeste avatar Dec 13 '21 02:12 eballeste

The dropped variables only happen when used with other layers.

If I try to use it by itself as a single BEER layer, most of the options will show up but it will ignore the settings of the original Malt material.

This screenshot shows the same material, the left viewed in the BEER UI, the right when viewed in Blender's Materials Property panel.

Screenshot 2021-12-12 215915

eballeste avatar Dec 13 '21 03:12 eballeste

I re-read the Readme file and the screenshot above will show partial correct settings after I click on Update BEER Material. Everything seems to break down after I add a Basic Gradient Mesh material. Steps to recreate:

Add a Basic Line Mesh to a new BEER Material, set it up and click on Update BEER Material. The object will be updated with the new styles but some settings will be ignored (Receive Shadow / Self Shadow):

Screenshot 2021-12-12 222532

Add a new layer and create a new material based on the Basic Gradient Mesh, set it up and click on Update BEER Material, this is when a bunch of variables from the first layer will be dropped and all settings from both layers are ignored.

Screenshot 2021-12-12 222815

eballeste avatar Dec 13 '21 03:12 eballeste

Some properties are improperly loaded (such as gradient maps), and the materials inconsistently synch - next revision should address both points. The malt material editor doesn't feed back to the layers as you've noticed. The next revision will allow you to edit the material properties in realtime from the BEER menu and optionally hide the MALT menu properties for BEER specific materials.

The beergen# prefix is used for variables to prevent any issues parsing, with the # corresponding to the layer. Being able to rename the layer directly and using that as the prefix makes sense - it currently names itself using the attached material.

Thank you very much for raising these issues! It's super helpful to reference. Hopefully these should all be addressed within the week.

atlawrie avatar Dec 14 '21 01:12 atlawrie