Standard Double Sided Shaders

Hello

I released double sided standard shaders package on AssetStore.
They are used same like Unity standard and standard(SpecularSetup) shaders.
They require shader model 3.0 or higher.
They feature mesh triangles drawn on both sides with accurate lighting in single draw call.

You can see use in this video.

Also you can try web player HERE .

Link to asset store HERE .

Instructions:

  • choose mesh
  • create material and apply StandardDoubleSided or StandardSpecularDoubleSided shader on it.
  • carry on like usual Standard or Standard (Specular Setup) shader.

Thank you.

1 Like

Thank you! %) I already bought and used it in my project. Works perfectly.
Wanted to write it by myself (need to turn culling off and flip the normals for back side), but you saved me few hours of work.

Edit: didn’t see in the description that you have it as well for the specular set up. However in the video I just noticed the metallic set one.
sorry for being to quick to post…

You are right. Thank you.

Yes, there are both variants. I use standard(specular setup) more often in my projects than the other one, so its more important to me.

I just wanna say that I added additional double sided shaders to the pack:

mobile diffuse,
mobile bumped,
mobile bumped specular
mobile bumped specular 1 directional light
legacy decal,
legacy diffuse,
legacy bumped specular,
legacy parallax diffuse,
legacy parallax specular
legacy cutout diffuse
legacy cutout bumped specular
also two face texture shaders that draws two textures, one on each face .
two face diffuse
two face bumped

All in single draw call / pass.

Another web player: LINK

If someone needs another kind, feel free to suggest.

Very interesting, great idea!

Hi.

This looks like just what I need!

But I need to know if this works with the Realtime GI?

You see, our CAD-software does not care about what side of a triangle is the front. It renders everything as doublesided, so when I export for use in Unity it’s pretty much hit-n-miss if a tri is facing the wrong way. (Yes out CAD-software sucks)

I tried to do the “Cull Off” on the standard shader and that is definitly not enough to satisfy the “Enlighten” thing-a-magicky

Yes, it works with GI - same like standard shader.

Hi again. At least with my setup it doesn’t. Deferred, Specular workflow. Backside renders with what seems like no GI; much darker. Also the reflection in probes is black. Also Ambient occlusion using G-buffer stopped working. Any clues? 5.4.0f3.

As far as ambient occlusion goes - it needs doublesidedness implemented in the .AO process I think.
I remember using ‘AmbientObscurance’ from standard assets and it worked - though ‘AmbientOcclusion’ does not work.
I’ll check the other.

I just checked - and all works fine. All the scenes in the package are realtime GI. ( Do the package scenes work on your end )
Did you used maybe double sided standard shaders from before 5.4 on 5.4 - if you did then it they dont work - they changed standard shader a little for 5.4.

I don’t see any GI solution used in the demoscenes?

Anyways. I tried adding Precomputed realtime GI, and made the lot static for lightmap, and well, something didn’t work. Materials unresponsive to GI. Also looks like direct light travel through to the backside on some carpets with normals at least.

I just purchased your package today from asset store, so I think it matches my Unity version?

Thanks for the support on this :slight_smile:

Hi,

I Have tried to compile the scene “scene” contained in package example on I-Pad Air , but the player crashes at startup (On android devices works well). The only error that I can see is the following.

Compilation failed:

program_source:4:10: error: unknown type name ‘FragmentCommonData’
constant FragmentCommonData _xlat_mtl_const1 = {float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), 0.0, 0.0, float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0), 0.0};
program_source:72:20: error: assigning to ‘float3’ (aka ‘vector_float3’) from incompatible type ‘half3’ (aka ‘vector_half3’)
s_14.normalWorld = tmpvar_8;

Any ideas ?
Thanks.

1 Like

Hello!
Can you tell me what graphics API are you using. IOS has problems building my shaders with metal. So if you are building for IOS can you please use OpenGL.

Hi,
Thanks for reply!.
The problem is the graphics API, by switching to OpenGL shader works fine.

Are you planning to update the package to work with metal?

Hmmm…
From unity blog:
‘When you create a new shader file (.shader) in Unity or edit existing one, we launch a “shader importer”. Just like for any other changed asset. That shader importer does some parsing, and then compiles the whole shader into all platform backends we support.’
I’ll have to see if compilation from shaderlab to metal will be fixed/improved by unity.
I worked in HLSL a lot, I am not really experienced in metal.
I’ll keep an eye for solution other than switching to other API.

Ok, great. Thanks!

Just upgraded to 5.5 and it broke. Snarf snarf!!

Love these shaders but 5.5 broke them for me as well. The code giving problems is :
UnityLight mainLight = MainLight (normal);

UnityLight light = AdditiveLight (normalWS, IN_LIGHTDIR_FWDADD(i), LIGHT_ATTENUATION(i));

I am looking for a fix online but if anyone has ideas let me know. Gonna dig through the 5.5 release notes and see what changed.