Cycles: Add thin film iridescence to Principled BSDF #118477

Merged
Lukas Stockner merged 18 commits from LukasStockner/blender:iridescence into main 2024-05-02 14:28:57 +02:00
1 changed files with 6 additions and 2 deletions
Showing only changes of commit 92ef41d2a0 - Show all commits

View File

@ -261,9 +261,13 @@ static void node_declare(NodeDeclarationBuilder &b)
/* Panel for Thin Film settings. */
PanelDeclarationBuilder &film = b.add_panel("Thin Film").default_closed(true);
film.add_input<decl::Float>("Thin Film Thickness").default_value(0.0).min(0.0f).max(100000.0f);
film.add_input<decl::Float>("Thin Film Thickness")
weizhen marked this conversation as resolved Outdated

Specify the unit (nm).

Specify the unit (nm).

Good point. If we're already handling units, might as well do it properly: I've created #120900 for this, depending on what PR gets merged first I'll just update the other to tag this input correctly.

Good point. If we're already handling units, might as well do it properly: I've created #120900 for this, depending on what PR gets merged first I'll just update the other to tag this input correctly.

Default value for float socket is 0.0f by default, no reason to make this explicit.
Max value also does looks like meaningless (what for such soft max?)

Default value for float socket is `0.0f` by default, no reason to make this explicit. _Max value also does looks like meaningless (what for such soft max?)_

I think it's easier to understand the code with the default value explicit.

For soft max indeed FLT_MAX should generally be used if there is no real upper bound. But this can sometimes cause numerical precision problems, so not sure it works here.

I think it's easier to understand the code with the default value explicit. For soft max indeed `FLT_MAX` should generally be used if there is no real upper bound. But this can sometimes cause numerical precision problems, so not sure it works here.

I mean, at some point such declaration can be cleaned due to the fact this is not really necessary.

I mean, at some point such declaration can be cleaned due to the fact this is not really necessary.
.default_value(0.0)
.min(0.0f)
weizhen marked this conversation as resolved Outdated

I think we could default to the IOR of water, which is 1.33.

I think we could default to the IOR of water, which is 1.33.
.max(100000.0f)
.subtype(PROP_WAVELENGTH);
#define SOCK_THIN_FILM_THICKNESS_ID 28
film.add_input<decl::Float>("Thin Film IOR").default_value(1.3f).min(1.0f).max(1000.0f);
film.add_input<decl::Float>("Thin Film IOR").default_value(1.33f).min(1.0f).max(1000.0f);
#define SOCK_THIN_FILM_IOR_ID 29
}