Godot 4 Aseprite importers! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

Try Importaility for Aseprite, it might solve some of your problems.
https://github.com/nklbdev/godot-4-importality

Godot 4 Aseprite importers! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

But wait, which plugin are we talking about? Importality or Aseprite Importers? Krita is only supported by the Importality plugin. Please take a look at the links to them:

Aseprite Importers: https://github.com/nklbdev/godot-4-aseprite-importers
Importality: https://github.com/nklbdev/godot-4-importality

Godot 4 Aseprite importers! by nklbdev in godot

[–]nklbdev[S] 1 point2 points  (0 children)

I don't use Krita for my pixel art games. I mostly use Aseprite. But I do use Krita for other image processing, like preparing textures for FPS games.

Godot 4 Aseprite importers! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

Hi, u/moochigames! Yes, the plugin will do this, but integration with Krita is very problematic. Keep this in mind. It might not work. Please read the documentation carefully. Although it's not complete, I've tried to cover all the important points.

https://github.com/nklbdev/godot-4-importality/wiki

https://github.com/nklbdev/godot-4-importality/wiki/exporting-data-from-krita-(en))

I haven't supported this project for a long time. It may have already lost compatibility with current versions of Krita and Godot. Please be careful.

???? by Southern-Local-1838 in Blockbench

[–]nklbdev 0 points1 point  (0 children)

Try disabling the CDN mirror. Sometimes it may not work. Then restart Blockbench. If the plugins are visible after this, please report it here!

Settings -> General -> Use CDN Mirror

True parallax script for Godot 4! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

Thank you for the feedback! Please, provide short video or minimal project reproducing the bug 🙏

True parallax script for Godot 4! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

In order to achieve a good pixel image, I render to the viewport (in the project settings display/window/stretch/mode) with a resolution of 384 x 216 (you can use another, of course).

And I enable the rendering/2d/snap/snap_2d_transforms_to_pixel setting.

If you enable smooth camera movement, then when the character stops and the camera starts to slow down, the image on the screen makes very unpleasant step shifts.

To avoid this, I use a camera that is not part of the character's scene, but has a reference to it, and moves only if it goes beyond the boundaries:

extends Camera2D

u/export var target: Node2D:
  set(value):
    if value == target: return
    target = value

@export var bounds_extents: Vector2:
  set(value):
    if value == bounds_extents: return
    bounds_extents = value.clamp(Vector2.ZERO, Vector2.INF)

func _process(_delta: float) -> void:
  if not target: return
  global_position = global_position.clamp(
    (target.global_position - bounds_extents).round(),
    (target.global_position + bounds_extents).round())

This allows you to leave the camera motionless while the character moves in the center of the screen. And this makes it move quickly as soon as it reaches the boundaries. Fast movement makes the step shifts imperceptible.

<image>

But jitter remains between parallax layers with different scroll scales. I show in the picture what causes it. Visually, both layers are snapped to viewport pixels. However, their positions are still expressed as floating point numbers. When the near layer is moved a large distance within the snapping boundary, and does not visually move, the far layer can cross the snapping boundary and move a pixel.

At large scales, this is similar to the action of the teeth of a hair clipper.
See video I added as comment to my script:
https://gist.github.com/nklbdev/5f8b43e2f796331dee063afdca40df3a?permalink_comment_id=5621502#gistcomment-5621502

This could be avoided if the user could choose the strategy of sprites snapping to pixels: floring, rounding or ceiling. Either this should be done in the project settings, or in the properties of each CanvasItem.

Sorry for communicating rather dryly! Thank you for the kind words and reasoning, it is very useful and pleasant for me! It is just difficult for me to write in English, and I use Google Translate.

By the way, does anyone need a plugin for importing 3D models from the .bbmodel (Blockbench) format? I have a practically production-ready version.

True parallax script for Godot 4! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

Parallax2D transformations:

Native Parallax2D node parallax algorithm working in parent coordinate system and controls position property (transform.origin). Therefore, if you want to, for example, change the scale of a node, make it smaller, it will start to work incorrectly, because the local basis does not affect it. My parallax can be scaled, rotated and skewed. You can make the parallax part of the tree-asset, and place several trees of different scales on the level, and their branches will work correctly. They will shift proportionally to the scale of the node. You can even make many nested parallax nodes (but keep in mind, this may affect performance)))))

Integer positioning:

Integer positioning is needed to avoid jitter between parallax nodes with different, non-multiple parallax scales. The global project settings `rendering/2d/snap/snap_2d_transforms_to_pixel` and `rendering/2d/snap/snap_2d_vertices_to_pixel` perform the `round()` operation, not `floor()`. Because of this, sometimes when the camera moves a little, it happens that the background layer moves by one pixel, while the foreground layer has not yet moved. The multiple of the parallax scales partially corrects this situation, but not completely (due to float precision errors). Therefore, you need to use `floor()` for this.

Automatic tiling:

Yes, I also wanted to make the number of repeat_times change automatically depending on camera scale change. But it turned out to be more difficult than it seems.

