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

Properly sync materials in realtime across MALT and BEER. #6

Open
eballeste opened this issue Dec 13, 2021 · 3 comments
Open

Properly sync materials in realtime across MALT and BEER. #6

eballeste opened this issue Dec 13, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@eballeste
Copy link

eballeste commented Dec 13, 2021

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
Copy link
Author

eballeste commented Dec 13, 2021

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
Copy link
Author

eballeste commented Dec 13, 2021

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

@atlawrie
Copy link
Collaborator

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 atlawrie changed the title BEER materials drop global variables Properly synch materials in realtime across MALT and BEER. Dec 14, 2021
@atlawrie atlawrie self-assigned this Dec 14, 2021
@atlawrie atlawrie added the bug Something isn't working label Dec 14, 2021
@eballeste eballeste changed the title Properly synch materials in realtime across MALT and BEER. Properly sync materials in realtime across MALT and BEER. Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants