/RM_Basic_Algorithm.hlsl Secret
Created
May 5, 2020 10:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float3 cameraVec = -normalize(Parameters.CameraVector); | |
float3 cameraPos = ResolvedView.WorldCameraOrigin; | |
int raySteps = 30; | |
float marchingDist = 10; | |
float stepSize = marchingDist/raySteps; | |
float totalDensity = 0; | |
for(int i = 0; i < raySteps, i++){ | |
float3 pos = cameraPos + cameraVec * stepSize * i; | |
float sample = Texture3DSample(Tex,GetMaterialSharedSampler(ShapeTexSampler,Material.Wrap_WorldGroupSettings),pos)).r; | |
totalDensity += sample / stepSize; | |
} | |
return totalDensity; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment