// Original GalaxyGlow: authored150-vertex mesh, two25-sample ellipsoid
// integrals, source noise texture and named FGM parameters. Shared output
// controls are explicit inputs; their live values are not yet restored.
cbuffer OriginalCoreCamera:register(b6) {
float4 coreEyeFocal,coreRightWidth,coreUpHeight,coreForwardNear,coreOutput;
float4 coreInnerColour,coreOuterColour,coreColourScalePower,coreCentreRadius;
float4 coreRadiusShape,coreOuterShape,coreDitherInternal,coreMinMax;
}
Texture2D<float4> originalCoreNoise:register(t16);
SamplerState originalCoreSampler:register(s1);
struct OriginalCoreVertex {float3 position:POSITION;};
// Keep the original VS output register order for direct DXBC comparison.
struct OriginalCorePixel {float3 clip:TEXCOORD0;float3 ray:TEXCOORD1;float4 position:SV_POSITION;};
OriginalCorePixel VSOriginalCore(OriginalCoreVertex source) {
OriginalCorePixel p;float3 world=source.position*40000+float3(50000,40955,50000);
p.ray=world-coreEyeFocal.xyz;float depth=dot(p.ray,coreForwardNear.xyz);
p.position=float4(dot(p.ray,coreRightWidth.xyz)*coreEyeFocal.w*2/coreRightWidth.w,
dot(p.ray,coreUpHeight.xyz)*coreEyeFocal.w*2/coreUpHeight.w,coreForwardNear.w,depth);
p.clip=p.position.xyw;return p;
}
float OriginalCoreIntegral(float3 ray,float3 centre,float3 shape,float radius,float power) {
float3 direction=normalize(ray/shape),scaledCentre=centre/shape;
float b=dot(direction,-scaledCentre);
float determinant=b*b-(dot(scaledCentre,scaledCentre)-radius*radius);
float entry=0,exit=0;
if(determinant>0) {float root=sqrt(determinant);entry=max(0,-b-root);exit=max(0,-b+root);}
float3 start=(entry*direction-scaledCentre)/radius;
float3 delta=(exit*direction-scaledCentre)/radius-start;
float sum=0;
[unroll]for(uint i=0;i<25;i++) {
float3 sample=delta*(i*.04)+start;
sum+=exp(-dot(sample,sample)/(power+power));
}
return min(1,sum*.04);
}
float4 PSOriginalCore(OriginalCorePixel p):SV_TARGET {
float3 ray=normalize(p.ray),centre=coreCentreRadius.xyz-coreEyeFocal.xyz;
float inner=OriginalCoreIntegral(ray,centre,coreRadiusShape.yzw,coreCentreRadius.w,coreColourScalePower.y);
float outer=OriginalCoreIntegral(ray,centre,coreOuterShape.xyz,coreRadiusShape.x,coreColourScalePower.w);
float innerDistance=saturate(length(centre/coreRadiusShape.yzw)/coreCentreRadius.w);
float outerDistance=saturate(length(centre/coreOuterShape.xyz)/coreRadiusShape.x);
float range=coreMinMax.y-coreMinMax.x;
float innerBlend=saturate((innerDistance-coreMinMax.x)/range),outerBlend=saturate((outerDistance-coreMinMax.x)/range);
innerBlend=innerBlend*innerBlend*(3-2*innerBlend);
outerBlend=outerBlend*outerBlend*(3-2*outerBlend);
innerBlend=coreDitherInternal.z+(1-coreDitherInternal.z)*innerBlend;
outerBlend=coreDitherInternal.z+(1-coreDitherInternal.z)*outerBlend;
float innerAmount=inner*innerBlend,outerAmount=outer*outerBlend;
float3 colour=innerAmount*coreInnerColour.rgb*coreInnerColour.a*coreColourScalePower.x+
outerAmount*coreOuterColour.rgb*coreOuterColour.a*coreColourScalePower.z*(1-innerAmount);
float total=innerAmount+outerAmount;
float2 noiseUv=(p.clip.xy/p.clip.z+1)*coreDitherInternal.y*float2(16,9);
float3 noise=originalCoreNoise.Sample(originalCoreSampler,noiseUv).rgb-1;
float dither=(1-total*.5)*coreDitherInternal.x;dither*=dither;dither*=dither;
colour+=noise*colour*dither;
return float4(colour*sqrt(coreOutput.z)*coreOutput.y,1);
}
// Original GalaxyGlow: authored150-vertex mesh, two25-sample ellipsoid
// integrals, source noise texture and named FGM parameters. Shared output
// controls are explicit inputs; their live values are not yet restored.
cbuffer OriginalCoreCamera:register(b6) {
float4 coreEyeFocal,coreRightWidth,coreUpHeight,coreForwardNear,coreOutput;
float4 coreInnerColour,coreOuterColour,coreColourScalePower,coreCentreRadius;
float4 coreRadiusShape,coreOuterShape,coreDitherInternal,coreMinMax;
}
Texture2D<float4> originalCoreNoise:register(t16);
SamplerState originalCoreSampler:register(s1);
struct OriginalCoreVertex {float3 position:POSITION;};
// Keep the original VS output register order for direct DXBC comparison.
struct OriginalCorePixel {float3 clip:TEXCOORD0;float3 ray:TEXCOORD1;float4 position:SV_POSITION;};
OriginalCorePixel VSOriginalCore(OriginalCoreVertex source) {
OriginalCorePixel p;float3 world=source.position*40000+float3(50000,40955,50000);
p.ray=world-coreEyeFocal.xyz;float depth=dot(p.ray,coreForwardNear.xyz);
p.position=float4(dot(p.ray,coreRightWidth.xyz)*coreEyeFocal.w*2/coreRightWidth.w,
dot(p.ray,coreUpHeight.xyz)*coreEyeFocal.w*2/coreUpHeight.w,coreForwardNear.w,depth);
p.clip=p.position.xyw;return p;
}
float OriginalCoreIntegral(float3 ray,float3 centre,float3 shape,float radius,float power) {
float3 direction=normalize(ray/shape),scaledCentre=centre/shape;
float b=dot(direction,-scaledCentre);
float determinant=b*b-(dot(scaledCentre,scaledCentre)-radius*radius);
float entry=0,exit=0;
if(determinant>0) {float root=sqrt(determinant);entry=max(0,-b-root);exit=max(0,-b+root);}
float3 start=(entry*direction-scaledCentre)/radius;
float3 delta=(exit*direction-scaledCentre)/radius-start;
float sum=0;
[unroll]for(uint i=0;i<25;i++) {
float3 sample=delta*(i*.04)+start;
sum+=exp(-dot(sample,sample)/(power+power));
}
return min(1,sum*.04);
}
float4 PSOriginalCore(OriginalCorePixel p):SV_TARGET {
float3 ray=normalize(p.ray),centre=coreCentreRadius.xyz-coreEyeFocal.xyz;
float inner=OriginalCoreIntegral(ray,centre,coreRadiusShape.yzw,coreCentreRadius.w,coreColourScalePower.y);
float outer=OriginalCoreIntegral(ray,centre,coreOuterShape.xyz,coreRadiusShape.x,coreColourScalePower.w);
float innerDistance=saturate(length(centre/coreRadiusShape.yzw)/coreCentreRadius.w);
float outerDistance=saturate(length(centre/coreOuterShape.xyz)/coreRadiusShape.x);
float range=coreMinMax.y-coreMinMax.x;
float innerBlend=saturate((innerDistance-coreMinMax.x)/range),outerBlend=saturate((outerDistance-coreMinMax.x)/range);
innerBlend=innerBlend*innerBlend*(3-2*innerBlend);
outerBlend=outerBlend*outerBlend*(3-2*outerBlend);
innerBlend=coreDitherInternal.z+(1-coreDitherInternal.z)*innerBlend;
outerBlend=coreDitherInternal.z+(1-coreDitherInternal.z)*outerBlend;
float innerAmount=inner*innerBlend,outerAmount=outer*outerBlend;
float3 colour=innerAmount*coreInnerColour.rgb*coreInnerColour.a*coreColourScalePower.x+
outerAmount*coreOuterColour.rgb*coreOuterColour.a*coreColourScalePower.z*(1-innerAmount);
float total=innerAmount+outerAmount;
float2 noiseUv=(p.clip.xy/p.clip.z+1)*coreDitherInternal.y*float2(16,9);
float3 noise=originalCoreNoise.Sample(originalCoreSampler,noiseUv).rgb-1;
float dither=(1-total*.5)*coreDitherInternal.x;dither*=dither;dither*=dither;
colour+=noise*colour*dither;
return float4(colour*sqrt(coreOutput.z)*coreOutput.y,1);
}