public void Sample(VolumeMaterialInfo info, float distance, ref RayData ray, out VolumeHitData vhd) { var pt = ray.Point(distance); var n3d = //NoiseProvider.Instance.Noise(pt.x, pt.y, pt.z); NoiseProvider.Instance.Turbulence(pt.x, pt.y, pt.z, 6); var t3d = NoiseProvider.Instance.Turbulence(pt.x, pt.y, pt.z, 4); // Sample texture info.Density vhd = new VolumeHitData() { IoR = info.MediumInfo.IoR, Emittance = info.Outscattering*t3d, Absorbance = info.Absorbtion*n3d, Scattering = ((info.Inscattering + info.Absorbtion) * t3d) / info.Inscattering, Density = 0.05f//NoiseProvider.Instance.Noise(pt.x,pt.y,pt.z), }; }
public void SampleVolume(ref RayHit hit, ref RayData ray, out VolumeHitData vhd) { var currentTriangleIndex = (int)hit.Index; var meshMatID = scene.GetMeshByTriangleIndex(currentTriangleIndex).MaterialID; var volumeMaterialInfo = vm.GetMaterialInfo(meshMatID); vmSampler.Sample(volumeMaterialInfo, hit.Distance, ref ray, out vhd); }