I can't seem to get my volume raycaster to work properly. I've been poking around changing things for days trying to get it to display my volume correctly but I seem only to get distorted mutations of it.
What I tried to do was a 1-pass renderer because the 2-pass one I made wasn't good enough for my purposes. I'm using C# XNA and the renderer wont have to handle transparency so it only has to get in and fetch the first color it bumps into.
How it should look:
How it looks:
float4 OnePassPS(OnePassVSOutput input, float2 pixelCoord : VPOS) : COLOR0 {
float3 rayDir = normalize(mul(float3(((pixelCoord / WindowSize) * 2) - 1.0, -FocalLength), ModelView));
float4 pos = float4(RayOrigin + (rayDir * (input.pos.z / input.pos.w)), 0);
float3 Step = rayDir * StepSize;
float4 color = float4(0, 0, 0, 0);
for(int i = 0; i < Iterations; i++)
{
color = tex3Dlod(VolumeS, pos);
if(color.a > 0)
break;
pos.xyz += Step;
}
return color; }