 				}
 
 				// count normal
-				stepDirX = float3(stepDir.x, -stepDir.z, stepDir.y); // rotate stepDir 90 degrees around X axis
-				stepDirY = float3(-stepDir.z, stepDir.y, stepDir.x); // rotate stepDir 90 degrees around Y axis
-				// density difference between (pos - stepDir) and (pos + stepDir) in 3 directions
+				stepDirNormX = float3(stepDirNorm.x, -stepDirNorm.z, stepDirNorm.y); // rotate stepDirNorm 90 degrees around X axis        
+        stepDirNormY = normalize(cross(stepDirNorm, stepDirNormX)); // rotate stepDir 90 degrees around Y axis
+        stepDirX = stepDirNormX * stepDirLen;
+        stepDirY = stepDirNormY * stepDirLen;
+        // density difference between (pos - stepDir) and (pos + stepDir) in 3 directions
 				dx = tex3Dlod(_Volume, float4(pos - stepDirX, 0)).r - tex3Dlod(_Volume, float4(pos + stepDirX, 0)).r;
 				dy = tex3Dlod(_Volume, float4(pos - stepDirY, 0)).r - tex3Dlod(_Volume, float4(pos + stepDirY, 0)).r;
 				dz = tex3Dlod(_Volume, float4(pos - stepDir, 0)).r - tex3Dlod(_Volume, float4(pos + stepDir, 0)).r;

		// ray throush the volume
		float3 dir = backObj.xyz - frontObj.xyz;
		float length = distance(frontObj, backObj);
		float step = _Step * _StepFactor;
		float3 stepDir = step * dir;

		// walk along the ray sampling the volume
		float3 pos = frontObj, worldPos;

				// normal to world coordinates
				normal = mul(unity_ObjectToWorld, normal);
				normal = normalize(normal);
				// phong lighting model				
        worldPos = mul(unity_ObjectToWorld, pos);
        viewDir = normalize(_WorldSpaceCameraPos - worldPos);
        lightDir = normalize(_WorldSpaceLightPos0.xyz);
        reflectDir = reflect(-lightDir, normal);
        reflectDir = normalize(reflectDir);
        color = ambient + diffuse * max(0.0, dot(normal, lightDir)) + specular * pow(max(0.0, dot(reflectDir, viewDir)), _Shininess);				

        break;
			}
			pos += stepDir;
		}
