#ok so i need some sanity checks
1 messages · Page 1 of 1 (latest)
@tropic socket Hey, took a look at this. Haven't got it completely working yet, but you've missed that this part at the end of the frag is using += so need to combine with the calculated UV from before.
uv.x += x * cols - ind * rows;
uv.y += y * rows;
so needs an Add node here
Also, set the Alpha Clip Threshold to 0.1 or something. 1 is too high and will clip/discard any values since the texture only goes up to an alpha of 1
ok lemme fix that nodes bit
There's still another problem somewhere as the result isn't matching yet.
There's also the flickering which I think you mentioned before too - a little worrying as I'm not sure how to fix that.
yeah, but one step at a time, i should take the Vector2 that i build from the "Output UV" and add it to the original Vector2 i had, right?
Yep
I have a feeling the last problem may be that the graph is using Floats while the code uses a lot of uint. You may basically have to put all of the frag calculations into a Custom Function.
yeah, is there a specific reason why shadergraph doesnt give you access to stuff like fixed, uints and the like?
Not sure, just doesn't have it. I guess it isn't that common to use
thats fair
tbh even then there might be an issue either with how i'm calculating the UV dictionary in the guide, cuz "-10" gets rendered into
you think it could be feasable to just well, use the source hsls inside a custom function?
that way i could just toy with the output if i want extra vfx
The shader code would need to be altered a bit but should be able to work in a hlsl include file for a custom function yeah
well, worth a try i guess
shouldnt be too difficult to extract the two main methods
speaking of hlsl, do you know a good way to well, edit the files?
visual studio doesnt really support what unity has and it's a bit annoying as it is
I tend to use Notepad++, or VS code with an extension for syntax highlighting. That doesn't have any auto completion or error checking stuff though.
This works (in .hlsl file)
void FragCalcs_float(float2 uv, float _Rows, float _Cols, float4 customData1, float4 customData2, out float2 Out){
uint ind = floor(uv.x * _Cols);
uint x = 0;
uint y = 0;
uint dataInd = ind / 3;
uint sum = dataInd < 4 ? customData1[dataInd] : customData2[dataInd - 4];
for(int i = 0; i < 3; ++i){
if (dataInd > 3 & i == 3) break;
uint val = ceil(pow(10, 5 - i * 2));
x = sum / val;
sum -= x * val;
val = ceil(pow(10, 4 - i * 2));
y = sum / val;
sum -= floor(y * val);
if (dataInd * 3 + i == ind) i = 3;
}
float cols = 1.0 / _Cols;
float rows = 1.0 / _Rows;
uv.x += x * cols - ind * rows;
uv.y += y * rows;
Out = uv;
}
i'll try this out
Graph looks like this. Used a custom interpolator for the top part since the shader has those calculations in the vert side, though not too important.
Also testing with unlit, but can keep it lit if you want
Matches the shader code now. Still flickering, not sure how to fix that part.
tbh the original hlsl shader also flickered so like
might have to do something with urp...? idk
-10 does display as -10 tho
Yeah, I'm unsure why the flickering wasn't an issue in the original tutorial. It's possible there has been changes to the ParticleSystem component and it's precision isn't the same as it used to be
funky
thanks dyno
anyways, i'll see if i can find a way to fix it, unsure if i'll be succesful tho 
i tried toying a bunch with the shader options and it doesnt seem to be an issue on the shader indeed
so yeah, might be something to do with the funkin particle system
fun
@tepid lance this is pretty bizzare, i've decided to test this out on a built in render pipeline project, using the custom data values to display -10 (201303,0,0,0) (0,0,0,3) shows the flickering issue. oddly enough,, giving it some accuracy loss on purpose (in this case i changed 201303 to 201303.1) and the flickering isnt present anymore
this applies to both my URP project and the built in render pipeline project
so

Hmm, yeah that is a bit odd, but I guess if it works that's cool. I assume the result is still correct too, as the customData is put through a floor function in the shader anyway.
I guess that may be where the flickering was coming from too. If there was some slight floating point differences that floor could produce 201302 sometimes, but the small offset would keep it at 201303. 🤷
i mean
its funny cuz like
even if i input 201302 it still flickers
it seems to happen only on round numbers
Yeah that makes sense