Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(+1)

Cool.  You may not really need a shader, and just setting the global draw color would work.  Basically the RGB values of the draw color would be the same as intensity of the sun light.  If it looks good then no need to do much more, or if you need more control then a shader might be needed.

Layer scripts are the easiest, and you can get the intensity value from the day/night object (make sure it exists or use "with").

(1 edit)

Thanks for this. I've managed to change the alpha of the layers depending on the day light. It works perfectly!

I have another question. Suppose I have lots of frames for character animations. I've been using both material maps and normal maps in addition to the original sprites. I haven't really needed to develop material maps for some sprites (say if there isn't a difference in metal/roughness across the entire sprite). I've also noticed that you can manually change the roughness/metalic of an object. Is there a way to simply redraw the original sprite according to these object values, instead of having to use material maps? In the draw material event, could I clear the pixels in the sprite_index (of the original sprite) to a specific material map color instead of using all these extra sprites?

If I understand what you are asking, you can do full image metal/roughness just by setting those values and not use a material map sprite.  When the material map sprite is assigned to the same sprite_index (i.e., left as default) then the shaders will draw metal/roughness using the current sprite_index and all pixels at the metal/roughness set.

Yes, that is what I intended to ask. For some reason doing this (setting to sprite_index) does not draw the metal/roughness set the same.  I may need to tinker with the specific metal/roughness settings in light of a change away from the original material sprites.

Ah, it wont be the same with sprite_index because it sets the full sprite to the single value only for metal/roughness.  The actual sprite colors would come out really weird as metal/roughness.  It is possible to try and edit shaders and use like grayscale values, but it will still be a bit odd I think.  The material packer that comes with is your best bet at easily making materials for sprites/pixel art, as most workflows for materials are much more in-depth and require full tools for doing so.

so the material map I was using was a single color. But switching to sprite index, and using the set metallic/smoothness functions doesn’t replicate the lighting effects. I think I I just need to adjust the values to recreate the effect. 

Do you have normal maps also assigned?

Yep. 

Since I have multiple sprites that change depending on the player input, everytime the sprite changes, I get the sprite name and add an "_n" then use asset get index to change the normal map to the sprite that is named the same as sprite index with a "_n" after it. I did notice that when I updated the material map in this way (instead of just setting it to sprite index in the variable defs) the result was much closer to the original set up I had with material sprites, but it wasn't exact. I might be able to tweak the metalic/roughness set numbers to get it to where it was.