x

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"

Painting Landscape programmatically using C++

Hello,

I'm abording the procedural environtment generation to my master's thesis, and i found this part of the topic a bit hard: I want to paint a landscape using PCG algorithms, but for that i need to paint it using C++.

Is it possible in UE?

Product Version: UE 4.22
Tags:
more ▼

asked Apr 25 '19 at 08:12 AM in C++ Programming

avatar image

SalahAdDin
21 4 10 9

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

1 answer: sort voted first

ULandscapeComponent should have all things you need:

https://api.unrealengine.com/INT/API/Runtime/Landscape/ULandscapeComponent/index.html

This is probably what would be interested the most

https://api.unrealengine.com/INT/API/Runtime/Landscape/ULandscapeComponent/SetHeightmap/index.html

And here is example of how to generate UTexture2D:

http://www.danielmayor.com/ue4-create-texture-editor-plugin

https://isaratech.com/save-a-procedurally-generated-texture-as-a-new-asset/

Alternaticly, since you want to do some algorithm, you could use normal multi polygonal plane and use world displacement in material shader, not sure if you could use landscape for it too. This would make your generation done in GPU, ofcorse if it's not too heavy

more ▼

answered Apr 25 '19 at 10:32 AM

avatar image

Shadowriver
35.7k 926 168 1104

avatar image TomShirk Apr 25 '19 at 03:10 PM

Dude, you're a life-saver! I don't know if this helps the OP with his question, but it solves what I have been trying to do! Upvoted!

So let's say I plan to GetHeightmap() to get the landscape height map, perform some work on the HM based on something at a particular spot on the landscape then put it back with SetHeightmap()... is there a way to quickly correlate a particular point on the landscape based on an object placed on it in the editor with a particular point on the landscape HM?

avatar image SalahAdDin Apr 26 '19 at 07:59 AM

Are you working in something related to?

avatar image TomShirk Apr 29 '19 at 12:58 PM

Perhaps, I think so; I am attempting to create building assets that flatten out the landscape around where you place them, just a little bit, so that they can line up better with the landscape with having to resort to - potentially huge and drastic - additional areas of mesh which in most cases would just be completely below the landscape.

avatar image SalahAdDin Apr 26 '19 at 08:09 AM

About the generated texture, i'm planing to use custom existing assets(textures), i just need to paint the landscape with that textures using C++.

avatar image TomShirk Apr 29 '19 at 12:59 PM

Sounds like you're creating a custom brush?

(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