// Source-space RouteInstances / RouteHotspotInstances from the pinned original
// DXBC. Projection uses the same recovered Core lens as the other map passes.
// Projection.y carries the original RGB-only gHDRScalingWrite. Independent
// source probes default to1; production supplies the shared scene Write.
cbuffer OriginalTradeCamera : register(b5) {
float4 tradeEyeFocal,tradeRightWidth,tradeUpHeight,tradeForwardNear,tradeProjection;
float4 tradeTimers0,tradeTimers1,tradeMaterial0,tradeMaterial1,tradeMaterial2;
}
Texture2D<float4> tradeRouteDiffuse : register(t13);
Texture2D<float4> tradeTrailDiffuse : register(t14);
Texture2D<float4> tradeHotspotDiffuse : register(t15);
SamplerState tradeSampler : register(s0);
struct TradeSource {
float4 stuv:STUV;float3 start:START;float3 end:END;float4 midOffset:MIDOFFSET;
float2 widthTime:WIDTHTIMEOFFSET;float4 atlas:UVSCALEOFFSET;float4 colour:COLOUR;
};
struct TradePixel {float4 position:SV_POSITION;float4 colour:COLOR;float4 uv:TEXCOORD0;float2 trail:TEXCOORD1;};
float TradeTimer(float width) {
// Original two one-hot dot products, including their exact eight thresholds.
return saturate(width>=.875?tradeTimers0.x:width>=.75?tradeTimers0.y:width>=.625?tradeTimers0.z:
width>=.5?tradeTimers0.w:width>=.375?tradeTimers1.x:width>=.25?tradeTimers1.y:width>=.125?tradeTimers1.z:tradeTimers1.w);
}
float4 TradeProject(float3 world) {
float3 delta=world-tradeEyeFocal.xyz;float z=dot(delta,tradeForwardNear.xyz);
float near=tradeForwardNear.w;
return float4(dot(delta,tradeRightWidth.xyz)*tradeEyeFocal.w*2/tradeRightWidth.w,
dot(delta,tradeUpHeight.xyz)*tradeEyeFocal.w*2/tradeUpHeight.w,near,z);
}
float3 TradeControl(TradeSource source,float distance) {
return (source.start+source.end)*.5+(source.midOffset.xyz*tradeProjection.z+tradeProjection.w)*distance*tradeMaterial0.w;
}
float3 TradeCurve(TradeSource source,float3 control,float t) {
float u=1-t;return source.start*(u*u)+control*(2*t*u)+source.end*(t*t);
}
TradePixel VSOriginalTradeRoute(TradeSource source) {
TradePixel p;p.colour=source.colour;float distance=length(source.end-source.start);
float timer=TradeTimer(source.widthTime.x),phase=timer+source.widthTime.y;
float eased=pow(source.stuv.z,1/(tradeMaterial1.x+1));
float2 uv=float2(eased,source.stuv.w)*source.atlas.xy+source.atlas.zw;
float first=uv.x*(distance/tradeMaterial2.x)-phase;
p.uv=float4(first,uv.y,first-timer,uv.y);
p.trail=float2(uv.x*min(distance/tradeMaterial1.y,8-tradeMaterial1.z)+.5-(timer*tradeMaterial1.z+source.widthTime.y),uv.y);
float t=source.stuv.x;float3 control=TradeControl(source,distance);
float3 tangent=(control-source.start)*(2*(1-t))+(source.end-control)*(2*t);
float3 side=normalize(cross(tradeForwardNear.xyz,tangent));
float width=(tradeMaterial1.w*sin(t*3.141592653589793)+(1-tradeMaterial1.w))*source.stuv.y*source.widthTime.x*tradeMaterial2.y;
p.position=TradeProject(TradeCurve(source,control,t)+side*width);return p;
}
float4 PSOriginalTradeRoute(TradePixel p):SV_TARGET {
float4 a=tradeRouteDiffuse.Sample(tradeSampler,p.uv.xy),b=tradeRouteDiffuse.Sample(tradeSampler,p.uv.zw);
float3 rgb=(a.rgb*tradeMaterial0.x*a.a)*(b.rgb*tradeMaterial0.x*b.a)*p.colour.rgb;
rgb*=tradeTrailDiffuse.Sample(tradeSampler,p.trail).rgb;
return float4(rgb*tradeProjection.y,p.colour.a);
}
TradePixel VSOriginalTradeHotspot(TradeSource source) {
TradePixel p;p.colour=source.colour;p.trail=0;
float distance=length(source.end-source.start),timer=TradeTimer(source.widthTime.x);
float phase=(timer*tradeMaterial1.z+source.widthTime.y-tradeMaterial1.z)/min(distance/tradeMaterial1.y,8-tradeMaterial1.z);
// Outside its phase window the authored pinch has zero endpoint size.
float t=phase>0?min(pow(phase,tradeMaterial1.x+1),1):0;
float sine,cosine;sincos(t*3.141592653589793,sine,cosine);
float2 positive=float2(cosine*source.stuv.x-sine*source.stuv.y,sine*source.stuv.x+cosine*source.stuv.y);
float2 negative=float2(cosine*source.stuv.x+sine*source.stuv.y,-sine*source.stuv.x+cosine*source.stuv.y);
p.uv=float4(negative*source.atlas.xy+source.atlas.zw,positive*source.atlas.xy+source.atlas.zw);
float size=(tradeMaterial1.w*sine+(1-tradeMaterial1.w))*source.widthTime.x*tradeMaterial2.z;
float3 world=TradeCurve(source,TradeControl(source,distance),t)+tradeRightWidth.xyz*(size*source.stuv.x)+tradeUpHeight.xyz*(size*source.stuv.y);
p.position=TradeProject(world);return p;
}
float4 PSOriginalTradeHotspot(TradePixel p):SV_TARGET {
float4 a=tradeHotspotDiffuse.Sample(tradeSampler,p.uv.xy),b=tradeHotspotDiffuse.Sample(tradeSampler,p.uv.zw);
// Hotspot's authored gStandardMapScales.x is2, while Route's is5.
return float4((a.rgb*2*a.a)*(b.rgb*2*b.a)*p.colour.rgb*tradeProjection.y,p.colour.a);
}
// Source-space RouteInstances / RouteHotspotInstances from the pinned original
// DXBC. Projection uses the same recovered Core lens as the other map passes.
// Projection.y carries the original RGB-only gHDRScalingWrite. Independent
// source probes default to1; production supplies the shared scene Write.
cbuffer OriginalTradeCamera : register(b5) {
float4 tradeEyeFocal,tradeRightWidth,tradeUpHeight,tradeForwardNear,tradeProjection;
float4 tradeTimers0,tradeTimers1,tradeMaterial0,tradeMaterial1,tradeMaterial2;
}
Texture2D<float4> tradeRouteDiffuse : register(t13);
Texture2D<float4> tradeTrailDiffuse : register(t14);
Texture2D<float4> tradeHotspotDiffuse : register(t15);
SamplerState tradeSampler : register(s0);
struct TradeSource {
float4 stuv:STUV;float3 start:START;float3 end:END;float4 midOffset:MIDOFFSET;
float2 widthTime:WIDTHTIMEOFFSET;float4 atlas:UVSCALEOFFSET;float4 colour:COLOUR;
};
struct TradePixel {float4 position:SV_POSITION;float4 colour:COLOR;float4 uv:TEXCOORD0;float2 trail:TEXCOORD1;};
float TradeTimer(float width) {
// Original two one-hot dot products, including their exact eight thresholds.
return saturate(width>=.875?tradeTimers0.x:width>=.75?tradeTimers0.y:width>=.625?tradeTimers0.z:
width>=.5?tradeTimers0.w:width>=.375?tradeTimers1.x:width>=.25?tradeTimers1.y:width>=.125?tradeTimers1.z:tradeTimers1.w);
}
float4 TradeProject(float3 world) {
float3 delta=world-tradeEyeFocal.xyz;float z=dot(delta,tradeForwardNear.xyz);
float near=tradeForwardNear.w;
return float4(dot(delta,tradeRightWidth.xyz)*tradeEyeFocal.w*2/tradeRightWidth.w,
dot(delta,tradeUpHeight.xyz)*tradeEyeFocal.w*2/tradeUpHeight.w,near,z);
}
float3 TradeControl(TradeSource source,float distance) {
return (source.start+source.end)*.5+(source.midOffset.xyz*tradeProjection.z+tradeProjection.w)*distance*tradeMaterial0.w;
}
float3 TradeCurve(TradeSource source,float3 control,float t) {
float u=1-t;return source.start*(u*u)+control*(2*t*u)+source.end*(t*t);
}
TradePixel VSOriginalTradeRoute(TradeSource source) {
TradePixel p;p.colour=source.colour;float distance=length(source.end-source.start);
float timer=TradeTimer(source.widthTime.x),phase=timer+source.widthTime.y;
float eased=pow(source.stuv.z,1/(tradeMaterial1.x+1));
float2 uv=float2(eased,source.stuv.w)*source.atlas.xy+source.atlas.zw;
float first=uv.x*(distance/tradeMaterial2.x)-phase;
p.uv=float4(first,uv.y,first-timer,uv.y);
p.trail=float2(uv.x*min(distance/tradeMaterial1.y,8-tradeMaterial1.z)+.5-(timer*tradeMaterial1.z+source.widthTime.y),uv.y);
float t=source.stuv.x;float3 control=TradeControl(source,distance);
float3 tangent=(control-source.start)*(2*(1-t))+(source.end-control)*(2*t);
float3 side=normalize(cross(tradeForwardNear.xyz,tangent));
float width=(tradeMaterial1.w*sin(t*3.141592653589793)+(1-tradeMaterial1.w))*source.stuv.y*source.widthTime.x*tradeMaterial2.y;
p.position=TradeProject(TradeCurve(source,control,t)+side*width);return p;
}
float4 PSOriginalTradeRoute(TradePixel p):SV_TARGET {
float4 a=tradeRouteDiffuse.Sample(tradeSampler,p.uv.xy),b=tradeRouteDiffuse.Sample(tradeSampler,p.uv.zw);
float3 rgb=(a.rgb*tradeMaterial0.x*a.a)*(b.rgb*tradeMaterial0.x*b.a)*p.colour.rgb;
rgb*=tradeTrailDiffuse.Sample(tradeSampler,p.trail).rgb;
return float4(rgb*tradeProjection.y,p.colour.a);
}
TradePixel VSOriginalTradeHotspot(TradeSource source) {
TradePixel p;p.colour=source.colour;p.trail=0;
float distance=length(source.end-source.start),timer=TradeTimer(source.widthTime.x);
float phase=(timer*tradeMaterial1.z+source.widthTime.y-tradeMaterial1.z)/min(distance/tradeMaterial1.y,8-tradeMaterial1.z);
// Outside its phase window the authored pinch has zero endpoint size.
float t=phase>0?min(pow(phase,tradeMaterial1.x+1),1):0;
float sine,cosine;sincos(t*3.141592653589793,sine,cosine);
float2 positive=float2(cosine*source.stuv.x-sine*source.stuv.y,sine*source.stuv.x+cosine*source.stuv.y);
float2 negative=float2(cosine*source.stuv.x+sine*source.stuv.y,-sine*source.stuv.x+cosine*source.stuv.y);
p.uv=float4(negative*source.atlas.xy+source.atlas.zw,positive*source.atlas.xy+source.atlas.zw);
float size=(tradeMaterial1.w*sine+(1-tradeMaterial1.w))*source.widthTime.x*tradeMaterial2.z;
float3 world=TradeCurve(source,TradeControl(source,distance),t)+tradeRightWidth.xyz*(size*source.stuv.x)+tradeUpHeight.xyz*(size*source.stuv.y);
p.position=TradeProject(world);return p;
}
float4 PSOriginalTradeHotspot(TradePixel p):SV_TARGET {
float4 a=tradeHotspotDiffuse.Sample(tradeSampler,p.uv.xy),b=tradeHotspotDiffuse.Sample(tradeSampler,p.uv.zw);
// Hotspot's authored gStandardMapScales.x is2, while Route's is5.
return float4((a.rgb*2*a.a)*(b.rgb*2*b.a)*p.colour.rgb*tradeProjection.y,p.colour.a);
}