[EditorPlugin] VertexRenderer

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

[EditorPlugin] VertexRenderer

Post by zocka » 17 Feb 2018, 17:06

[media]https://cdn.discordapp.com/attachments/ ... yramid.mp4[/media]

Inspired by OpenGL rendering you define an "ArrayBuffer" with vertex and optionally data values, set how the values are interpreted as vertex or data[1] and then it get's passed through the pipeline of being potentially transformed in the "VertexShader"[2], the values are interpreted as block-coordinates and lastly the block to be placed may be influenced in the "FragmentShader"[3].

Of course the whole "draw triangles" thing is not as useful as it is when drawing primitives, everything is a mess, might break unintendedly, is blocking and awfully slow (64³ maps of course render a nicer result, but are even slower) - especially when using the useless animation loop, but it was a fun project testing yet again what useless stuff can be done with the possibilities provided to us.

Would be cool if someone would actually load objects and post pictures :D

[1]

Code: Select all

G_ArrayBuffer = [
	// x, y, z, data[0]
	-.3,  0., 0.,  0.,
	 .2,  .3, 0.,  0.,
	 .2, -.3, 0.,  0.,
	
	 .2,  .3, 0.,  1.,
	 .2, -.3, 0.,  1.,
	 0.,  0., .6,  1.,

	-.3,  0., 0.,  2.,
	 .2, -.3, 0.,  2.,
	 0.,  0., .6,  2.,

	-.3,  0., 0.,  3.,
	 .2,  .3, 0.,  3.,
	 0.,  0., .6,  3.
];
G_VertexSize = 3;
G_DataSize = 1;
[2]

Code: Select all

Position = _V3Mul(Position, 1.5);
declare X = Position.X * MathLib::Cos(G_Angle) - Position.Y * MathLib::Sin(G_Angle);
declare Y = Position.X * MathLib::Sin(G_Angle) + Position.Y * MathLib::Cos(G_Angle);
Position.X = X;
Position.Y = Y;
[3]

Code: Select all

if (Data[0] >= 0.9) {
	BlockModel = GetBlockModelFromName("StadiumCircuitTurbo");
}
if (Data[0] >= 1.9) {
	BlockModel = GetBlockModelFromName("StadiumControlRoadGlass");
}
if (Data[0] >= 2.9) {
	BlockModel = GetBlockModelFromName("StadiumTubeRoadSoundSystem");
}
Source
Last edited by zocka on 18 Feb 2018, 12:34, edited 1 time in total.
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

User avatar
Miss
Posts: 1470
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: [EditorPlugin] VertexRenderer

Post by Miss » 17 Feb 2018, 20:24

This is incredible. Well done! :thumbsup:

:roflol:
1070 GTX, i7 4790k, 16GB RAM, Windows 10
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative Maniaplanet & Turbo scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: [EditorPlugin] VertexRenderer

Post by zocka » 18 Feb 2018, 12:46

With some stability adjustments it should now be possible to load objects like suzanne or the teapot with more than 6000 faces.

Image
The teddy has 3180 faces. Unfortunately for sitting it up you have to decrease the resolution too much to fit the whole object while stretching it along the z-axis to make up for the non-square blocks. Configuration for the teddy: gist. (Note that accessing Data in the FragmentShader block will break with this example).

(On a site-note: your gist-include should respect the hash so that you can include a single file and not get the whole dump of files in the gist)
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

User avatar
TMarc
Posts: 14630
Joined: 05 Apr 2011, 19:10
Location: Europe
Contact:

Re: [EditorPlugin] VertexRenderer

Post by TMarc » 18 Feb 2018, 15:24

you're doing like voxels but with Maniaplanet blocks? "Bloxels"? :roflol:
Crazy, really crazy :3
maniaplanet forum global moderator

Link list with FAQ, Support, Wiki, Tutorials, Community activities, and much more.

System specs: Intel i7-970 12GB RAM, nVidia GTX 970, Creative SB X-Fi, 2xSSD

User avatar
Dommy
Translator
Translator
Posts: 1872
Joined: 25 Aug 2011, 21:45
Location: Poland
Contact:

Re: [EditorPlugin] VertexRenderer

Post by Dommy » 18 Feb 2018, 15:39

One of the prettier things I've seen in ManiaPlanet lately. :D
Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT

Contact me via GALAXY & PURSUIT DISCORD

Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 3 guests