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 / Mesh creation and manipulation

Author
Message
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 23rd Mar 2019 07:17 Edited at: 23rd Mar 2019 07:25
Hi,

I'm just experimenting a little with mesh generation / manipulation.
I know that there are some topics in the forum. Among others the ones from puzzeler. Who I think has done a great job and contributed a lot of functions.

I set myself the target. That AgkSharp provides more standard objects. And a simple and fast manipulation of the mesh-vertices.

Now I wanted to show you my progress. And yes - it is in AgkSharp

Here is a video of the result of my work. (no shader is used)


This is the code to create an object / mesh


The vertices are set here. Position and texture coordinates are calculated and the normals set to zero.


Now the indices are calculated.


Finally the normal ones are calculated, the generated indices are saved and agk build the mesh.


Now the mesh has to be added to the object.


And this is the loop for drawing.


Because the vertex positions are repositioned for each frame, the normals must also be recalculated each time.
Therefore there is a function for setting the position data and calculating the normals.

For setting the vertex positions.


For calculating the normals.


Unfortunately I don't know if this kind of mesh manipulation is faster than with Agk-Basic, because I don't have the comparison. Since I have avoided the use of the Agk usual Memblock and write directly into the memory, it could be somewhat faster.
After all, for each frame, 4096 vertices and the corresponding normals are recalculated.

It should also be noted that these functions for mesh creation / manipulation are still experimental. Therefore it is not yet included in the current version of AgkSharp.
But I will integrate it soon.

What do you think.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Mar 2019 07:24
That's pretty awesome MadBit
fubar
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 23rd Mar 2019 17:05 Edited at: 23rd Mar 2019 17:08
That is awesome.

I tried to manipulate the meshes of trees to sway but my computer would lock up lol. It was something like 50-90K vertices for all the trees though. I wanted to do that over a shader, because AppGameKit shadows don't work with shader mesh manipulation.

I'd have to figure out how to only get the ones in view of the camera to sway.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd Mar 2019 22:23
Superb work as always
Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 24th Mar 2019 01:45
Cool
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 24th Mar 2019 05:22
thank you all.

I'll see what else it can do.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 24th Mar 2019 05:33
I sent a sinewave through a terrain with memblocks but couldn't achieve what you have here as it worked and all
but I couldn't get the speed you have.

My parabolic effect on a terrain mesh


I think we had similar concepts you got the frame rates I couldn't tho
fubar
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 27th Mar 2019 22:13 Edited at: 27th Mar 2019 22:15
Ahh, thanks for this info.

I've been playing around a little further. The result was ... something interesting. (I think)
I wanted to set the height of the vertices with the Perlinnoise function. I already wanted to convert the functions puzzeler had written.
Then I thought I could search at NuGet. And indeed there is a whole Perlin-noise library.

And that's the result.


generator code

I know it's expandable.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th Mar 2019 22:23 Edited at: 27th Mar 2019 23:05
maybe you and puzzler could team up and produce a DLL plugin
that way everyone could benefit in Tier 1


not that I know much about DLL making but think there would need to be some problems
that would make it harder using functions inside the like that not sure
fubar

Login to post a reply

Server time is: 2024-11-23 02:16:14
Your offset time is: 2024-11-23 02:16:14