Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Why does this RayMarcher doesn't work with 3D Textures?

Hi, so I try to use the RayMarcher, which is shown in here.

I use the basic code from the first sample (opacity only). The only difference is, that I don't use a 2D Flipbook, but a real Volume Texture which is available sind 4.20 (You can create it from a flipbook, but I also implemented a Factory which imports my raw 3D data, both methods show this bug). When using his flipbook approach, everything is fine. But when I use the Volume Texture I get weird artifacts.

Here is the custom Material Node Code which I use to compute the Emissive Color:

 float accumdist = 0;
 float3 localCamVec = normalize(mul(Parameters.CameraVector, Primitive.WorldToLocal));
 float StepSize = 1 / MaxSteps;
 for(int i = 0; i < MaxSteps; i++)
 float3 satPos = saturate(CurPos);
 float curSample = Tex.SampleLevel(TexSampler, satPos, 0).r;
 accumdist += curSample * StepSize;
 CurPos += -localCamVec * StepSize;
 return accumdist;

CurPos is BoundingBoxBased_0-1_UVW.

The following artifact is visible: alt text

You can see the stripes which are emitting from the ball. Another one from the side:

alt text

I used Opaque instead of Additive blending so you can see it better. It also goes in the depth.

I have no idea what is wrong since it works with the flipbook. I think maybe it is a bug with Sampling of the new Volume Textures? This also occurs with different Volume Textures.

Product Version: UE 4.20
more ▼

asked Sep 21 '18 at 05:27 PM in Rendering

avatar image

870 46 44 80

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Most likely you are hitting volume limits and as your texture coordinates are saturated, when you are hitting a plane of the bounding box, your raymarch continues with 2 coordinates out of 3 incrementing, resulting in said artifacts. Either pre-calculate exit point and adjust step number accordingly or check if you are still inside the volume at every step.

more ▼

answered Sep 25 '18 at 09:55 PM

avatar image

7.8k 130 30 292

avatar image birdfreeyahoo Sep 30 '18 at 05:34 AM

Thanks, your answer brought me on the right track. I thought this can't be the problem because I also used his code where he precalculates the Step count. But the article didn't show that the StepSize has to be precalculated too, otherwise a modified step count doesn't do anything, because the ray marcher code will always fit the step size to a ray length of 1. The flipbook approach also showed artifacts with other volumes that are more box-like. Those start to repeat when the ray goes beneath the volume.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question