#Hey all, just wondering if anyone knows
1 messages · Page 1 of 1 (latest)
Expanding off of this idea, I have created a shader graph with an expansion of the idea which doesn't seem to work, presumably I'm doing something wrong in terms of node usage:
Currently creating a diagram of the intended result
Here is my explanation of the intended result! To put it simply my goal is to get it where, if the current fragment's "Y" position is below the curve's "Y" position the alpha should be 1. If the current fragment's "Y" position is greater than that of the curve, it's alpha should be multiplied by 0 or hidden.
I assume this basic concept would work I just don't quite understand how or why the fragments are not being hidden on my current sprite using this shader, it is a "Sprite Lit" shader material. I am also unsure if all the nodes were 100% used as they were explained as I am still quite new to shaders as a whole and there may be some lacking detail in how they should be used vs how they were used. Since this is a Pixel-art project I assume I'd use a low pixel/texel size to reduce the amount of calculations each tile would need to make as I would be downsampling anyways.
Something like this perhaps?
Make sure you use the Alpha port too. The Base Color is a Vector3 so connecting a Vector4 would just be truncated down
Yes exactly! Thank you so much as always haha.
Would you happen to know how I could maintain a 16x16 pixel density per "tile" I've noticed no matter what sprite I use regardless of size I get a completely smooth curve while I'd like ideally to maintain a pixel resolution, logically I'd think to divide the output of the "Step" to whatever resolution I'm using however I've been told an operation as such:
Which I created for use in a foliage shader can be quite expensive, is there a better way of "pixelating" or maintaining pixel resolution of a sprite using the shader?
Yea you'd do something like this on the UV input
The alternative would be rendering those objects to a lower resolution render texture, then blitting back to the main camera resolution
Ah, I see! Would rendering and blitting be more performant than dividing? (Significantly)
Also, wouldn't the "Step" output connecting to the "Alpha" still smooth out the curve as the "alpha" (mask?) still be the original resolution?
Would likely be less fragments to process but I have no idea if it would be significantly more performant. Might be something where you'd need to try both and profile
Not too sure what you mean. Step doesn't really do any smoothing, it's just a >= comparison to output 1 or 0.
If you are rendering into a lower resolution texture the curve won't look smooth since there's literally not enough pixels.
When you blit back to the main camera and scale that up you'd use point filtering on the texture sample to keep it looking pixelated