Trying the much wanted Selection effect in an RTX-enabled project, which implies using the d3d11 renderer, I'm getting:
Shader error in '02_Selection/Fullscreen': cannot implicitly convert from 'const float3' to 'float4' at line 97 (on d3d11)
and if I manually fix this line, turn:
float4 c = LoadCustomColor(posInput.positionSS);
into
float4 c = float4(LoadCustomColor(posInput.positionSS), 1);
then the next place for the same error shows up:
Shader error in '02_Selection/Fullscreen': cannot implicitly convert from 'const float3' to 'float4' at line 111 (on d3d11)
Fixing both places like that gives a broken effect with the white stripes going across the whole screen, and properly colored where they pass over the "selected" object, and also there is totally no outline despite changing any settings. See the screenshot below.
Could you please clarify if this is correct? And would updating to the latest Unity 2019.3.0b8 be the right way to solve this problem?
UPDATE: Changing the LoadCustomColor() and SampleCustomColor() to return float4 instead of float3 and to take the full rgba value inside of them, instead of just rgb, solved the issue and the shaders now work as in the example. This, however, feels hacky, I don't think that modifying that file should be necessary, and, besides, the auto-generated docs in the shaders, including the Selection shaders in this repo, clearly state that those functions return float3. So the question on what would be considered an appropriate solution to this problem still remains.
Trying the much wanted Selection effect in an RTX-enabled project, which implies using the d3d11 renderer, I'm getting:
and if I manually fix this line, turn:
into
then the next place for the same error shows up:
Fixing both places like that gives a broken effect with the white stripes going across the whole screen, and properly colored where they pass over the "selected" object, and also there is totally no outline despite changing any settings. See the screenshot below.
My current Unity version is 2019.3.0b6, and HDRP 7.1.1, and I believe that your code is relying on the newest version of HDRP taken hot from its repo, because in the repository: https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl#L319 this function indeed returns
float4
.Could you please clarify if this is correct? And would updating to the latest Unity 2019.3.0b8 be the right way to solve this problem?
UPDATE: Changing the
LoadCustomColor()
andSampleCustomColor()
to returnfloat4
instead offloat3
and to take the fullrgba
value inside of them, instead of justrgb
, solved the issue and the shaders now work as in the example. This, however, feels hacky, I don't think that modifying that file should be necessary, and, besides, the auto-generated docs in the shaders, including the Selection shaders in this repo, clearly state that those functions returnfloat3
. So the question on what would be considered an appropriate solution to this problem still remains.