Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[FREE] 3D Tilemap System - For 3D Pixel Art Games

Discussion in 'Assets and Asset Store' started by DenisLemos, Jul 15, 2019.

  1. SlightField

    SlightField

    Joined:
    Dec 30, 2015
    Posts:
    2
    A couple of issues trying this out. There are a couple of functions in the scripts that reference elements in the editor that are not present when you build for release on android. I needed to add #if UNITY_EDITOR around these functions to get it to compile. Second the shader does not seem to work on Android and presents a blue and black image (see images below). Suggestions? pc.png android.jpg
     

    Attached Files:

  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi!

    I updated the package to version 1.0.1 and fixed the build errors, thank you for notifying me.

    Version 1.0.1 is now available as .unitypackage on the first page as well as the GitHub version. It is recommended for everyone to update.

    Regarding the issue when building for Android, I tested it here and it worked without any error on a Sansung Galaxy J7 Prime. Try again using the version 1.0.1, this may be an error due to previous build errors.
     
  3. GoldenSkullArt

    GoldenSkullArt

    Joined:
    Aug 14, 2013
    Posts:
    49
    I was literally thinking about something like this just a few hours ago and now found this by accident!, I am definitely keen on seeing more progress on this <3
     
  4. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    Wow this is just amazing, thank you for sharing with the community your progress would love to use this.
     
  5. andrewtha

    andrewtha

    Joined:
    Apr 28, 2013
    Posts:
    5
    Is it possible to extend this past the 256 tile limit? I'm using tile palettes that are quite large in 2D, and hoping to use them in 3D.
     
  6. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    You need to open the TilemapSystemInspector.cs and TilePaletteInspector.cs scripts located on the Editor folder to extends the array size options.

    For the TilemapSystemInspector.cs you need to edit the m_tilesetSizeArray and m_tilesetSizeContentArray as follow:
    Code (CSharp):
    1.  
    2. private readonly int[] m_tilesetSizeArray = new[] {16, 24, 32, 48, 64, 96, 128, 256, 512, 1024, 2048};
    3. private readonly GUIContent[] m_tilesetSizeContentArray = new GUIContent[]
    4. {
    5.     new GUIContent("16x16", "The resolution of the 3D Tileset texture."),
    6.     new GUIContent("24x24", "The resolution of the 3D Tileset texture."),
    7.     new GUIContent("32x32", "The resolution of the 3D Tileset texture."),
    8.     new GUIContent("48x48", "The resolution of the 3D Tileset texture."),
    9.     new GUIContent("64x64", "The resolution of the 3D Tileset texture."),
    10.     new GUIContent("96x96", "The resolution of the 3D Tileset texture."),
    11.     new GUIContent("128x128", "The resolution of the 3D Tileset texture."),
    12.     new GUIContent("192x192", "The resolution of each tile."),
    13.     new GUIContent("256x256", "The resolution of each tile."),
    14.     new GUIContent("512x512", "The resolution of each tile."),
    15.     new GUIContent("1024x1024", "The resolution of each tile."),
    16.     new GUIContent("2048x2048", "The resolution of each tile.")
    17. };
    18.  
    For the TilePaletteInspector.cs you need to edit the m_tileSizeArray and m_tileSizeContentArray as follow:
    Code (CSharp):
    1. private readonly int[] m_tileSizeArray = new[] {16, 24, 32, 48, 64, 96, 128, 256, 512, 1024, 2048};
    2. private readonly GUIContent[] m_tileSizeContentArray = new GUIContent[]
    3. {
    4.     new GUIContent("16x16", "Select the proper resolution for your tiles."),
    5.     new GUIContent("24x24", "Select the proper resolution for your tiles."),
    6.     new GUIContent("32x32", "Select the proper resolution for your tiles."),
    7.     new GUIContent("48x48", "Select the proper resolution for your tiles."),
    8.     new GUIContent("64x64", "Select the proper resolution for your tiles."),
    9.     new GUIContent("96x96", "Select the proper resolution for your tiles."),
    10.     new GUIContent("128x128", "Select the proper resolution for your tiles."),
    11.     new GUIContent("192x192", "The resolution of each tile."),
    12.     new GUIContent("256x256", "The resolution of each tile."),
    13.     new GUIContent("512x512", "The resolution of each tile."),
    14.     new GUIContent("1024x1024", "The resolution of each tile."),
    15.     new GUIContent("2048x2048", "The resolution of each tile.")
    16. };
    As you can see, just a few extra sizes have been added, you can add any size you want, but always try to use multiples of 2 and make sure that each item in the arrays is in the same order.

    The tiles are packed in a 3D texture, using high resolution tiles will make the 3D texture take up a lot of disk space and memory, Unity limits the sizes of each texture to 4GB.
     
  7. Shadowblitz16

    Shadowblitz16

    Joined:
    Feb 5, 2016
    Posts:
    75
    @DenisLemos huh I can't seem to drag my 3d tileset to the tilemap layer
    and p and c doesn't do anything.
    upload_2020-10-22_13-7-35.png

    EDIT: nvm I had to click generate tilemap data.

    however now I can't actually paint anything
     
  8. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    For the painting to work your game object must have a mesh collider. In your screenshot you only have an empty Game Object without even a mesh render.

    Play with the example scenes until you learn how the asset works and what it is for, also follow the instructions of use step by step carefully, any wrong step will generate an error later.

    I tried to predict most of the possible errors, and if any of these errors occur, an error message will appear on the Inspector warning you about the error and how to fix it.
     
  9. Deleted User

    Deleted User

    Guest

    The link to the Unity Package is broken. It just says "The requested attachment cannot be found." Why is that?
     
  10. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Try again, I just fixed the link. You can also download it from GitHub or by clicking on the file attached at the end of the post.
     
  11. Deleted User

    Deleted User

    Guest

    OK! I downloaded it from GitHub though. Also, how do I make the size of each tile smaller? If I do a 32x32 tileset size and anything above 64 for the map size, it won't let my paint any tiles and it says "ArrayIndexOutOfBoundsException" on the status bar. Also, I can't add any neighboring terrain when this is enabled either.
     
  12. JoannaBlindFlugs

    JoannaBlindFlugs

    Joined:
    Feb 3, 2021
    Posts:
    1
    Hi!

    This tool is amazing! It seems to be exactly what I need.

    I have however few issues. It might be my fault as I'm pretty new in Unity and I might be doing something wrong.
    I'm trying to use different Palletes for different layers. The Pallet of the first Layer works fine. The tool does something wild with the second Pallet. The preview in Panting Mode looks ok but when I choose any of the tiles there it turns out to be a different one (form the other pallet). The correct tiles are hidden somewhere under the apparently not used, empty tiles. It looks like all the tiles from both pallets are combine and shifted.
    I'm attaching a screenshot where you can see the second layer and the pallet preview of the wrong palette used for creating it.
     

    Attached Files:

  13. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I'm sorry, I really don't know what may be causing this issue, currently the tilemap generation process is a bit complicated and any error during this process can cause strange failures in the operation of the asset.

    The warning message on the console says that it has inconsistent results in generating the "Big.asset", I don't know what that means, but it may be the cause of the issue.

    I haven't worked on this asset in a while and it is a little out of date, I have a lot of cool ideas to improve and implement in the future, but first I need to finish other tools that I'm currently working on. Until then I don't recommend using this asset for serious projects.
     
  14. Thane_5

    Thane_5

    Joined:
    Sep 22, 2020
    Posts:
    4
    Hey, i just found this tool and it really is something i needed for my current project.
    Just two questions:
    - How can i change the world-scale of my tiles on the terrain? Currently a terrain-quad is filled by 4x4 tiles, and i want that to only be one.
    - Sometimes i simply can't paint, luckily this usually resolves itself eventually after i do random things (regenerate data, select other brush tools and tiles) Interestingly, when i generate my Tilemap data, i always get three warnings similar to this: "generated inconsistent result for asset" Could this be related?

    Lastly i have a feature request: Wouldn't it be cool if you could rotate tiles in the painting process? that way you only needed one fourth of the textures, and you wouldnt have to worry about finding one with the orientation that you need.
     
  15. gustmsalmeron

    gustmsalmeron

    Joined:
    Mar 2, 2021
    Posts:
    9
    This is by far one of the best assets I've downloaded so far! Only issue I'm having is the shader on URP, it does not receive shadows and is looking bright. Also, I'm having some errors while trying to paint
    (GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.)
    IndexOutOfRangeException: Index was outside the bounds of the array.
    UnityEngine.TilemapSystem3D.TilemapSystem3D.PaintTile (System.Int32 x, System.Int32 y, System.Int32 index, System.Int32 layer) (at Assets/3D Tilemap System/Scripts/TilemapSystem3D.cs:216)

    It's a shame Unity didn't approve this asset, it looks very promising!
     
  16. Dev-4U

    Dev-4U

    Joined:
    Nov 2, 2021
    Posts:
    23
    Wow, what a hidden gem! Thanks for making this!

    A few comments after having read the entire thread:
    1. Getting rejected ONCE doesn't mean you can't ever publish it. Just submit it again, provide a link to this thread, and if they reject it again ask for specifics on how to improve it. I haven't tried it myself yet but from the looks of it I can't see how it's too simple and below standards. The reason could simply be that things broke or seemed broken for the reviewer and maybe he didn't like the (admittedly ugly) tiles. Just get one of the many free tile packs that look nice and you're set on the visual quality side of things. ;)
    2. Please by all means add a proper LICENSE! Seriously, this is important. Anyone running a business, and that includes everyone who publicly sells their games or creates work for others as freelancer is at risk when using unlicensed software like this. Hence, many just stay away from unlicensed software no matter how tempting. Your statement regarding ethics is vague to begin with, and from a legal point of view "ethics" does not exists. Just give it a proper License like MIT, Apache, (L)GPL, Creative Commons or whatever and put that LICENSE file up on the github repo. That's just two or three clicks on github!
    Please, please #2 and seriously try #1 again! :)
     
  17. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi Everyone!

    I'm sorry for not giving any news for a long time, don't think this asset is dead, it is alive, and I have good plans for it in the future. The development is current paused because I'm working on Surface Painter, actually I'm working on nothing right now because I have lost my old computer while reforming my house. Tip: Cover your electronics when you decide to work with cement inside your home, the dust just kill my computer!:(

    I'm making a new setup based on AMD and I have opted for the Ryzen 5600g with onboard graphics, that should be enough until I can get a dedicated GPU, the hardware prices right now are prohibitive.

    I want to add PBR support to this asset, current for the legacy RP it uses a modified diffuse shader and for the universal RP it uses just an unlit shader. There are a lot of things that can be improved, and I think it can take advantage of Unity tiles system to store the tilemap data instead of using my own complicated approach.

    For the Surface Painter, I want to add a feature to paint the tilesets, this way we can take advantage of the PBR painting already there to create the PBR tilesets. It is hard to create just one tileset, imagine if you need to create the same tileset for the albedo, normal, metallic, roughness and emission, with Surface Painter it will be possible to paint them all at once.

    I have all my work saved in backups, so I haven't lost any of them, and I think I will be back to the work in January. I managed to make practically all the regular painting tools to work with performance similar and some even superior to what we see in hardware like Paint.Net and Photoshop. Now I want to reformulate the editor UI to make it cleaner, fast, easy to use and smarter.

    I decide to keep 3D Tilemap System free and also decide to not release it in the Asset Store any more even with the future improvements because I also want to release it if possible to Godot, I think it can work as a good "ads" for showing Surface Painter capabilities, and as any other indie game dev I also like free stuffs. ;)

    @deprecatedperson
    Regarding the license, don't worry about that, but just in case, consider as if you have purchased it from the Asset Store, you can edit and improve it to use in your games/projects without any problems, you just can't sell it as another competing asset, that's what I mean by fair use. To be honest, I don't understand much about licenses, but it's likely that in the future it will be like Godot's license, but for now consider it as if you've purchased the asset from the Unity Asset Store. In the first posts I also talked about the logic behind the scenes, so if I cared too much about licensing, I wouldn't have even explained to everybody how to do it yourself. On my side I won't bother anyone for using this asset, but I understand your point, and it makes sense, there are a lot of scammers out there.
     
  18. Mlanky

    Mlanky

    Joined:
    Oct 7, 2021
    Posts:
    2
    Hi, I'm attempting to generate a Tile Palette from an image but am running into issues.

    I've made it the same dimensions as the "Layer 0" image but I'm not having any luck when I hit the "Converting the Atlas to Tiles". I thought it maybe it might have something to do with the NPOT setting but I haven't found a way to correctly import images as NPOT. I just edit the .meta file for the texture after its imported to use NPOTScale = 0 (or something like that). Is there a step I'm missing? Thanks for the neat asset!
     
  19. Mlanky

    Mlanky

    Joined:
    Oct 7, 2021
    Posts:
    2
    As usual, I'm doing it wrong. Found the NPOT stuff in in hind sight the obvious place (on the texture > Advanced Non-power of 2)...

     

    Attached Files:

  20. Quorry

    Quorry

    Joined:
    Mar 2, 2019
    Posts:
    1
    I converted the shader to a lit URP shader graph.
     

    Attached Files:

    DenisLemos likes this.
  21. DingJiaXiong

    DingJiaXiong

    Joined:
    Jan 15, 2021
    Posts:
    1
    Hi writer, this is an amazing asset that I'm currently using, but I'm having a few problems.
    1. I want to paint the terrain map at runtime, so I need to dynamically generate 3DTexture at runtime and configure it, which may be a bit of work, I wonder if you will continue to update this plugin.
    2. The 255Bit value corresponding to the 47 post map is a little too much configuration, I want to use the corner Tile type similar to War3's 16 map. This requires adding new auto-generated Tile bars to your source code.
    Of course, there are still some questions, I hope the author can reply me ~~~
    ps: I am a developer from China, English may not be very good, this is the Internet translation, hope you can understand ~~~
     
  22. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi, the asset is current a bit abandoned, but it is not dead. I still want to improve it a lot, but my very old PC just dead last year and I have lost/delayed so many months of work until I was able to get a new PC to work. So, the development of the 3D Tilemap System was placed in second/third priority.

    I don't recommend anyone to use the current version of the asset as it is at the date of this post, because there are a lot of bugs and the process to create the 3D Tileset Texture and configure the component for painting is very complex, I think it can be very simpler than it is.

    Currently, I recommend you to try to implement your own solution based on the explanation from the post number #2.

    1) I think there is no need to regenerate the 3DTexture at runtime, because it is only used to stores the tiles in each its texture slices. For runtime painting, you just need to paint/change/edit the 2DTilemap texture that is responsible by “saying” to the render system what tile should be rendered on that pixel position.

    2) Actually, there is the auto-tile feature for the 47-tiles and 16-tiles layout templates.
     
  23. henners999

    henners999

    Joined:
    May 30, 2020
    Posts:
    70
    Fantastic, I've been searching a week for a tool like this. Seems there are a lot of people in the same boat but don't know about this fabulous tool. Nice!

    2 questions, is there a way to get it to line up to the grid in Unity?

    Any ideas to draw tiles in lines or other features like that?
     
    Last edited: Mar 17, 2023
  24. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Thank you for your kind words!

    You mean the terrain grid system for painting over multiple Unity terrains at the same time? It is current not supported.

    If you want to align the tiles with the 3D scene grid, I think you should configure the terrain and the tilemap size to match one meter per tile. Example, if your terrain size is 32x32m and your tilemap resolution is 32x32px, each tile will be rendered on the terrain occupying one meter in the world space. But if the tilemap resolution is 16x16px, each tile will be rendered on the terrain occupying 2 meters because the tilemap textured is stretched over the terrain and when you apply a 16x16px texture over a surface with 32x32 meters, each pixel of this texture will embrace 2 meters in the world space. So this is something you should take into account before you start painting the tilemap, and first test if the tile size in the world space is good or not.


    Instead of painting one pixel into the tilemap per click, the implementation can be changed to paint a line of pixels in the same way it is done in the image editors out there, so it can be a line, a rectangle, a circle or any shape you want. The fill tool already implemented is just a flood fill algorithm used in image editors.

    I'm taking note of all yours ideas and recommendations to try to implement it in the future version of the asset that I want to develop from scratch. But before starting working on it, I want to release my paint tool I'm current working on called “Surface Painter”. This software will target the 3D PBR painting for pixel art style, it means that it will also be possible to create PBR tilesets using it, just image how amazing it should be to see the 3D Tilemap System using PBR tilesets, but creating the PBR tilesets now using Blender or any image editor is a pain, with “Surface Painter” it will be very simple.

    Another reason that I want to first release the Surface Painter before start to work in the new version of the 3D Tilemap System is that I want to take advantage of all the knowledge of the GPU painting I have acquired so far. So instead of doing pixel operations in the CPU, we can paint a lot of tiles at the same time using the GPU without compromising the performance uploading the Texture2D changes to GPU every time we paint a tile.

    PS: I assume it was you who sent a donation to my PayPal account, thank you very much!!!
     
  25. henners999

    henners999

    Joined:
    May 30, 2020
    Posts:
    70
    If Surface Painter and 3d Tilemap System hooked in too, that would be cool. I'd definitely be interested. I mainly use tilemaps for ease of use and creativity. I was using Gamemaker before but moved to unity because of 3d capability. Have been looking for ages for a tool like yours and finally found it, so good. Other thing would be useful would be to rotate tiles so you wouldn't have to double up on creating them if that's possible.

    Paypal, what me? ;D - just a small token for the hours you must have spent, I know how it can be ;)

    Sorry for edits, working it all out...

    1 issue:
    Sometimes my tiles are rotated so when painting it on a map, for each tile the top is the bottom and vica versa...

    Just a few ideas for the future if you're interested, would love these:
    Tile rotations
    Line drawing tool
    Copy and paste tiles with mouse drawn selection box
    Menu with layers and tiles within easy reach to flick between them
    A grid overlay so you can see where the tile grids are
     
    Last edited: Mar 18, 2023
  26. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I came from Game Maker too, but starting using Unity since its version 2.6. I spent all this time trying to find a way to paint tiles on 3D meshes in a similar way as it's done in 2D games, until one day I had an insight and started working on it. My dream is to have a game engine like Game Maker, but with 3D games in mind.

    Regarding rotating tiles, it should not be possible due to technical issues. In 2D it is more simple, each tile is drawn on the screen one by one using a draw function that just copy a region of the tileset and draws it in the screen. As it is drawn one tile by one, each tile can be painted with different characteristics like scale, rotation and even be animated.

    In 3D (at last in my implementation), the tiles are painted all at the same draw call instruction of the Texture3D sampler, so if you apply rotation, it will rotate the entire texture coordinate and not only one tile by one. The same goes for animated tiles, as all the tiles are painted in the same draw call, the way to animate the tiles is by editing the tilemap texture at runtime using SetPixel() and upload the tilemap texture to GPU again after update all the animated tiles in the tilemap texture. I think that animated tiles still can be implemented, but it may cost some performance.

    I also think that maybe there is a way to invert the tiles horizontally and vertically. I need to do some tests, but if it is possible, it can at last save a considerable number of repetitive tiles.


    Humm... I presume you are using it with a custom 3D mesh instead of a terrain one, if so, this issue can happen. The problem should be in the UV mapping, you need to fix it in Blender or in the software you used to make the UV mapping just by rotation the tile UV that is wrong.
     
  27. henners999

    henners999

    Joined:
    May 30, 2020
    Posts:
    70
    Thanks for the replies. It all makes sense, I have no idea how to create such software so don’t know what’s possible and what isn’t!

    I’m pretty sure I used a Unity plane in my last example but I’ll double check.
    On that note, is it possible to use pro builder objects with this software?


    Ps is there a way that you know of to detect which tile layer is underneath the player?
     
    Last edited: Mar 20, 2023
  28. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    In the second post, there is a brief explanation of how it works. I need to write a more detailed article and create simple examples, so that anyone can create their own system with custom features according to their needs, as well as implementing it in other game engines.


    Note that the tiles are not painted according to camera angle view, it is always relative to the upper position of the tilemap texture sampled in the mesh. If you orbit the camera around the map and paint the tile, it may seems that the tile was painted rotated, but it was not. Or maybe there is a bug, it was developed using an older Unity version and I have not tested it since then.

    You can use it with any mesh, but the uv-mapping should be fixed in an external 3D modeler application, respecting the rules mentioned in the post number #3. The default Pro Builder uv-mapping is done taking into account a regular mesh, for the 3D Tilemap System to work with custom mesh, the uv-mapping should be done in an especial way where each tile should be mapped to an exclusive pixel on the tilemap texture.


    You can get the player position relative to the map, access the tilemap texture using GetPixel() to get the pixel value and do some math to find the layer, but by default this information is not available.
    Just checked another feature to the roadmap list!!!;)
     
  29. henners999

    henners999

    Joined:
    May 30, 2020
    Posts:
    70
    Thanks for getting back and sorry for bugging you with questions. Would be good to be able to create my own version but I'm not all that great with getting my hands dirty programming so far so would probably take ages to develop but I'd be interested to give it a try.

    One last comment, as mentioned in a previous post with regards to your painting package, PBR tile textures would be amazing feature to have. I've got SpriteIlluminator all ready to go ;)
     
    DenisLemos likes this.
  30. henners999

    henners999

    Joined:
    May 30, 2020
    Posts:
    70
    Does the tilemap texture use material settings such as smoothness or metallic?

    I only ask because the textures in the tilemap layer look different to those I drew in Aseprite. Below is a cube with the same texture mapped to a material with metallic and smoothness set to 0. The background is the tilemap layer:
    Screenshot 2023-03-27 at 11.10.44.png
     
  31. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Yes, it is using a modified version of the built-in Legacy Diffuse shader, so it is affect by the Unity's lights, ambient color and can receive and cast shadows, then it will be different from the image editor. But it is only the diffuse texture, there is no metallic, smoothness, specular, etc…

    If you want the colors to be the same as the image editor, try to change the “Render Pipeline” option to “Universal” in the “3D Tilemap System” component, this will change the render shader to an unlit shader. This means that there will be no light, no shadows, no reflection, etc…

    The downside of this system is that each shader should be modified to support the tile system. So to render it with all the render features you want, you should choose the right one to be modified. Current, there is only the Diffuse shader for the Legacy RP and the Unlit shader for the Universal RP.
     
  32. henners999

    henners999

    Joined:
    May 30, 2020
    Posts:
    70
    Great, thanks!
     
  33. PipkoFanfare

    PipkoFanfare

    Joined:
    Apr 12, 2022
    Posts:
    2
    Hi, this tool looks like exactly what I've been looking for but I'm having some problems using it. I'm running Unity 2021.3 LTS, in a 3D URP project. The biggest problem is that when it loads the tileset data into the tile palette the brightness is cranked way up and I can't figure out why. I also ran into the problem of the default URP shader making the terrain invisible, but swapping in the Universal Shader for the TerrainLit one posted by Quorry solves this issue. Is it possible to correct the brightness issue and if so how? Thank you for your time.
     
  34. doodaddy

    doodaddy

    Joined:
    May 2, 2015
    Posts:
    10
    Just found this myself. A different question for @DenisLemos or whomever. This discussion mentions lots of indie artists working on "3d pixel art" games. I know of lots of 2d pixel art games in everything from Mac Plus (black/white) graphics to 8/16/32-bit 2d. But does anyone have examples of 3d pixel art? It is a retro Nintendo Cube thing or something?

    I ask because I was considering mixing and matching 2d and 3d and didn't know it was a thing.

    BTW, this is an amazing tool and worthy of a PhD IMO! It took me a while to wrap my head around what it was doing and why. Thanks!
     
  35. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi,

    When we say 3D pixel art games, we are talking about the texture style! Instead of texturing the 3D model in a photorealistic style, we try to follow the most as we can the pixel art rules.

    It is not new, there are many PS1 games that tried this before due to the hardware limitations of that time.
    Here is an example that we can clearly see some models texturized as pixel art style mixed with other models that just uses low resolution textures.


    These days, we have the PBR technology that can increase the render quality of the “pixel art 3D games” to another level. This one is an excellent example of the use of PBR render and pixel art style.


    I also noticed an increase of RPG games that mix 3D and 2D. The world and props are 3D, but the characters are pure sprites moving around the 3D Space. This one is a good example:


    Here is a 3D Pixel Art asset creation in Blender, but the dev just used a pre-made pixel art texture. The 3D Painter software I'm working on will also support texturing pixel art assets like this one, but painting directly over the model, support PBR and following the asset creating pipeline standards for game development.


    Some other examples:

    Artists on Twitter:
    There are a lot more games and artists to show, these were what a could find right now in a fast search!
     
  36. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    120
    You might be interested in my UPixelator addon which lets you make 3d pixel art games.

    A new module for edge highlights is also coming up, here's the latest showcase:

     
  37. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Very nice asset, especially the Edge Highlight effect!

    I'm trying to implement the highlight and concave effect in my 3D Painter, but with no success until now because I need it to be rendered in the game object model. It is required to be rendered directly in the 3D model to be able to bake it to the model texture later, and using a screen post-processing effect it is not possible.

    I will try your asset in the future, at last the edge highlight can be used for visualization purposes. So the user can preview how the asset will look in the game engine, without the need to save the painting and open it in the game engine just to check.
     
    Radivarig likes this.
  38. doodaddy

    doodaddy

    Joined:
    May 2, 2015
    Posts:
    10
    Impressive list! The only one I'd seen is The Last Night! Thanks! Sorry I didn't see your response sooner!
     
  39. Pun_Mister

    Pun_Mister

    Joined:
    Jun 5, 2023
    Posts:
    14
    Hi! Loving the asset so far, but I noticed that when applying a texture it seems to dull the color in URP. Do you know how I'd be able to fix this?

    Here's a screenshot of the same texture applied to a cube with a regular unlit URP shader vs the wall using the tilemap system

    I image.png
     
  40. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    Hi!

    It seems a color space issue, maybe one of the shaders are not rendering to the correct color space.
    As I can see, the tilemap system shader seems to be rendering in linear color space and the UPR unlit shader seems to be rendering in gamma color space.

    Try to edit the tilemap shader you are using and add a gamma color correction to the output color just one line before the return call.

    This applies a conversion to gamma color space:
    Code (CSharp):
    1. outputColor = pow(outputColor, 2.2f);
    2. return outputColor;
    And this one applies a conversion to linear color space:
    Code (CSharp):
    1. outputColor = pow(outputColor, 0.4545f);
    2. return outputColor;
     
    Pun_Mister likes this.
  41. Pun_Mister

    Pun_Mister

    Joined:
    Jun 5, 2023
    Posts:
    14
    Perfect!! thank you
     
  42. Pun_Mister

    Pun_Mister

    Joined:
    Jun 5, 2023
    Posts:
    14
    It seems like the shader is only rendering in one eye when I enter playmode. Do you know why that may be?
     
  43. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    I think the shader is not compatible with single-pass instanced/stereo rendering.

    So it requires editing the custom shaders following the instruction from Unity documentation:
    https://docs.unity3d.com/Manual/SinglePassInstancing.html

    I have not touched on it because I don't have a VR device for testing.
     
  44. Pun_Mister

    Pun_Mister

    Joined:
    Jun 5, 2023
    Posts:
    14
    Thank you for your response. I finally got it to work with single-pass instanced with some hlsl help and it functions in VR now

    Here's the VR functional shader if anyone in the future needs it ^^

    Code (CSharp):
    1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
    2.  
    3. // Unlit shader. Simplest possible colored shader.
    4. // - no lighting
    5. // - no lightmap support
    6. // - no texture
    7.  
    8. Shader "3D Tilemap System/Legacy Unlit"
    9. {
    10.     Properties
    11.     {
    12.         _TilemapTexture ("Tilemap Texture3D", 3D) = "black" {}
    13.         _TilesetTexture ("Tileset Texture3D", 3D) = "black" {}
    14.         _LayerArrayTexture ("Layer Array Texture1D", 2D) = "black" {}
    15.     }
    16.  
    17.     SubShader
    18.     {
    19.         Tags { "RenderType"="Opaque" }
    20.         LOD 100
    21.      
    22.         Pass
    23.         {
    24.             CGPROGRAM
    25.             #include "UnityCG.cginc"
    26.             #pragma vertex vert
    27.             #pragma fragment frag
    28.             #pragma target 2.0
    29.          
    30.             uniform sampler2D _LayerArrayTexture;
    31.             uniform sampler3D _TilemapTexture;
    32.             uniform sampler3D _TilesetTexture;
    33.             uniform int2      _GridMapSize;
    34.             uniform int       _LayersCount;
    35.             uniform int       _TilesCount;
    36.          
    37.             struct appdata_t
    38.             {
    39.                 float4 vertex   : POSITION;
    40.                 float2 texcoord : TEXCOORD0;
    41.                 UNITY_VERTEX_INPUT_INSTANCE_ID //Insert
    42. };
    43.          
    44.             struct v2f
    45.             {
    46.                 float4 vertex     : SV_POSITION;
    47.                 float2 tilemap_uv : TEXCOORD0;
    48.                 float2 tileset_uv : TEXCOORD1;
    49.                 UNITY_VERTEX_OUTPUT_STEREO //Insert
    50. };
    51.          
    52.                 v2f vert(appdata_t v)
    53. {
    54.                 v2f o;
    55.                 UNITY_SETUP_INSTANCE_ID(v);
    56.                 UNITY_INITIALIZE_OUTPUT(v2f, o);
    57.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    58.                 o.vertex = UnityObjectToClipPos(v.vertex);
    59.                 o.tilemap_uv = v.texcoord.xy;
    60.                 o.tileset_uv = v.texcoord.xy * _GridMapSize.xy;
    61.                 return o;
    62. }
    63.          
    64.             fixed4 frag (v2f IN) : COLOR
    65.             {
    66.                 float2 layerData = float2(0, 0);
    67.                 float  tilemap = 0;
    68.                 fixed4 tileset = fixed4(0, 0, 0, 0);
    69.                 fixed4 outputColor = tex3D(_TilesetTexture, float3(IN.tileset_uv, 0));
    70.                 float  index = 0;
    71.                 float previousLayerCount = 0;
    72.              
    73.                 for (int i = 0; i < _LayersCount; i++)
    74.                 {
    75.                     // Get layer data
    76.                     // layerData.x = The number of tiles in that layer
    77.                     // layerData.y = The alhpa intensity of that layer
    78.                     layerData = tex2D(_LayerArrayTexture, float2(1.0 / (_LayersCount - 1.0) * i, 0)).rg;
    79.  
    80.                     // Get the tilemap data
    81.                     // Each pixel value of the 3d tilemap texture stores the slice number that the 3d tileset texture should render
    82.                     tilemap = tex3D(_TilemapTexture, float3(IN.tilemap_uv, 1.0 / (_LayersCount - 1) * i)).r * 255;
    83.                  
    84.                     // Compute the right slice index for current layer
    85.                     index = tilemap + previousLayerCount * 255;
    86.                     previousLayerCount += layerData.x;
    87.                  
    88.                     tileset = tex3D(_TilesetTexture, float3(IN.tileset_uv, 1.0 / (_TilesCount - 1) * index));
    89.                     outputColor = lerp(outputColor, tileset, layerData.y * tileset.a);
    90.                 }
    91.                 outputColor = pow(outputColor, 2.2f);
    92.                 return outputColor;
    93.             }
    94.          
    95.             ENDCG
    96.         }
    97.     }
    98. }
     
    DenisLemos likes this.
  45. Pun_Mister

    Pun_Mister

    Joined:
    Jun 5, 2023
    Posts:
    14
    Hi again! Sorry I just have another question regarding the performance of transparent layers which I don't think was explained in your older posts.

    I noticed that you can change the transparency of layers, but is it implemented in a way that wont have a detrimental affect on performance (i.e not using "real" transparency)?
    And to add to that will using a texture with semi-transparent tiles (as in half the tile is fully opaque and half is fully transparent) also work performantly/at all? I'm just seeing if it's a better idea to either manually paint shadows on a duplicate tile or just have a shadow layer that can be applied to everything with layer transparency

    thanks ^^
     

    Attached Files:

  46. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    781
    No extra performance is required for the transparent tiles. As you can see in the shader code above, the tag is defined as opaque, it means that the tilemap will be rendered as any other opaque material. The layer transparency is just a very simple 'lerp' operation that mix the top layer with the previous layer in the 'for loop'.
    outputColor = lerp(outputColor, tileset, layerData.y * tileset.a);

    The for loop just render one layer on the top of other using the alpha of the top tile multiplied by the layer transparency (layerData.y) as the lerp blend factor. So the tilemap will render as opaque, and the transparency is just, let's say, 'a fake alpha', in other words, the final render is just a flat color built from the layer's data.

    What can increase the performance a bit is the number of layers, as it will increase the for loop count. But it will not matter if you use few layers or if you will still render the shadow in another material anyway, in this case I think it will be better for performance if you are able to put the shadows in the tilemap using multiple layers because it will be rendered all at once in the same render pass.
     
    Pun_Mister likes this.
  47. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    120
    @DenisLemos instead of global opacity for the whole tile would it be possible to modify the code to use a splatmap approach where tile strength is painted and blend is done based on a heightmap? If albedo/normal/height was implemented for pbr, and maybe some grouping of tiles into a "material" so the same strength applies per group?

    Or the other way around, modifying an existing splatmapping tool like MicroSplat to split the textures into 9 parts, then when painting choose which edge or center to paint/autopaint, edge variation could be done with having a second material that has fitting chunks with the first etc. This would be amazing to combine with regular splats on a terrain or with mesh workflow module.

    Also I know it was mentioned already but I think that the answer from the assetstore was from some pathetic noob that should've got fired and you should submit this again even though it's opensource as that helps with funding, marketing and discovery. There's nothing like this existing on the store and the interest exists.