Getting ground color for grass

Epic Bump…

How one can set Scene capture2d to Ortho?

Thanks Sgt. Wulf!

I ended up doing what was talking about; using colourmap from the landscape grass material, works pretty well.

1 Like

Hello. I know it is 2,5 years after the previous post. I am working on a project that would benefit a lot from this method, but sadly we are hand painting our landscape. Is there a way to sample color from the painted landscape in engine? Something like the placed grass would check the pixel color of the landscape position it is on?

Hey. You could use a Trace together with a phsicalmaterial, where you’re specify the color, or even the whole material. This will alow you, to grab the color based on the actor position .

https://gifyu.com/images/ueb5703.gif

Juice-Tin wrote me about this, here

this won’t work for instanced static meshes like foliage, though.

Your best bet is to save the landscape colour in a texture and using this texture in your foliage material, just like above.

Hey all. I don’t know if this is still relevant to anyone, but if you want a more dynamic approach for the foliage texture tinting, you can use a SceneCapture2D.

In my test scene, I used a landscape with 15x15 quads with all other settings on default, hence the 6000 units Z location. Make sure your SceneCapture2D has the right orientation (-180, -90, 90), set it to Orthographic, the Ortho width seems to be twice the location, set the Capture Source to BaseColor in RGB and use the Show Only Actors list to render only the landscape. The render target should have a square resolution (I’m using 64x64 in my test).

While you’re working, you should leave Capture Every Frame turned on, but turn it off once you’re done. Of course this could all be set up in a blueprint too.

For the foliage material I used ****'s example, just with the location and scale settings adjusted to my scene.

All in all, here’s what that would look like:

https://gfycat.com/BlandMatureHoki

EDIT: Here’s an example with slightly less obnoxious colors.

Also, maybe put something like this into your level blueprint, just to be sure.

Could you elaborate on this a little bit please?

I’m placing the scenecapture2d into my level, setting the perspective to Ortho with the correct actor rotation. I’m confused on where exactly you got your values for the scenecapture2d z-axis height and also the ortho width. If I have a landscape that is 2017x2017 and scaled to 400% does that mean I need to have z-axis height of the actor set to 8k-ish and the ortho width set to 16k-ish? Also it seems to not be rendering anything to the rendertarget texture that I have it set to.

Also how accurate is this method?

What I’m attempting to do currently is make an in depth mod for Ark: Survival Evolved (which is based on UE4.5 this “some” more current features included into the mod engine). In Ark they don’t have a grass tool and instead their “grass” placement is determined by the landscape material’s painted layer ids (more specifically the mask created from the painted layer id). What I’m trying to do is create my terrain material procedurally based on height / slope / etc values, then somehow render out each of the procedurally generated layers to a mask that I can import into the “paint” layers so I can generate grass with their version of the grass tool. If I can’t figure out a generate the masks then I’ll have to hand paint a large map, which imo doesn’t look as nice and it’s more tedious to me.

I do have ue4 16.2 (which is what I usually use) so I can create the landscape in current ue4 and use its features to generate the masks. I’m just having a mental conceptual block as to how to approach it to give accurate landscape masks.

In case anybody still need it. The Z value of the scene capture doesn’t change anything (as long as it’s not below the landscape).
Ortho width is the size of your landscape. If your landscape is 25200x25200 units, then set it to 25200

There’s still something I don’t understand about The Witcher 3 “pigment map”.
Their world is HUGE (74km²) and when trying to use this technic with a world half of this size, it’s doesn’t even work very well.
With a 20482048 scene capture texture, one pixel is something like 200 m² on the landscape so if you paint a 50m² circle of dry grass, the grass still look like grass 50m away because it’s smaller than a pixel on the texture capture.
Going over 4096
4096 scene capture texture result in insane sized texture (4k=130Mb, 8k = 524Mb, absolutly unusable) so I wonder how they get such precision in their “pigment map”