Skip to content

Add Funky Blending layer support#250

Open
dpogue wants to merge 1 commit into
H-uru:masterfrom
dpogue:funky
Open

Add Funky Blending layer support#250
dpogue wants to merge 1 commit into
H-uru:masterfrom
dpogue:funky

Conversation

@dpogue

@dpogue dpogue commented Apr 29, 2021

Copy link
Copy Markdown
Member

To Do

  • Fix the Python korlib texture generation

@dpogue
dpogue requested a review from Hoikas April 29, 2021 00:40
Comment thread korman/korlib/__init__.py

@Hoikas Hoikas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass through

Comment thread korlib/bumpmap.cpp Outdated
Comment thread korman/exporter/material.py Outdated
Comment thread korman/exporter/material.py Outdated
Comment thread korman/ui/ui_texture.py
Comment thread korman/ui/ui_texture.py Outdated

if layer_props.funky_type != "FunkyDist":
# Mention that values are angles
layout.label("Values should be viewing angles in degrees between 0 and 180.", icon="RESTRICT_VIEW_OFF")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should probably be a separate set of properties that display as angles in the UI. You could have another set of properties as your universal getters. IIRC angle float types in blender return in radians so the export math would be simpler.

Comment thread korman/exporter/material.py Outdated
Comment on lines +257 to +258
funky_ramp = self.export_funky_slot(bo, bm, hsgmat, slot, idx)
if funky_ramp:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh, if we were on Python 3.8 this would be a good place to use the walrus...

Comment thread korman/korlib/__init__.py Outdated
Comment thread korman/korlib/__init__.py Outdated
Comment thread korlib/bumpmap.cpp Outdated
Comment thread korman/korlib/__init__.py

@dpogue dpogue left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've rebased this, and I think I've addressed the remaining feedback

Comment thread korman/korlib/__init__.py
@dpogue
dpogue marked this pull request as ready for review July 12, 2026 00:02

@Hoikas Hoikas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't actually written this down anywhere, but I'm starting to adopt a pattern with if statements in Korman where if there is ever an elif, then there must be an else:. Even if it winds up being:

else:
    pass

just so it's clear what the logic is. Could you go through your @propertys and make sure there is always an else: if there is an elif?

Comment on lines +461 to +462
elif funky_type == "FunkyReflect":
ramp_layer.UVWSrc = plLayerInterface.kUVWReflect

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif funky_type == "FunkyReflect":
ramp_layer.UVWSrc = plLayerInterface.kUVWReflect
elif funky_type == "FunkyReflect":
ramp_layer.UVWSrc = plLayerInterface.kUVWReflect
else:
raise ValueError(funky_type)

Comment on lines +399 to +401
if near_trans > far_trans:
near_trans, far_trans = far_trans, near_trans
near_opaq, far_opaq = far_opaq, near_opaq

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's excepted that far_opaq could be less than near_opaq and not trigger this swap based on the additive calculation?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread korman/korlib/__init__.py
Comment thread korman/ui/ui_texture.py Outdated
Comment on lines +139 to +140
texture, slot = context.texture, getattr(context, "texture_slot", None)
use_stencil = slot.use_stencil if slot is not None else False

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
texture, slot = context.texture, getattr(context, "texture_slot", None)
use_stencil = slot.use_stencil if slot is not None else False
texture = context.texture

You don't seem to be using the texture slot or the stencilling info?

@Hoikas

Hoikas commented Jul 12, 2026

Copy link
Copy Markdown
Member

This is starting to look good. Before I merge, a couple of last questions.

  • The exact appearance of these effects isn't super clear to me or what all the knobs do. Do you have a test blend that shows the feature in action? This will help when I go to write the release notes.
  • It looks like in PlasmaMAX, the funky distances can feed into the span's min and max distances. Any thoughts about whether or not that should be supported immediately, or it we're fine to defer on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants