Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - tsaylor

Pages: [1]
1
Scripting / Trying to understand position within a shader
« on: April 02, 2021, 10:39:45 AM »
I'm experimenting with writing my first shader, but I'm having a hard time using gl_FragCoord to determine the position within the image. Does anyone here have experience with this? I can set gl_FragColor and see results, but what I can't seem to do is pass values into the shader (say a position and a size), and then use those values relative to the current coordinate in gl_FragCoord. Basically I'm trying to color a specified set of pixels within the image, where those locations are provided by an AM layout. Is there a secret I'm missing? I can get the desired results in an online tool such as thebookofshaders.com, but using the same code (I think) in a shader called by AM does not give the same results. I suspect the difference lies in how the coordinates are used, but I don't know of any direct way to "debug" the shader and show those internal values at run time.

I can put together a test example if needed, but I was hoping someone here knows something about conversion between a "standard" GLSL fragment shader and an AM compatible shader. In case it matters, the object I'm assigning the shader to is a surface.

Pages: [1]