![]() Vec2 stitchCoord = (canvasCoords - tlPos) / stitching_size //where are we within our stitch? TlPos *= stitching_size //convert back to a canvas coordinate that's snapped to a single stich Vec2 tlPos = floor(canvasCoords / stitching_size) //what tile (stitch) are we on? Return (flipCoord * _Zoom + zeroOffset) / _BufferSize Vec2 zeroOffset = gl_TexCoord.xy * _BufferSize.xy - (vec2(canvasCoords.x, _) * _Zoom) PADDING_CANVAS(stitching_size) //we need some padding to make this look right UI_Uniform_Float(Stitch_Width, 0.0, 0.5, 0.05) //how wide is the thread? UI_Uniform_Float(stitching_size, 0.1, 8.0, 1.0) //size of each stitch You'll notice it uses a lot less code than the original (: ![]() (I don't think that made any sense, sorry.) Anyway, here's the finished shader. In other words, a Hexels shader operates on a subset of your entire canvas determined by your current pan and zoom in the application, rather than having a direct correspondence with the image data and what you see on the screen, like the original shader did. The most important difference between a Hexels shader and the shader we started with is the Hexels shader needs to "think" in terms of canvas coordinates (the coordinate system for your entire image) rather than pixel coordinates. ![]() I went back and redid this shader properly for Hexels. I've been fiddling around a bit with them seems really complicated I think it might be better that I try to learn some openGL first to get the hang of it Seems like a neat little shader makes crosses looks pretty cool. I did screenshots for the post effect but the blend mode is slightly better still just it does different things when i scroll to different places and and it copies the same image into it but overall much better.īut if I scroll down a little it all appears I've tried using it as post effect and blend modes. Scotty9339 a écrit :That works a lot better but I still get like a black overlay on the screen but the full image shows up in the layer preview. It looks like it pixelates and distorts half the scene. I'm not quite sure what it's supposed to do though. Mostly just changing the uniforms at the top to be accessible via the auto-generated shader interface. It needed some slight changes in the syntax to match Hexels' shader inputs, but nothing too serious. Out of curiosity, I dropped it into Hexels. Hexels only uses fragment shaders, so I snipped out the pixel shader part. It's copied out of a google doc, so the formatting may be a little off.Īs for the shader you posted, it's actually two shaders: a vertex shader (operates on the geometric points of a scene) and a fragment (pixel) shader (determines the color of a given pixel on the screen). For the time being, I've posted a copy of the shader tutorial on my personal website: We're in the process of moving to a new website, and not all of our tutorials have been migrated yet. Vec2 tlPos = floor(cPos / vec2(size, size)) ![]() Vec4 PostFX(sampler2D tex, vec2 uv, float time) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |