Shader abilities · Discussion #3817 · google/filament - GitHub

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

If you break writing to gl_FragDepth I hope you will provide some ... a view-filling quad with a material that samples the depth texture. Skiptocontent {{message}} google / filament Public Notifications Fork 1.4k Star 14k Code Issues 89 Pullrequests 3 Discussions Actions Projects 8 Wiki Security Insights More Code Issues Pullrequests Discussions Actions Projects Wiki Security Insights Shaderabilities #3817 Answered by romainguy jwwalker askedthisquestionin Q&A Shaderabilities #3817 jwwalker Apr16,2021 · 1answers · 4replies Answered by romainguy Returntotop jwwalker Apr16,2021 Iunderstandthattheusualgoalofamaterialfragmentblockistocomputematerialproperties,butcanitdootherthingspermittedinOpenGLESfragmentshaders,suchasdiscardthefragmentorwritetothegl_FragDepthvariable? 1 Answeredby romainguy Apr16,2021 YoucandoanythingGLSLsupportbutwedon'tsupportwritingtogl_*variables.Meaningthatwemaybreakyourcodeinthefuturesincewemakenoguarantees(espaswewilleventuallymoveawayfromGLandfocusonVulkanandMetal).Theuseofdiscardisfullysupportedthough. Viewfullanswer Replies 1suggestedanswer · 4replies Oldest Newest Top romainguy Apr16,2021 Maintainer YoucandoanythingGLSLsupportbutwedon'tsupportwritingtogl_*variables.Meaningthatwemaybreakyourcodeinthefuturesincewemakenoguarantees(espaswewilleventuallymoveawayfromGLandfocusonVulkanandMetal).Theuseofdiscardisfullysupportedthough. Markedasanswer 1 👍 1 4replies jwwalker Apr21,2021 Author Ifyoubreakwritingtogl_FragDepthIhopeyouwillprovidesomealternatewayofmodifyingthedepthofthecurrentfragment. romainguy Apr21,2021 Maintainer Whatareyoudoingwiththisbtw?Modifyinggl_FragDepthisneverrecommended(forperformancereasons). jwwalker Apr21,2021 Author WhatI'mtryingtodoisdrawacoloredoutlinearoundaselectedobject,andIwantpointsoftheoutlinetohavethesamedepthasnearbypointsoftheobject.Here'sasimpleexample: InanoldOpenGLprogram,Ididthatbyamethodthatdrewtheobjectinedgemodewithlinethicknessandusingthestencilbuffertomaskouttheobjectbeingoutlined.ButinFilamentthereisnoedgemodeandnolinethicknesscontrol.MyattempttoproduceasimilareffectinFilamentinvolvesdrawingtheselectedobjectintoadepthtexture,thendrawingaview-fillingquadwithamaterialthatsamplesthedepthtexture.Ifthefragmentshaderdeterminesthatthecurrentfragmentisintheselectedobject,orfarawayfromit,itdiscardsthefragment.Ontheotherhand,ifmyfragmentshaderdeterminesthatthecurrentfragmentisnear,butnotin,theselectedobject,itneedstosetthefragmentdepthtothedepthsampledfromthedepthtexture,becausemybigquadisatthewrongdepth. romainguy Apr21,2021 Maintainer Ahyeahthatmakesalotofsenseforthisusecase. Answerselectedbyjwwalker Signupforfree tojointhisconversationonGitHub. Alreadyhaveanaccount? Signintocomment Category 🙏 Q&A Labels Noneyet 2participants Addheadingtext Addboldtext, Additalictext, Addaquote, Addcode, InsertLink LinkText URL Add Addalink, Addabulletedlist, Addanumberedlist, Addatasklist, Directlymentionauserorteam Referenceanissueorpullrequest Addheadingtext Addboldtext, Additalictext, Addabulletedlist, Addanumberedlist, Addatasklist, 👍 1 👎 1 😄 1 🎉 1 😕 1 ❤️ 1 🚀 1 👀 1 Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?