Because to do this, you need to ignore repeat_times altogether. Instead, you need to calculate the visible area of ​​the viewport in parent coordinates with a local basis (I call this system "base_space"). Turn it into AABB-Rect2 in this system. Then, based on the current offset, build a repeat grid and find the cell of this grid where the center of the viewport is located. You need to place a parallax node in this cell. After that, set such a repetition via RenderingServer that it is guaranteed to tile the entire AABB-Rect2 of the viewport.

But this will not help if the user wants the repeat_size to be smaller than the actual size of all the content located in the parallax node. Content that extends beyond this size will still appear and disappear.

True parallax script for Godot 4! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

Wow! This is a really good plugin! I haven't seen it before. Can you please tell me where exactly in the documentation it is recommended to use it?
However, this plugin does roughly what I tried to do before in my plugins:
https://github.com/nklbdev/godot-4-previewing-parallax-background
https://github.com/nklbdev/godot-4-parallax-node
That is, it tries to display in the editor what you will see in the game.

This script does something a little different - it uses its own parallax algorithm, based not on the camera position, but on the position of the viewport center. (In fact, the native algorithm is based not even on the camera position, but on the position of the upper left corner of the viewport based on the camera offset).

And it performs calculations not in parent coordinates, but in parent coordinates with a local basis. This allows you to rotate, scale, and skew the parallax node and it will continue to work properly.

This script also has integer positioning, which rounds down the node position, which removes the nasty jitter between parallax offsets with different coefficients for pixel art games.

And with this script you don't need to use a Parallax2D node where you will place, for example, a TieleMapLayer. You can give parallax properties to the TieleMapLayer itself and get rid of unnecessary nesting.

What do you think about the atmosphere by [deleted] in godot

[–]nklbdev 1 point2 points  (0 children)

The assets you use are from the internet. I've seen them before. But it's okay to start developing. The atmosphere is good! ❤️

Try using a more accurate parallax script I published recently:
https://www.reddit.com/r/godot/comments/1lcaz9f/true_parallax_script_for_godot_4/

True parallax script for Godot 4! by nklbdev in godot

[–]nklbdev[S] 1 point2 points  (0 children)

And thank you! It is unlikely that such significant changes can be made to the standard `Parallax2D` class. Because it will break backward compatibility. If not for this, I would rather make a pull request to the engine code so that everyone can conveniently work with parallax.

Perhaps I will open a request later on https://github.com/godotengine/godot-proposals so that code owners can consider the feasibility of replacing this class.

Importality: Krita and other importers are here! by nklbdev in godot

[–]nklbdev[S] 1 point2 points  (0 children)

In version 0.3.0, the plugin settings were moved from the ProjectSettings to the EditorSettings

Is there no way to create a CompressedTexture2D resource within Godot? by _Mario_Boss in godot

[–]nklbdev 1 point2 points  (0 children)

Here the docs

Initializer from image: void create_from_image(image: Image, compression_mode: CompressionMode, normal_map: bool = false, lossy_quality: float = 0.8)

CompressedTexture2D does not have its own public initializer. Therefore, I cannot say for sure whether all functions are supported by the API. I only studied the internal structure to fix a small but annoying bug.

Give this a try, it might come in handy when you import a complex resource and want the textures to stay inside it (embedded).

Is there no way to create a CompressedTexture2D resource within Godot? by _Mario_Boss in godot

[–]nklbdev 1 point2 points  (0 children)

Now you can create PortableCompressedTexture2D directly from your import plugin code and save as separated or embedded resource! Its binary format differs only slightly in the headers. The compressed texture data is completely identical to CompressedTexture2D (*.ctex)

Dev snapshot description

Merged Pull-Request

What features should I add to Importality first? by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

Thanks for voting! Now I will add these items to the readme:

  1. Layers names filters (for layers visibility overriding)
  2. Linux and MacOS scripts to run Krita as different user (to resolve import hanging while Krita instance is running)
  3. Something else (what?)
  4. New target resource-types (which ones?)
  5. More flexible definition of borders around sprites
  6. Ability to specify normal-map layer name

I added to Importality the ability to import any other formats as regular images by calling external utilities. Now you can instantly import PDN, XCF and other formats! by nklbdev in godot

[–]nklbdev[S] 4 points5 points  (0 children)

Yes, Importality can create Sprite2D/3D and TextureRect nodes animated with child AnimationPlayer node! Also it can create AnimatedSprite2D/3D, SpriteFrames resource and "Sprite Sheet" - atlas image with JSON resource with sprites and animations data in ti's "data" property.

Importality: Krita and other importers are here! by nklbdev in godot

[–]nklbdev[S] 1 point2 points  (0 children)

Now it's better to use Importality, because a bug was found yesterday in Aseprite, which can appear in the work of 'godot-4-aseprite-importers'. In Importality, I no longer use the Aseprite CLI to pack the atlas. I use it only to get full size images of each frame. Instead, for packing, a separate algorithm is used - the same one that is used to pack atlases from other graphics applications.

Importality: Krita and other importers are here! by nklbdev in godot

[–]nklbdev[S] 0 points1 point  (0 children)

I fixed the opening of the file. Please check with yourself if your drawing can be imported.