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

BSDFMaterial properties can now be accessed from Lua #74

Merged
merged 4 commits into from
Sep 19, 2022

Conversation

yogwoggf
Copy link
Contributor

@yogwoggf yogwoggf commented Sep 19, 2022

Fixes #59.

PR Type (tick all that are applicable)

  • Bug Fix
  • New Feature (doesn't break Module <-> Lua compatibility)
  • New Feature (breaks Module <-> Lua compatibility)
  • Documentation Update Required

Tested Targets (only applicable for changes to the binary module, delete otherwise)

  • windows-x64-release
  • windows-x86-release

Checklist

  • I have read and understand the contributing guidelines
  • I have tested all aspects of this PR (not required)

Description
If the given argument for the BSDFMaterial setter is nil/no value, then it will instead act as a getter and return the currently set value.

Here's the only odd example with this PR.
linear roughness
Instead of returning the linear roughness that was given to the setter, the getter will instead return the raw roughness. This behavior sounds correct to me, but any comments on this? It may be confusing to users who aren't aware.

If the given argument for the BSDFMaterial setter is nil/no value, then it will instead act as a getter.
Copy link
Owner

@Derpius Derpius left a comment

Choose a reason for hiding this comment

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

In addition to the one review comment, you can use LUA->Top() (possibly GetTop) to check if the number of items on the stack is 0

The roughness function should return the linear value. It's more likely that a user is getting material properties to save/reapply later or to use in their own shading algorithms, than to plug it straight back into GGX

Also you don't need to set each vector field manually, there's a MakeVector function in the utils for this very purpose

source/VisTrace.cpp Outdated Show resolved Hide resolved
@Derpius Derpius added this to the v0.12.0 milestone Sep 19, 2022
@Derpius Derpius added enhancement New feature or request binary module Issues relating to the binary module labels Sep 19, 2022
@Derpius Derpius merged commit 255b1d0 into Derpius:master Sep 19, 2022
@yogwoggf yogwoggf deleted the bsdfmat branch September 19, 2022 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary module Issues relating to the binary module enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Get BSDFMaterial properties in Lua
2 participants