Thank you for feedbacks. I will fix it in next release. I’m current working add VS 2020 Preview support for this plugin and will release a new version then.
Hi, I seem to get an exception in Visual Studio after installing the extension. I installed it through the package manager, then read the manual and clicked on the .vsix file.
ActivityLog.xml tells me the following
Still unable to load MEF component DLL: Could not load file or assembly ‘Microsoft.VisualStudio.Threading, Version=16.10.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
C:\USERS\LINUS\APPDATA\LOCAL\MICROSOFT\VISUALSTUDIO\16.0_022BDB95\EXTENSIONS\TYXID43Z.0XK\ShaderlabVSPro.dll
Hi @linusvernyns , What’s the version of VS 2019 on your side? After some investigation, seems that it’s an issue that VS version don’t match extension.
Just add new extension linked to ShaderlabVSPro is simple, but it may not works well since ShaderlabVS Pro does not support Better Shaders syntax in current release. But adding the support of Better Shaders syntax is possible in future release.
May I ask you more information about the ‘different extension’ you mentioned? Does it has its own syntax different from Better Shaders or Shaderlab?
The extension is .surfShader - the syntax is mostly the same (the hlsl is anyway) but it has different layout/sections for subshaders, etc. It makes it easy to make shaders for URP/HDRP/Standard. Here is a simple shader:
#pragma enable_d3d11_debug_symbols
BEGIN_OPTIONS
ShaderName "UMA/Compositing/Albedo"
END_OPTIONS
BEGIN_PROPERTIES
_OverlayCount ("OverlayCount", Float) = 0
_ColorModulation ("Color Modulation", Range(0,2)) = 1
[NoScaleOffset]_Albedo("Albedo", 2D) = "white" {}
[NoScaleOffset]_Albedo1("Albedo1", 2D) = "white" {}
[NoScaleOffset]_Albedo2("Albedo2", 2D) = "white" {}
[NoScaleOffset]_Albedo3("Albedo3", 2D) = "white" {}
// no AlphaMask for the base.
[NoScaleOffset]_AlphaMask1("Mask1", 2D) = "white" {}
[NoScaleOffset]_AlphaMask2("Mask2", 2D) = "white" {}
[NoScaleOffset]_AlphaMask3("Mask3", 2D) = "white" {}
END_PROPERTIES
// Any variables you want to have in the per material CBuffer go here.
BEGIN_CBUFFER
half _OverlayCount;
half _ColorModulation;
float4 ColorTints[12];
float4 ColorAdds[12];
END_CBUFFER
// if you are writing a subshader, any defines that should be set on the main
// shader are defined here
BEGIN_DEFINES
END_DEFINES
// All code goes here
BEGIN_CODE
TEXTURE2D(_Albedo);
SAMPLER(sampler_Albedo);
TEXTURE2D(_Albedo1);
TEXTURE2D(_AlphaMask1);
TEXTURE2D(_Albedo2);
TEXTURE2D(_AlphaMask2);
TEXTURE2D(_Albedo3);
TEXTURE2D(_AlphaMask3);
void SurfaceFunction(inout Surface o, ShaderData d)
{
float2 uv = d.texcoord0.xy;
half4 base_c = (SAMPLE_TEXTURE2D(_Albedo, sampler_Albedo, uv) * ColorTints[0]) + ColorAdds[0];
o.Alpha = base_c.a;
if (_OverlayCount > 1)
{
half4 add_c = (SAMPLE_TEXTURE2D(_Albedo1, sampler_Albedo, uv) * ColorTints[1]) + ColorAdds[1];
float alpha = SAMPLE_TEXTURE2D(_AlphaMask1, sampler_Albedo, uv).a;
float oneminus = 1.0f-alpha;
base_c = (add_c * alpha) + (base_c * oneminus);
}
if (_OverlayCount > 2)
{
half4 add_c = (SAMPLE_TEXTURE2D(_Albedo2, sampler_Albedo, uv) * ColorTints[2]) + ColorAdds[2];
float alpha = SAMPLE_TEXTURE2D(_AlphaMask2, sampler_Albedo, uv).a;
float oneminus = 1.0f-alpha;
base_c = (add_c * alpha) + (base_c * oneminus);
}
if (_OverlayCount > 3)
{
half4 add_c = (SAMPLE_TEXTURE2D(_Albedo3, sampler_Albedo, uv) * ColorTints[3]) + ColorAdds[3];
float alpha = SAMPLE_TEXTURE2D(_AlphaMask3, sampler_Albedo, uv).a;
float oneminus = 1.0f-alpha;
base_c = (add_c * alpha) + (base_c * oneminus);
}
o.Albedo = base_c * _ColorModulation;
}
END_CODE
Thank you for the sample. Yes, syntax in code region is almost same. but there are other parts we need to take care. like include files, auto format, outline supports, syntax highlighting etc. I will do some research and i add better shader supports in future release.
Hi @Jaimi and @atomicjoe , BetterShaders file (.surfshader) support is available in latest version 1.3.2 now. It is the first version that support BetterShaders. It may not perfect but will be improved in later release.