# UE4 \[4-26\] Niagara Landscape Sample

**URL:** <https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910>\
**Category:** FX\
**Tags:** unreal-engine, UE4-26, question\
**Created:** [January 8, 2022, 5:30am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910 "2022-01-08T05:30:07Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [January 8, 2022, 5:30am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/1 "2022-01-08T05:30:07Z")

</div>

I have been using Distance fields to keep Niagara particles above ground but it is a hit and miss. I am now trying to use landscape but the module won’t let me enter a source. How do I enter a landscape into the module?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 8, 2022, 9:30am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/2 "2022-01-08T09:30:41Z")

</div>

I don’t know about that particular aspect of Niagara, but what about using collision?

---

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [January 28, 2022, 5:44am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/3 "2022-01-28T05:44:38Z")

</div>

Thanks for the reply, I tried using collision but it works worse if you can believe it. I wonder if I can use the texture of the landscape as a heightmap using Niagara’s texture module.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 28, 2022, 8:44am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/4 "2022-01-28T08:44:11Z")

</div>

As long as the landscape texture is in a texture asset, sure you can. You can use the ‘sample texture’ module.

I’ll need a bit more info though…

---

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [January 28, 2022, 10:25am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/5 "2022-01-28T10:25:52Z")

</div>

what info would you need? I am trying to use the texture sample but there is no function to get height like it shows for landscape, I am trying to convert the color into a float if thats possible.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 28, 2022, 10:47am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/6 "2022-01-28T10:47:45Z")

</div>

You can make a copy of the ‘sample texture’ module and hack it a bit to return the red channel from the texture ( it’s easy ). It does already return the color, and I suspect you’re supposed to be able to crack the red channel out of that, but I don’t find the parameter settings very intuitive in Niagara, so I did this to it:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/0/6/d06a0a4b8ef8594f19a7afb230cf2162f97d0cde.png)

which gives me back the red channel:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/5/965e8bdc22dd662045b633fca9328101ce7a0cc2.png)

which is what your landscape is using to do the height map.

Then you know to only spawn the particles if the red channel is white. You have to get the UVs right, of course, so what you’re seeing in the Niagara system matches with the landscape.

---

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [January 28, 2022, 10:51am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/7 "2022-01-28T10:51:57Z")

</div>

Okay this looks amazing, was on a similar route but had no idea about the redchannel! gonna try this out, again BIG THX!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 28, 2022, 10:57am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/8 "2022-01-28T10:57:38Z")

</div>

Like I say, I think you should be able to split it out from the SampledColor, but I just don’t get that Niagara parameter system. Same with the UV. In my example, I used a bit of HLSL to set the UV. Again, I think you can probably do this with the parameter system…

---

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [January 28, 2022, 11:20am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/9 "2022-01-28T11:20:31Z")

</div>

I am not familiar at all with HLSL but ill copy what you wrote. How did you add the  
“parameter writes”?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 28, 2022, 12:13pm UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/10 "2022-01-28T12:13:06Z")

</div>

Watch out with the HLSL, you can’t see the whole thing there, and it refers to user parameters you don’t have.

Basically, your particle system needs to figure out where it is on the landscape, with respect to the texture, and convert that into UV/0-1 ranges.

To be able to see what a module writes to click here:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/6/a/b6a2fc2d1c96db60aaf3ed5d97a01a0a44b34b24.png)

---

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [January 28, 2022, 8:11pm UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/11 "2022-01-28T20:11:37Z")

</div>

Im trying to do more research on the HLSL but this is what I got so far, it doesnt work with the height map but it works with collision(kinda).

 ![Test](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/8/ea8dea2fbac17005209dbb2ef7bf52c44fa17276.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 28, 2022, 8:19pm UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/12 "2022-01-28T20:19:27Z")

</div>

That height map texture looks like it doesn’t have any information.

They’re very easy to spot. Information:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/0/6506ec3119957fe7c859dcf1b3086ca981c135db.png)

No information:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/9/d59ff9c2b4a0e10d357c822db20c0796018c8ae2.png)

Even though it’s called _height_, you can see there’s nothing there.

So, first step is to use a heightmap with something in it 🙂

And how are you applying the heightmap to your land? Is it one big mountain range type thing, or are we talking about lumpy stones scattered around?

---

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [January 28, 2022, 10:27pm UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/13 "2022-01-28T22:27:20Z")

</div>

I did a simple one by hand but ill try a preset heightmap and see if that works

 ![Heightmap](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/e/b/9eb486a552510079fc77378227f90183a1ee57ec.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [January 29, 2022, 9:03am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/14 "2022-01-29T09:03:41Z")

</div>

There’s still no contrast.

For this to work cleanly, you need a well-defined difference between black and white.

Like I say, does this apply to your whole landscape? So this is a sort of mountain range thing?

---

<div class="post-metadata">

**Author:** ![Deathrey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Deathrey](https://forums.unrealengine.com/u/Deathrey)\
**Post date:** [February 6, 2022, 2:16am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/15 "2022-02-06T02:16:19Z")

</div>

Landscape data interface does not work in 4.26

---

<div class="post-metadata">

**Author:** ![Eramo1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Eramo1](https://forums.unrealengine.com/u/Eramo1)\
**Post date:** [February 6, 2022, 2:53am UTC](https://forums.unrealengine.com/t/ue4-4-26-niagara-landscape-sample/270910/16 "2022-02-06T02:53:00Z")

</div>

does it work in any other version?
