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

REQUEST: Make Decal object baking more universal (Decal frame preview) #67

Closed
5 tasks done
KirilStrezikozin opened this issue Feb 4, 2024 · 6 comments
Closed
5 tasks done
Assignees
Labels
enhancement old stuff sucks, new stuff rocks feature upgrade for your old lawnmower solved How could you? GPT helped?

Comments

@KirilStrezikozin
Copy link
Owner

KirilStrezikozin commented Feb 4, 2024

This feature request is:

  • not a duplicate
  • implemented

Is your feature request related to a problem? Please describe.
marcovivirito (Discord) was looking for a way to 'bake from view'. 'Bake from view' is not an official term and means using a render camera to render-bake from a particular view or baking details down onto a flat plane (high-to-lowpoly). The initial issue marcovivirito faced is not connected to this issue, but making BakeMaster's Decal object baking more universal may suit his initial needs.

Describe the solution you'd like to be implemented
Currently, only Decal Pass map is baked using the render-bake approach (read brief explanation above). Even if BM Object is a Decal Object, all other maps are not render-baked, but just simply baked using the object's UVs.
Also, Decal Pass baking enforces object rescaling to fit within 1x1 m box, and the offset value cannot be previewed.
What I'm planning to implement is:

  • A universal 'bake view' for baking Decal objects, meaning the object won't be scaled down or repositioned, the camera used for render-bake will be automatically scaled to fit the object's dimensions.
  • Add a preview ability to Decal Object panel to temporarily create and attach a camera that will be used for the decal object's render-bake. This way the user will be able to preview the render-bake frame and adjust the offset to their liking.
  • If BM object is a Decal object, bake all its maps using render-bake, not just the Decal Pass maps.
@KirilStrezikozin KirilStrezikozin self-assigned this Feb 4, 2024
@KirilStrezikozin KirilStrezikozin added feature upgrade for your old lawnmower enhancement old stuff sucks, new stuff rocks in progress All night I stay not sleeping because I'm thinking about this labels Feb 4, 2024
@KirilStrezikozin KirilStrezikozin added this to the BakeMaster 2.6.0 milestone Feb 4, 2024
@KirilStrezikozin
Copy link
Owner Author

KirilStrezikozin commented Feb 4, 2024

Side TODOs:

  • On Decal Object enable, send a confirmation warning to user that all object's highpolies will be remove (basically, add another operator to modify the state of the decal_is_decal prop).
  • Rearrange Decal panel's UI

@KirilStrezikozin
Copy link
Owner Author

https://github.com/KirilStrezikozin/BakeMaster-Blender-Addon-Dev/commit/a98f6042e791824af74187ab8889595c18cb57a2 - This one is pretty stable and resistant to Blender's events. I made it to cancel whenever invalid data is detected (e.g. when a user deleted the custom camera and did not turn off the frame preview beforehand or removed a BM Object). It does not fail to cancel itself but fails to delete the custom camera when the source object was accidentally deleted or one undo even was fired (2 undo's work though 🥇). I should also replace bm_obj_i reference stored in __decal_view handler with bm_obj_name, which would make the operator cancel when bm objects are moved.

@KirilStrezikozin
Copy link
Owner Author

Looks like the only vulnerability of the Decal View OT is an undo even just after the source object was deleted. The custom camera object is restored, but Decal View OT had already fired a cancel due to deletion of the source object, thus, it's properties got reset.

@KirilStrezikozin
Copy link
Owner Author

Ok, I've found some more:

  1. When the source object is hidden, Decal Object is ghost object is fired to debug.
  2. When user switches active area, ctx.area becomes None

@KirilStrezikozin
Copy link
Owner Author

KirilStrezikozin commented Feb 11, 2024

  • UI: draw margin settings inactive if bm object is decal object

@KirilStrezikozin KirilStrezikozin added migrate: dev->public I'm doing cps now until I manage my repos better. needs testing wow does it even work? and removed needs testing wow does it even work? labels Feb 12, 2024
@KirilStrezikozin
Copy link
Owner Author

KirilStrezikozin commented Feb 12, 2024

Issues while incorporating decal frame preview into bake:

  • There's probably not enough time between modals. The Decal view is not fully prepared while the render bake starts in the same moment. I see an improvement here for BM 3.0, where I could replace bake OT timer events with the regular modal, and wait for functions to finish before ticking other updates. But I have to deal with it right now. This issue is also the cause of the decal view not being positioned above the object properly (cut-outs when rendering). I think I should put decal OTs into a separate file called decal.py and call module functions to prepare the frame preview. Same functions would be called in bake to prepare a frame.
  • Maps like Albedo should turn on the preview for decal objects (since it's render-bake, I see diffuse with lightning and shadows)
  • Maps like Albedo, and Decal (I didn't test others) have no transparent background when configured to be so. (because alpha was unchecked)

@KirilStrezikozin KirilStrezikozin added solved How could you? GPT helped? close on release done here, but let's wait for the release and removed in progress All night I stay not sleeping because I'm thinking about this labels Feb 13, 2024
@KirilStrezikozin KirilStrezikozin changed the title REQUEST: Decal object baking to be more universal REQUEST: Decal object baking to be more universal (Decal frame preview) Feb 13, 2024
@KirilStrezikozin KirilStrezikozin removed the migrate: dev->public I'm doing cps now until I manage my repos better. label Feb 14, 2024
@KirilStrezikozin KirilStrezikozin changed the title REQUEST: Decal object baking to be more universal (Decal frame preview) REQUEST: Make Decal object baking more universal (Decal frame preview) Feb 14, 2024
@KirilStrezikozin KirilStrezikozin removed the close on release done here, but let's wait for the release label Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement old stuff sucks, new stuff rocks feature upgrade for your old lawnmower solved How could you? GPT helped?
Projects
None yet
Development

No branches or pull requests

1 participant