-
Notifications
You must be signed in to change notification settings - Fork 48
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
"Secondary Textures" - Normal Map Support #18
Comments
I second that, can't figure this out either. For now create a material and set the shader to Sprite-lit-default. You can drag the normal map in there. |
I tried to use the SpriteEditor from Unity to be able to set borders, make changes to the spritesheet and so on but Unity is hiding this editor in their own code which makes this much harder... I will see what I can do. |
I'm working on it right now. I was able to support the sprite editor... there is some work to do that all of it's features work with the importer |
Hi, im basically doing the same thing for PyxelEdit. Did you ever figure this out? |
yes there is an implementation in the sprite-editor branch. It has still some issues but you can use the sprite package from unity and include the classes you need in your package. I didn't had the time to completely implement it but you should be able to do it. There is a DataProvider for the SecondaryTexture. |
Oh awesome, yes I made it work. Was sufficient to simply use the TextureGenerator and provide the right stuff including the secondary textures. Works really well in tilemaps now! Thx for pointing me in the right direction! |
@johanolofsson Do you have any code snippets you could share where you use TextureGenerator? Documentation on this is difficult and I have yet to get it working. I'm trying to find a way to have unity-aseprite-importer detect a metadata layer, like |
Yes, this sure isn't easy to setup right out of the box! :)
What you need to do is to use
UnityEditor.Experimental.AssetImporters.TextureGenerator.GenerateTexture()
and provide it a TextureGenerationSettings object. This settings object has
a member called secondarySpriteTextures in which you can set your
additional textures.
Hope this puts you in the right direction!
Good luck!
/JO
…On Mon, Oct 12, 2020 at 12:00 AM Sean Ballew ***@***.***> wrote:
@johanolofsson <https://github.com/johanolofsson> Do you have any code
snippets you could share where you use TextureGenerator? Documentation on
this is difficult and I have yet to get it working.
I'm trying to find a way to have unity-aseprite-importer detect a metadata
layer, like @Normal or @Emission, and then set it as a secondary texture.
No luck yet. @martinhodler <https://github.com/martinhodler> Do you have
any thoughts on how to approach it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCA46JLU6OUJXKZNXLTHILSKIMHZANCNFSM4JTHT5UA>
.
|
Oh sorry Martin, my have replied to u instead of a guy asking a question :)
On Mon, Oct 12, 2020 at 12:30 AM Johan Olofsson <johan.olofsson@bitbound.se>
wrote:
… Yes, this sure isn't easy to setup right out of the box! :)
What you need to do is to use
UnityEditor.Experimental.AssetImporters.TextureGenerator.GenerateTexture()
and provide it a TextureGenerationSettings object. This settings object has
a member called secondarySpriteTextures in which you can set your
additional textures.
Hope this puts you in the right direction!
Good luck!
/JO
On Mon, Oct 12, 2020 at 12:00 AM Sean Ballew ***@***.***>
wrote:
> @johanolofsson <https://github.com/johanolofsson> Do you have any code
> snippets you could share where you use TextureGenerator? Documentation on
> this is difficult and I have yet to get it working.
>
> I'm trying to find a way to have unity-aseprite-importer detect a
> metadata layer, like @Normal or @Emission, and then set it as a
> secondary texture. No luck yet. @martinhodler
> <https://github.com/martinhodler> Do you have any thoughts on how to
> approach it?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#18 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABCA46JLU6OUJXKZNXLTHILSKIMHZANCNFSM4JTHT5UA>
> .
>
|
@johanolofsson Thanks, conceptually it makes sense, but I'm not sure how to actually use |
I got it working. I have a fork of unity-aseprite-importer here: https://github.com/sballew/unity-aseprite-importer/blob/master/Editor/AseFileImporter.cs#L104 I have a number of fixes in my fork, including support for secondary textures. I'll look at doing a PR, however I did do a Unity 2020.2 upgrade on the fork. The approach I took lets the user specify a layer like I also added some layer name shortcuts for common secondary texture names. Right now it's |
After upgrading 2020 your fork worked like a charm, exactly what I was looking for. |
Has anyone tried this in 2020.2? It works fine for me in 2020.1.x but in 2020.2 it stops working. |
Ok, so the problem seems to be that as of 2020.2 the rendering of sprites will ignore pixels which have alpha=0 in the main texture, regardless of what colors the same pixel has in secondary textures. In my case I had emissive pixels with colors but transparent in main. I fixed it by simply putting a=1 in the main texture where there is emissive. Not a perfect solution but it works. I don't really know why this behavior suddenly appears. Maybe it's some kind of optimization in the URP and if it is in some way configurable. If someone figures it out, pls let me know :) |
Hello @sballew ! |
The importer has improved quite a lot. Access to the sprite editor at least now makes it possible to use the importer and access extra layers. I'd still love to see support for special layer names that are written to secondary sprite layers. Something similar to how |
I made a fork with secondary texture support for my own personal use. I don't plan to provide support for it but here it is if anyone wants it. Currently working on Unity 2022.1.23f1: Any layer name that begins with @ (except for @Transform which is reserved) will be imported as a secondary texture (with the @ removed). I haven't added support for Tilesets or Bundled sprite because I don't need them, but it shouldn't be too difficult to see the changes I made to GeneratedSpriteImporter.cs and make similar changes to GeneratedTileImporter.cs and BundledSpriteImporter.cs. |
I'm playing with the upcoming unified render pipeline 2D lights and find I'm back to having to export from aseprite manually. I need to add the normal map to the "Secondary Textures" using the sprite editor and I don't see a way to access this while using the importer.
The text was updated successfully, but these errors were encountered: