• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Quat

Thick Lines

3 posts in this topic

Hi,

 

I am expanding lines using the geometry shader to make them "thick."  I do the expansion in projective NDC space in 2D.  My first approach was to just expand in the direction of the line normal in 2D.  However, this creates discontinuities where line segments meet in a line strip (see left side of http://postimg.org/image/f5frxyp1v/).  My 2nd approach was to use line strip with adjacency, and access the adjacent lines to do a sort of normal averaging.  This works well if the lines do not take "sharp turns", however, there are cases where the averaged normal isn't a good choice and it creates a thin quad (see right side of http://postimg.org/image/f5frxyp1v/). 

 

Does anyone know a good strategy for handling the "sharp" line turns?

Edited by Quat
0

Share this post


Link to post
Share on other sites
Usually this is done by drawing the expanded lines without modification and drawing circles where the lines meet.
Maybe my information is a bit outdated, but OpenGL has an extension to draw smooth points ( eg. circles ), but creating the circles in the geometry shader would be a certainly working solution. More costly, though. I would advice to change the circle's level of detail depending on the line's thickness ( thus the circle's radius, obviously ). I think using the circle's circumference to determine the circle's LOD would give nice results.
2

Share this post


Link to post
Share on other sites

I implemented a 3D based technique a couple months ago based on some discussions I saw online that seems at least similar to your need.  The idea is that when you expand the line in the geometry shader that you ensure the end of the line is extruded forward by the same amount as the thickness of the expanded line.  When you do this, you also include the original vertex location in the expanded vertex layout.

 

Finally in the pixel shader you test to see how far from the end point you are.  If you can determine that your pixel is from the end point area, then you can test to see how far from the end point it is, and kill the pixel if you are too far away from it.  That essentially creates a sphere just like TheUnnamable mentioned at each end point.

 

I'm sure you can reproduce the same thing in 2D without too much trouble.  It is certainly a bit heavier algorithm than what you are currently doing, but the results look nice and it would solve your current issue.  Another possible solution with some sample code can be found here.  I hope that helps!

2

Share this post


Link to post
Share on other sites

Hello.

May be you could use a centre line for your line then offset from both directions from centre line to half line thickness 90 degrees to make the vertices

(you can plot a point 90 degrees from the end point)

 

and if you want round looking joints look up the math for a lobster back and just look at it as if its flat and not a pipe.

 

you can plot a vertex like this.

outercorrnerpoints is one end of your lines out side and innercorrnerpoints is the same end but the inside edge of the line

//set the first element
 ele = 0;//is a count to a vertex in the GS
 outercorrnerpoints[ele].x = pos.x;
 outercorrnerpoints[ele].y = outerradius;
 outercorrnerpoints[ele].z = 0.0;
 
 //inner point
 innercorrnerpoints[ele].x = pos.x;
 innercorrnerpoints[ele].y = innerradius;
 innercorrnerpoints[ele].z = 0.0;

 

 

 

//set the second element
 ele = 1;
 outercorrnerpoints[ele].x = pos.x;
 outercorrnerpoints[ele].y = outerradius * sin(radians(67.5));
 outercorrnerpoints[ele].z = outerradius * cos(radians(67.5));
 
 //inner point
 innercorrnerpoints[ele].x = pos.x;
 innercorrnerpoints[ele].y = innerradius * sin(radians(67.5));
 innercorrnerpoints[ele].z = innerradius * cos(radians(67.5));

 

 

Your making a quad

 

Lobster back pipe bend

 

http://www.google.com.au/imgres?imgurl=http://www.mig-welding.co.uk/forum/attachment.php%3Fattachmentid%3D9429%26d%3D1243468070&imgrefurl=http://www.mig-welding.co.uk/forum/showthread.php?t%3D12283%26page%3D2&h=444&w=463&sz=21&tbnid=YFFR5fP4xYAGzM:&tbnh=90&tbnw=94&zoom=1&usg=__12Azp9avKfKby7hmekzXrAiowVQ=&docid=Lkm2MqFr9lbORM&hl=en&sa=X&ei=lJslUtPbE-jQiAeqsoGoDA&ved=0CGIQ9QEwAg&dur=4221

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0