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

Add premade Lamp Flare. #182

Merged
merged 1 commit into from
Jul 7, 2020
Merged

Add premade Lamp Flare. #182

merged 1 commit into from
Jul 7, 2020

Conversation

Deledrius
Copy link
Member

This adds a new item to the Add...Plasma... menu which provides a pre-configured lamp flare.

It creates a set of objects for an optimal, general-purpose glow around most lamps:

  • An empty with a Swivel modifier at the chosen location (usually the lamp).
  • A plane parented to the empty for the flare texture, with an Opacity Fade modifier which uses the plane's center for Line-of-Sight.

@Deledrius Deledrius added this to the v0.10 milestone Mar 25, 2020
@Deledrius
Copy link
Member Author

Deledrius commented Mar 25, 2020

As noted in the WIP comment, still missing is the necessary Plasma Layer options, which would need to be set on a texture. I'm submitting this as a draft PR to solicit suggestions on how best to accomplish this. Should we pregenerate a default material and texture (and reuse it for subsequent flares), setting the flags needed such as No Z-Write?

Without this, flares will appear incorrect by default.

Copy link
Member

@Hoikas Hoikas left a comment

Choose a reason for hiding this comment

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

The decal code takes an image input from the user and generates a new material and layer at export time. I think the same workflow would work well here even though it is model-time, not export-time.

Also, I didn't see this, but is the flare parented to the lamp? That might be a useful feature to have so it's easy to move the whole rigamaroll after making it.

korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/ui/ui_menus.py Outdated Show resolved Hide resolved
@Deledrius
Copy link
Member Author

Deledrius commented Jun 20, 2020

There isn't an obvious way to do that for a Mesh Operator, though. Should I have it autogen a Material and select it, with a material selection box in the operator? That allows us to set up the plLayer settings, but it'll still need an image assigned to the texture slot.

The ideal workflow is as follows: artist places the 3D cursor on their lamp mesh, presses Shift-A to Add->Plasma->Lamp Flare, and is given the current operator with an option to name it and the distance from the lamp to the flare so they can adjust it in real time before committing. It's parented, so if the size of the mesh changes or adjustments are needed, they can move the flare mesh on the Y-axis without breaking anything.

What's missing is the material. An operator can't easily require a field, so if it's possible to leave either an image or material selection blank, the flare will be in an unusable state that isn't easily resolved without a walkthrough (which defeats the entire purpose of these). There's nothing "special" being created here, just pre-assembling a bunch of existing parts and modifiers using the settings we know need to be set behind-the-scenes. This leads me to think we should auto-generate on first-use a flare material with the appropriate settings. Unless we provide an image texture, this will still need to be set in some way. On subsequent uses, we can auto-select the last material matching the pre-gen name, or allow creation of a new one (for a different image/color tint flare). I'm not sure that there's any way to flag to the user that a flare is missing its image and guide them to rectifying this.

This is the sort of thing that would be much easier to solve if Blender had some notion of modal operations.

@Deledrius
Copy link
Member Author

Deledrius commented Jun 20, 2020

I've added code to automatically generate a working material and image texture. As with other guides, it requires some minor post-creation intervention, but in this case that only involves assigning an image to the texture slot. Once done, all flares before and after will benefit.

@dpogue: This currently sets the "No Z-Write" skip_depth_write flag. Are there any others that are needed? They look correct to me in-engine.

korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/operators/op_mesh.py Outdated Show resolved Hide resolved
korman/operators/op_mesh.py Outdated Show resolved Hide resolved
@Deledrius Deledrius marked this pull request as ready for review July 5, 2020 09:02
@Deledrius Deledrius requested a review from Hoikas July 5, 2020 09:02
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.

None yet

3 participants