ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > CopperCube Open discussion
forum topic indicator 2D resolution tip
person icon
VP
Guest
Quote
2023-11-23 09:57:42

Probably something that's obvious but I only just noticed it...

If you've got 2D animations, you can reduce the image resolution to just 128x128pixels and selected "For Plants" in the transparent material options. Coppercube then does some magic and renders the images in a way that is comparable to a much higher resolution. The obvious advantage is that you're saving 4+ times as much memory than higher resolution 2D animations and a huge saving in file size.

I first noticed it with the ninja, he looks super smooth "With Plants" enabled. I just experimented with the dog animation and they look better at 128x128 pixels (with "For Plants" enabled), than they do at 1024x1024 pixels. You can see a difference when you zoom in (see screenshot), but at a normal camera distance, the image looks perfect.

Dog=128x128px (30kb filesize)
embedded external image
🔎︎


person icon
just_in_case
Moderator
Quote
2023-11-23 10:50:43

yeah, you need to use order-independent rendering, I personally don't like the visuals the Plant materials give, but yeah, if you have noticed the platformer demo that comes with the 2D controller pack then you will notice that the background has "Plant material " applied to it, and whenever you don't want something to come in front of your player, you should use the "plant material", otherwise they will just mess with the transparent objects rendering order and at some point or another your player will be rendered in wrong order,
Like I played the ninja when I was trying your game, went behind the ladder when I played the game yesterday, I was about to tell you to use plant materials there. I mean I already have videos on my YouTube in which I talked about these things but yeah there are so many videos for 2D games by me so it's hard to go through which is which.

In my opinion and at least for me "Plants material" visually breaks the sprites but it can be adjusted with the "Param1" property in irrlicht. It uses 0.5 by default while a value of 0.7 I found is much better.

person icon
veganpete
Registered User
Quote
2023-11-23 11:47:24

Thank Just_In_Case Yeah, I wasn't too sure how to fix render order properly. Transparency seems to screw it up a bit - and all my layers have transparency. I have "For Plants" set for the dogs and player to prevent them from going behind ladders and I've set foreground to +1.z, characters to 0.z and background to -1.z but it's still not perfect. Also planes and billboards seem to render differently, even with the same settings.

I'll be able to fix this eventually - I'll get rid of all the billboards and planes and just merge them into a single foreground and a single background image. The characters will be sandwiched in-between the 2 layers. I think that will fix/simplify any render-order issues.

I get what you mean about "For Plants" destroying some visuals- the tree, for example, looks way better without it, but the dogs and ninja look really clean and crisp with it - and very pixelated without it. I guess it's a case of trial and error.

person icon
just_in_case
Moderator
Quote
2023-11-23 14:54:23

You probably need to add the plant materials to the BG element and can leave the objects in front as it is.I mean the player as it is.

What I can suggest is to create a layering system, based on your current development environment.

I prefer to work in a Z-forward environment. (left viewport)

So I create layers on my X-axis.

you can start creating layers like this

0 = background.layer1 (sky)
0.1 = background layer 2 (mountains)
0.2 = background layer 3 (clouds)

if you want to create a parallax background, then you can increase the distance between each layer.

Then I create vegetation layers.

0.5 = background far away trees
0.6 = bushes and herbs
0.7 = trees closer
0.8 = buildings
0.9 = Stuff we want to render in front of buildings can be additonal tress or other stuff

1.0 = NPC AI
1.1 = player, I always prefer to render player at top of other things.

then once you are done with all the background stuff and layers and player layer as well, then sometime there are moments where you want to render some stuff in fron of player and other stuff as well, when you want to show somehting else. Maybe you want to make your player hide in some stuff and all or just want to render some more trees.

Then you can always create more layers in front of the player as well.

I suggest you turn off Texture Filtering[ for all of your textures. Especially when you are using pixel-perfect art.



Always try to create a plane mesh with tile count 1 and with a width and length of 1. Then scale it to the same resolution as your texture. Most of the sprites and assets you get from pixel art stuff use a 16x16 or 32x32 tile size.

This way you can maintain a perfect ratio or scale through the whole game. and once you are done with everything including level designing and all, you can always Freeze scale and normalize normal so that they become of size (1,1,1) and you won't get any issues when using custom behaviors which uses the scale parameter of an object.


As soon as you create the planemesh turn it's Collision off. This will save you from a lot of headaches if you do so.


To render things perfectly without Z-fighting issues, change the background layers to "plant materials", there is also a setting for Z-buffer but I don't think it works correctly. So plant materials is the only choice, or you can use also use custom shaders, if you don't plan to use dynamic light in your game, and I suppose that in 2D games you don't really needs dynamic lighting, So I will probably create a shader that will not mess the rendering or visuals of the node but we will still be able to render things order independently, I am not sure though if it will work but it should work,

To quickly do the stuff, always create one plane mesh with all the settings that you want, we will call it tile instead of plane mesh when dealing with 2D so that it will be easy stuff to grasp things.

Just apply all the stuff to one tile, for example, if you want a special tile that will make the player slide or walk slower, then attach all the logic to that tile and then clone it multiple times for your use cases, I have seen people not cloning and doing repetitive task again and again.


Don't use the Collide when moved behavior for your player, I am going to create a new collision system for the 2D games, Collide when moved behavior is not ideal for 2D games, it will mess up a lot of things. You can use it for now, but in the future when I release my collision system, it will be better to avoid using it.

There are other stuff as well when working with 2D games, but I am just lazy to write them all down in a single post and it's hard to remember them all at once. I tried to post stuff related to the creation of Planemesh.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |