How to draw a thick line in metal ? | Apple Developer Forums

文章推薦指數: 80 %
投票人數:10人

Why doesn't Apple offer line width control? It's too inconvenient. Metal ... Drawing lines either involves non-trivial shaders that interpolate SDFs or ... GlobalNavOpenMenu GlobalNavCloseMenu AppleDeveloper Search Cancel AppleDeveloper News Discover Design Develop Distribute Support Account Cancel Onlysearchwithin“” QuickLinks 5QuickLinks DeveloperForums Searchbykeywordsortags SubmitSearch Clearsearchquery AdditionalinformationaboutSearchbykeywordsortags SupportedSearches:KeywordsearchkeywordSingletag[iOS]MultipletagswithOR[iOS]OR[macOS]OR[Xcode]MultipletagswithAND[iOS][macOS][Xcode]Keywordsandtags[iOS][macOS]keywordUsernamesandprofilesuser:appleseed Post Profile ▲ Signin Createaccount Searchbykeywordsortags SubmitSearch Clearsearchquery AdditionalinformationaboutSearchbykeywordsortags SupportedSearches:KeywordsearchkeywordSingletag[iOS]MultipletagswithOR[iOS]OR[macOS]OR[Xcode]MultipletagswithAND[iOS][macOS][Xcode]Keywordsandtags[iOS][macOS]keywordUsernamesandprofilesuser:appleseed     You’renowwatchingthisthreadandwillreceiveemailswhenthere’sactivity.Clickagaintostopwatchingorvisityourprofile/homepagetomanageyourwatchedthreads.   You’vestoppedwatchingthisthreadandwillnolongerreceiveemailswhenthere’sactivity.Clickagaintostartwatching. Isthereanyhighefficiencywaytodothese?Imean,dont'tchangethestructureofthelinevertex.Whydoesn'tAppleofferlinewidthcontrol?It'stooinconvenient. Metal   Upvotepostofcgwang Downvotepostofcgwang 4.6k views Posted by cgwang Copytoclipboard Sharethispost CopiedtoClipboard Reply AddaComment AppleRecommended   Metal,beingalow-levelAPI,onlyofferswhatGPUsaredirectlycapableof.OpenGLofferswidelinesbyemulatingthemwithquadinasoftwarelayer.SuchsoftwareemulationisbeyondthescopeofwhatMetaltypicallyprovides. Posted by GraphicsandGamesEngineer Copytoclipboard Sharethispost CopiedtoClipboard   Postnotyetmarkedassolved UpvotereplyofGraphicsandGamesEngineer DownvotereplyofGraphicsandGamesEngineer PostmarkedasAppleRecommended AddaComment Replies   FurthermoreisthereaplantoaddthesefunctiontoMetal? Posted by cgwang Copytoclipboard Sharethispost CopiedtoClipboard   Upvotereplyofcgwang Downvotereplyofcgwang AddaComment   Metal,beingalow-levelAPI,onlyofferswhatGPUsaredirectlycapableof.OpenGLofferswidelinesbyemulatingthemwithquadinasoftwarelayer.SuchsoftwareemulationisbeyondthescopeofwhatMetaltypicallyprovides. Posted by GraphicsandGamesEngineer Copytoclipboard Sharethispost CopiedtoClipboard   Postnotyetmarkedassolved UpvotereplyofGraphicsandGamesEngineer DownvotereplyofGraphicsandGamesEngineer PostmarkedasAppleRecommended AddaComment   ”Typicallyyousay?“InthatcaseIthinkthisshouldbeoneoftheexceptions.Thethingis,SceneKitsupportsthelineprimitiveandMetalsupportsthelineandthelinestripprimitives,yetat1pxwideonaretinadisplayitisbarelyvisible.Withoutameanstosetthewidth,theiruseisverylimited.SinceMetaldoesnotincludesupportforageometryshader,thewayto“emulatethemwithquadinasoftwarelayer”foruswouldbetoditchthelineprimitiveandusetrianglestripsorpolygonprimitiveinstead,whichinturnaddscpuandmemoryoverheadand“renders”thelineprimitivepointlessforanythingexcept1pxwidelines.Soaddingsupportforlinesshouldincludeanoptiontosetlinethicknesseitherdirectlythroughapropertyorindirectlythroughageometryshader. Posted by Xartec Copytoclipboard Sharethispost CopiedtoClipboard   UpvotereplyofXartec DownvotereplyofXartec AddaComment   Isthereanyapplicationatallforsinglepixellinesinrealworldapplications?Whywasteanysiliconatallonthis?Withoutlinethicknesstodosomethinglikedrawingawireframeovermyobjectsorusingtheoldstenciltrickforoutliningobjects,Ihavetomaintain2versionsofmygeometry,whichisinefficientandcumbersome. Posted by cocheret Copytoclipboard Sharethispost CopiedtoClipboard   Upvotereplyofcocheret Downvotereplyofcocheret AddaComment   +1Thisisveryfrustratingandseemslikethesortofbasicfunctionalityonewouldexpectfromanyrobust3DAPI. Posted by iwoj Copytoclipboard Sharethispost CopiedtoClipboard   Upvotereplyofiwoj Downvotereplyofiwoj AddaComment   HardwaredoesnotsupportdrawingthicklinesandsothisfunctionalityhasnobusinessinbeinginaGPUAPI.Nottomentionthattherearealotofchoicesthathavetobedone(howtohandlelinecaps,howtohandlealiasingetc.).Iamsurprisedthatsomepeoplethinkthisisbasicfunctionality,itclearlyisnot.Drawinglineseitherinvolvesnon-trivialshadersthatinterpolateSDFsorconstructinggeometryonthefly.Thiscouldbeataskforanauxiliarylibrary,butdefinitelynotforthecoreAPI. Posted by jcookie Copytoclipboard Sharethispost CopiedtoClipboard   Upvotereplyofjcookie Downvotereplyofjcookie AddaComment



請為這篇文章評分?