Moo-Ack-Productions / MCprep

Blender python addon to increase workflow for creating minecraft renders and animations
https://theduckcow.com/MCprep
GNU General Public License v3.0
278 stars 26 forks source link

Quick Enchantment Shader Addition #404

Open Sirocco745 opened 1 year ago

Sirocco745 commented 1 year ago

Check against existing requests

Describe the context

This is not so much a problem, but more of a general Quality of Life feature I'd like to see. A simple button which applies the enchanted effect to anything would be great.

How do you imagine your feature works?

There are a few ways to do this, but from what I know, my suggestion would be to make it so when the button is pressed, a shader with the enchanted effect is applied to said object. If you do decide to take this path, attached is the item enchantment glint file from the game. enchanted_item_glint

What existing workaround (or closest thing to a workaround) do you have today (within Blender, MCprep, or any software)? If there is no workaround, explain why you feel this way.

There are a couple ways one could manually create an enchantment shader, but with an addon like MCprep, who's sole purpose is swift and easy Minecraft-style setups for animating and rendering, I think it would be a much-appreciated feature by the community.

Edit 1: I have completed the setup for the enchantment shader. It is based off the shaders used by Black Plasma Studios, but has the default Minecraft enchantment texturing to it. The repeating effect of the enchantment is done through linear extrapolation of the UV mapping shader's location value, with the values for the base keyframings listed: X: Keyframe 0, value = 0 m. Keyframe 49, value = 0.1 m Y: Keyframe 0, value = 0 m. Keyframe 49, value = -0.2 m Z: Keyframe 0, value = 0 m. Keyframe 49, value = -0.2 m image

As for the method, it may need some revision. As zNightlord pointed out in the comments, individual .blend files would take up a lot of space and potentially create errors. Plus, from what I understand of StandingPad's contribution, overlaying a material over a node setup is quite difficult.

StandingPadAnimations commented 1 year ago

Interesting idea, but a couple of questions:

Sirocco745 commented 1 year ago

Good points. For the former, I'd suggest a button in the "Item Spawner" section of the addon. As for the latter, I understand the difficulties in coding this kind of thing.

After some fiddling around with MCprep, shading, and taking notes from other setups that involve enchanted weaponry (specifically the Black Plasma Studios Songs of War Asset pack), I would recommend that a separate .blend file be created for each enchanted item, and to save space/time, that only the items that you would normally see enchantments on (swords, pickaxes, etc.) would get this treatment.

As for implementation of this as a feature, please note that I do not know much about Python, but I understand the concepts behind how one might approach this task. The best way I can explain my theoretical implementation of this feature is an example: say a user opens the "Item Spawner" tab and selects "iron sword", but does not spawn it. They would click the "Advanced" drop down menu, and inside of it would be a button that says something like "Place Enchanted Variant". When the user clicks on this button, it would read what item the user has selected (in this case, an iron sword), find the enchanted iron sword .blend file in the addon, and place that instead of generating the iron sword how it would normally.

As I have mentioned, I don't know much about Python, The reason I suggest this method is because to my limited knowledge, it shouldn't be too hard for the addon to read the selected option and then import the correct .blend file. The implementation of the "Spawn [mob name] with [skin name].png" under the "Skin Swapper" menu was what gave me this specific idea.

Please get back to me on how difficult this would be to actually do or with any improvements to my suggested system. If needed, I can also provide a working node setup for the enchanted animation to reduce time on your part, instead of you guys having to work it out yourself. As previously mentioned, I have been experimenting with shading, and have almost completed a working template for this shader.

zNightlord commented 1 year ago

...I would recommend that a separate .blend file be created for each enchanted item, and to save space/time...

It's somewhat a good idea and a bad idea. It is my exprience with already compressed asset and that guy use Geometry nodes dynamically store MC item as texture.

Sirocco745 commented 1 year ago

...and that guy use Geometry nodes dynamically store MC item as texture.

What do you mean by this? The grammar confused me

zNightlord commented 1 year ago

https://user-images.githubusercontent.com/61040487/226515985-8975c9bc-a1c7-42b7-bcb5-32d7ecb0da91.mp4

That is the info on that dynamic extruded item thing. Unfortunately it is not really fit with MCprep multi version support. Because storing geometry in a blend file is heavy and imagine having hundreds of item variation? And the updater download would likely cause "corrupted" blend file. What you need is a single enchanted material setup nodegroup for prep material reference. So don't need to store like thousand of items in a blend file.

Sirocco745 commented 1 year ago

I appreciate the explanation, thanks. The method you're suggesting makes much more sense.

Sirocco745 commented 1 year ago

Quick update, I have completed the setup for the enchantment shader. It is based off the shaders used by Black Plasma Studios, but has the default Minecraft enchantment texturing to it. The repeating effect of the enchantment is done through linear extrapolation of the UV mapping shader's location value, with the values for the base keyframings listed: X: Keyframe 0, value = 0 m. Keyframe 49, value = 0.1 m Y: Keyframe 0, value = 0 m. Keyframe 49, value = -0.2 m Z: Keyframe 0, value = 0 m. Keyframe 49, value = -0.2 m

image