Unlit Shader is Semi Transparent, Render order?

Your feedback is very important to us. We are listening.

Unlit Shader is Semi Transparent, Render order?

Postby pixelpup » Sun Oct 14, 2018 5:29 pm

Greetings Amplify team,
Loving the product so far. I am hoping to maybe get some clarification about something I am seeing. I was trying to create a shader to emulate the look of an LED wall where as you move around the wall would give a moire effect. I was able to get this to work with a transparent circle tiled across the texture. As I continued to play around I ran in to a couple things I am not sure how to solve.

1 - As the camera moves further away, at some point the entire texture would render black. This makes some sense in my head, but in real life this is not the case and in fact it does the exact opposite. My idea was to have the overlay texture fade out over distance. After following a tutorial about distance based blending I thought I was on the right track but I kept running into problems. I don't want distance based blending I suppose, I want a mask with transparency to fade out it's opacity over distance to reveal the texture underneath. This seems to be quite a different concept as it it not a blend, but more like an overlay mask. Any idea on this? My worst case was to make a separate mesh in front and have it fade out transparency over distance but I would love to solve it on the same material if possible.

2 - Using regular Albedo or Emission causes color shift from the original texture/ video that I cannot seem to get rid of. My thought was to use an unlit shader as this is generally what I used for these video textures and they worked nicely. However, whenever I create an unlit shader, it is semi-transparent. This is somewhat confusing to me. The only way to get it to not be transparent is to change the render queue to transparent so it renders later. This causes other things like post effects to not recognize it so I am not sure what to do. I do not remember this particular behavior with unlit shaders. Again I could fix by putting an opaque object behind it, but this seems like a bad hacky way to do this. Any ideas?

Thanks everyone!
pixelpup
 
Posts: 8
Joined: Sun Oct 14, 2018 4:49 pm

Re: Unlit Shader is Semi Transparent, Render order?

Postby pixelpup » Sun Oct 14, 2018 6:24 pm

OK, I figured out part of the problem. In my shader graph I was breaking apart the channels and somewhere in there I ended up with just an RGB output and no alpha channel. While this is not normally a problem, if you are using screen space reflections, it is. It seems as though the alpha channel defaults to 0 if not specified with SSR on. Not sure why, but just adding a float of 1 for alpha cleared this issue up...
pixelpup
 
Posts: 8
Joined: Sun Oct 14, 2018 4:49 pm

Re: Unlit Shader is Semi Transparent, Render order?

Postby Amplify_Borba » Mon Oct 15, 2018 2:21 pm

Hello, thank you for getting in touch and for your support!

Could you please provide us a sample with the issue mentioned in point 2 present?
You may share it privately through [email protected], if you prefer.

Also, what Unity version what SSR solution are you using?
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Unlit Shader is Semi Transparent, Render order?

Postby pixelpup » Mon Oct 15, 2018 5:01 pm

Email sent with image example.
Working on part 1 now. Need to figure out fade to transparent, not black. I will try different ideas today..
pixelpup
 
Posts: 8
Joined: Sun Oct 14, 2018 4:49 pm

Re: Unlit Shader is Semi Transparent, Render order?

Postby Amplify_Borba » Tue Oct 16, 2018 3:28 pm

Thank you for the additional details shared over email!

I've verified the behavior you've reported and confirmed with the developer that it's expected, which is due to our Unlit template being Forward Only. Unity's own Unlit shader has the same issue, so we recommend that you use the Standard Surface Shader type if you wish to use Deferred Shading.

Regarding the lighting effect you're trying to create, would you please share an image or video of the expected result, so that we may best help you?
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Unlit Shader is Semi Transparent, Render order?

Postby pixelpup » Tue Oct 16, 2018 11:13 pm

I also observed that the Unity unlit shader seemed to give the same result which was also puzzling, but being a forward path shader makes sense. I was attempting to re-create the look of an LED wall in a live event. I use AVPro Video to play back video files and after many iterations of this, using their unlit shader always worked best as the standard shader in albedo receives so much lighting shading. Technically it is am emissive surface but again, the emissive texture shifts the color so far towards white/HDR range it takes a lot of tweaking to get it to look correct. At the end of the day its fine. I can just put a black plane behind the unlit shader and it works for now.

The other idea was re-creating the moire effect that is caused by angle of the camera and the fact there is space between pixels on a wall. To create this you just need a square mask with a hole cut in the center. This works fine but it gets funky in Unity at a certain distance so I wanted to have this mask fade out over distance. I can kinda get it to work but the blend modes are not really what I am looking for. I want to have a mask texture which has transparency sit on top of another texture, and then fade the opacity of the texture of the mask out based on distance. I can make this work pretty easily using 2 meshes and 2 textures, but I was hoping to combine the idea. I cannot seem to figure it out as everything I try in Amplify seems to want to multiply or blend textures together which shifts the color, and not really stack them like layers including the alpha channel. I may be missing something very basic....

Extreme example of Moire Effect - https://www.dpreview.com/forums/thread/2761680
Simple PNG of pixel mask attached. I want to tile this depending on the aspect ratio of the screen surface. It has alpha channel for the cut out which may not be obvious.
Attachments
PixelCutOut.png
PixelCutOut.png (859 Bytes) Viewed 5341 times
pixelpup
 
Posts: 8
Joined: Sun Oct 14, 2018 4:49 pm

Re: Unlit Shader is Semi Transparent, Render order?

Postby Amplify_Borba » Wed Oct 17, 2018 3:32 pm

Thank you for providing additional details!

We've set up a sample that's can be used as a good starting point for the Moire effect, which I'm sharing as a package for your convenience:

MoireEffect.unitypackage
(12.71 KiB) Downloaded 209 times


We're using the Screen Params node for tiling the Texture according to the aspect ratio and a Surface Depth node with normalized View Space so that the effect fades based on distance. You also have two parameters to adjust, these being the Mask Tile Size and the Max Mask Strength, which perform as their names suggest.

Please let me know if this helps and if you have any further questions.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Unlit Shader is Semi Transparent, Render order?

Postby pixelpup » Thu Oct 18, 2018 1:19 am

So it seems you tried to go a similar route to the way I did originally, but this is not really layering the cut out over the texture, it is blending it together. Attached is side by side the sphere with the Moire shader and on the right are 2 spheres. One slightly larger than the other that has the cut-out on top of the other. Firstly the blend is inverting the colors, and second it is shifting the checker color towards white. This is where I was having trouble as I don't want them to mix. I would like it to work like a layer stack in photoshop. If I were to fade the pixel mask out I should see just the texture below it, and if I fade it up I should see the pixelmask on top of the texture. Does that make sense?
Attachments
2Sphere.jpg
2Sphere.jpg (118.51 KiB) Viewed 5330 times
pixelpup
 
Posts: 8
Joined: Sun Oct 14, 2018 4:49 pm

Re: Unlit Shader is Semi Transparent, Render order?

Postby Amplify_Borba » Thu Oct 18, 2018 10:33 am

I see, I believe that the following changes provide a similar cutout effect to what you've shared:

Image

Please let me know if this is the case.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Unlit Shader is Semi Transparent, Render order?

Postby pixelpup » Mon Oct 22, 2018 6:55 pm

No, as you can probably see in the picture you posted, the multiply function shifts the color. It looks way more saturated than it should. I feel like the function of stacking 2 textures one with alpha just doesn't really exist the way I am hoping...
pixelpup
 
Posts: 8
Joined: Sun Oct 14, 2018 4:49 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests