• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code need help with premitive

M

MrMouse

Guest
Hi, i need some help with premitive.
I use vertex buffer to make some shape and draw it to screen.
And i can't find the way to increase width to my line. GMS2 give me the pretty line with 1pixel width, but i need up it to any value with save the silhouette. I try to use the pr_trianglestrip, but it's look terrible. I need somethink like outline with random count of pixels.

Update: but i have another problem, how i can blur this now? I need somethink like gaussian blur from photoshop.
 

Attachments

Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Since GPU can only draw lines and triangles, you will need to "extrude" your line into triangles.
This can be don with sin/cos or lengthdir_x/lengthdir_y and a bit of logic to handle turns:upload_2017-12-21_11-8-52.png
the inner (circled) point can be either computed through actual line intersection check, or by taking an average between first and second line segment angles and then stepping 90 degrees from that in the according direction.
 
M

MrMouse

Guest
This can be don with sin/cos or lengthdir_x/lengthdir_y and a bit of logic to handle turns:
yes, i know this point, same i make my line, but it i would rotate the line my point would get offset, wich dont be correct in some angle. And if i add same method to each poin of my shape - it vould be vortex premitive...
 

Attachments

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
yes, i know this point, same i make my line, but it i would rotate the line my point would get offset, wich dont be correct in some angle. And if i add same method to each poin of my shape - it vould be vortex premitive...
Insertion of an additional triangle on "turns" allows to avoid distortions.

Similar approach is used when drawing fancier paths as well (random example):
upload_2017-12-21_11-43-15.png
 
M

MrMouse

Guest
but i have another problem, how i can blur this now? I need somethink like gaussian blur from photoshop.
 

Bingdom

Googledom
Through a shader. Do a google search and it should bring you to the marketplace that has examples of how it's done.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Through a shader. Do a google search and it should bring you to the marketplace that has examples of how it's done.
Other option: give the line a texture with gradient-ish fade to simulate blur. That would be faster than a shader in this case.
 
Top