Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Modifying Height Map in "real time"?

Author
Message
MMT
6
Years of Service
User Offline
Joined: 12th Mar 2018
Location:
Posted: 30th Jan 2021 17:25
Is there a way to let's say raycast onto the heightmap and then raise the height at that position?

I guess you have to use memblocks, but then again, is this fast enough in real time?

Perhaps this forum has some examples?!

The author of this post has marked a post as an answer.

Go to answer

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
OriginalKronos
6
Years of Service
User Offline
Joined: 10th Nov 2017
Location:
Posted: 31st Jan 2021 13:00 Edited at: 31st Jan 2021 13:29
Dont forget that you will have to recalculate the normals after every change if you want the lighting to be correct.

There is some code in this thread that seems to do the very thing you are asking about. https://forum.thegamecreators.com/thread/222992
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Feb 2021 04:07
This was possible in realtime in DBP, I'm certain AppGameKit is fast enough.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Feb 2021 04:56
I reckon you could do this in real time with a shader
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 3rd Feb 2021 05:58 Edited at: 3rd Feb 2021 06:01
This post has been marked by the post author as the answer.
example 1 (modifying a mesh in real time)


example 2 slightly easier method



Ideally a shader would be fastest

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 3rd Feb 2021 06:09 Edited at: 3rd Feb 2021 06:14
the way i understand there are mainly two methods that can be used
you can modify the vertex data directly as as any object created from a heightmap is a mesh
secondly as heightmaps themselves are just black and white images you can modify the image used
to create your land mesh. both of these approaches can be done with memblocks or a shader.

best of luck with it

ps i did have another vertex data approach just cant find t sorry

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
MMT
6
Years of Service
User Offline
Joined: 12th Mar 2018
Location:
Posted: 15th Jul 2023 18:51
Quote: "example 1 (modifying a mesh in real time)
[...]
Ideally a shader would be fastest"


Heyhey, long time no see! This works pretty well and easy, but there is just something strange about it, when I use your example in the AppGameKit the modification are pretty fast.

When I use my own code there is stuttering when the new heightmap is created. Basically the createobjectfromheightmap is pretty slow, albeit I dont seem to do anything different.

Login to post a reply

Server time is: 2024-04-19 20:23:42
Your offset time is: 2024-04-19 20:23:42