I thought I’d try and port some shaders, so I can learn the syntax changes, so I’m trying GS_PointSprites from dx11
I’m refering to https://github.com/vvvv/VL.Stride/blob/preview/gamma-2021.4/packages/VL.Stride.Runtime/src/Effects/InstancedMeshStreamOut_DrawFX.sdsl#L15 to try and get the GS code syntax for stride and hack the dx11 code in, but as soon as I add the streamOutput section I get an exception. Any clues to why?
VL Shaders.zip (3.7 KB)
void GSMain(point Input input, inout TriangleStream gsout)
for(int i=0; i<4; i++)
//Get position from quad array
float3 position = streams.g_positions[i]*spritesize;//*(input.ii ==offset);
//Make sure quad will face camera
position = mul( position, (float3x3)tIV ).xyz + streams.ShadingPosition;
streams.ShadingPosition = mul( float4(position,1.0), ViewProjection );
streams.uv = g_texcoords[i];
Now trying to just alter the dx11 code, but how do I get a tIV in sdsl?
Its InverseView, but I think the (float3x3) stops it with truncation error
VL Shaders.zip (3.8 KB)
Ok this is error free, but I loose all inputs to the shader again, and black renderer…
VL Shaders.zip (4.8 KB)
Close, but not close enough
Things learned so far, you need to declare streams = input; to get the streams. IV is ViewInverse, there is some useful stuff in the Utils shader and some examples of syntax in this repo https://github.com/vvvv/VL.Stride/tree/preview/gamma-2021.4/packages/VL.Stride.Runtime/src/Effects
the only problem seems to be that you cannot use ShadingPosition, which is SV_Position in the pipeline as a reference point for the sprites. it gets projected after the vertex shader stage.
if you use another stream variable, for example PositionWS, and use that in the geometry shader, it works:
VL Geometry Shader.zip (5.4 KB)
PointSprites.zip (5.3 KB)
Renamed to Point Sprites
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.